diff --git a/package-lock.json b/package-lock.json index c539d23..948156f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,49 +1,49 @@ { "name": "@bonfida/sns-widget", - "version": "0.0.3", + "version": "0.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bonfida/sns-widget", - "version": "0.0.3", + "version": "0.0.4", "license": "MIT", "dependencies": { - "@bonfida/emojis": "^1.0.1", - "@bonfida/spl-name-service": "2.0.0-alpha.23", + "@bonfida/emojis": "^1.0.2", + "@bonfida/sns-react": "^2.0.2", + "@bonfida/spl-name-service": "2.0.1", "@pythnetwork/client": "^2.19.0", "@solana/wallet-adapter-react": "^0.15.35", "@solana/wallet-adapter-react-ui": "^0.9.34", "@solana/wallet-adapter-wallets": "^0.19.23", "@solana/web3.js": "^1.87.6", "ahooks": "^3.7.8", - "react-async-hook": "^4.0.0", - "split-graphemes": "^0.5.0" + "react-async-hook": "^4.0.0" }, "devDependencies": { "@foxwallet/wallet-adapter-foxwallet": "^0.1.1", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", - "@types/react": "^18.2.37", - "@types/react-dom": "^18.2.15", - "@typescript-eslint/eslint-plugin": "^6.11.0", - "@typescript-eslint/parser": "^6.11.0", + "@types/react": "^18.2.41", + "@types/react-dom": "^18.2.17", + "@typescript-eslint/eslint-plugin": "^6.13.2", + "@typescript-eslint/parser": "^6.13.2", "@vitejs/plugin-react": "^4.2.0", "autoprefixer": "^10.4.16", - "eslint": "^8.54.0", + "eslint": "^8.55.0", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.4.4", + "eslint-plugin-react-refresh": "^0.4.5", "gh-pages": "^6.1.0", - "postcss": "^8.4.31", + "postcss": "^8.4.32", "prettier": "3.1.0", - "tailwind-merge": "^2.0.0", + "tailwind-merge": "^2.1.0", "tailwindcss": "^3.3.5", - "typescript": "^5.2.2", + "typescript": "^5.3.2", "vite": "^4.5.0", "vite-bundle-visualizer": "^0.11.0", - "vite-plugin-dts": "^3.6.3", - "vite-plugin-node-polyfills": "^0.16.0" + "vite-plugin-dts": "^3.6.4", + "vite-plugin-node-polyfills": "^0.17.0" }, "peerDependencies": { "@pythnetwork/client": "^2.19.0", @@ -2210,9 +2210,9 @@ "peer": true }, "node_modules/@babel/runtime": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", - "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.5.tgz", + "integrity": "sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -2267,13 +2267,48 @@ } }, "node_modules/@bonfida/emojis": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@bonfida/emojis/-/emojis-1.0.1.tgz", - "integrity": "sha512-r+2OL1lsvBJ2LwXrNNr5nDcwCW5AHW+JHpFxYbBldZ/vKO7yUSNcYPxaK9QLwrrYCa4j/UrOgePFHVodquzwCA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bonfida/emojis/-/emojis-1.0.2.tgz", + "integrity": "sha512-2xhp9SdWX5lW9jhJTxJTpVWMM+7ErfVh8qQKb8/bU8IE+oGSoRptXZKCEYIkVLELxpflRrFKy9hedp0ZRUUGVw==", "dependencies": { "graphemesplit": "^2.4.4" } }, + "node_modules/@bonfida/sns-react": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@bonfida/sns-react/-/sns-react-2.0.2.tgz", + "integrity": "sha512-JHWofh9Xq6vftQB/zBt+COr4ck74UzW/F9tJnAnGo8d7GZLqg22w0oc8/yzZnIj/91/QCO3jY21iQatXyDDstg==", + "dependencies": { + "@bonfida/spl-name-service": "^1.6.1", + "@solana/web3.js": "^1.87.6", + "react-async-hook": "^4.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, + "node_modules/@bonfida/sns-react/node_modules/@bonfida/spl-name-service": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@bonfida/spl-name-service/-/spl-name-service-1.6.1.tgz", + "integrity": "sha512-AWIPJM6uoofz2tCDRdD8wf1kCzs32yHYmRRQSIzYJ3HuIDufqoilxn8svxsvKRQA2Fm2up6kqnesROp2aoVMCA==", + "dependencies": { + "@ethersproject/sha2": "^5.7.0", + "@pythnetwork/client": "^2.19.0", + "@solana/buffer-layout": "^4.0.1", + "@solana/spl-token": "0.3.7 ", + "bech32-buffer": "^0.2.1", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "buffer": "^6.0.3", + "ipaddr.js": "^2.1.0", + "punycode": "^2.3.0", + "tweetnacl": "^1.0.3" + }, + "peerDependencies": { + "@solana/web3.js": "^1.75.0" + } + }, "node_modules/@bonfida/sns-records": { "version": "0.0.1-alpha.8", "resolved": "https://registry.npmjs.org/@bonfida/sns-records/-/sns-records-0.0.1-alpha.8.tgz", @@ -2361,28 +2396,45 @@ "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" }, "node_modules/@bonfida/spl-name-service": { - "version": "2.0.0-alpha.23", - "resolved": "https://registry.npmjs.org/@bonfida/spl-name-service/-/spl-name-service-2.0.0-alpha.23.tgz", - "integrity": "sha512-s+2gqSVNy/PsyQ+RFkqde0C/fgnmlJuIyuY17ygfvOG1BcxuhsZ0ozKyQUACSCsl0YwLfrFwcGRjeBO4Sg2WZw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@bonfida/spl-name-service/-/spl-name-service-2.0.1.tgz", + "integrity": "sha512-pIc5Vmt9cKbNybbFq49KEj7YWzQI5f2ccAeoEqnAg3ENbvBdPVlUvpNBJCmPQ/ki/ho9bJ+l8ftUN361XU5gOg==", "dependencies": { "@bonfida/sns-records": "0.0.1-alpha.8", "@ethersproject/hash": "^5.7.0", "@ethersproject/sha2": "^5.7.0", "@pythnetwork/client": "^2.19.0", "@solana/buffer-layout": "^4.0.1", - "@solana/spl-token": "0.3.7", + "@solana/spl-token": "0.3.9", "bech32-buffer": "^0.2.1", "bn.js": "^5.2.1", "borsh": "^0.7.0", "buffer": "^6.0.3", + "graphemesplit": "^2.4.4", "ipaddr.js": "^2.1.0", - "punycode": "^2.3.0", + "punycode": "^2.3.1", "tweetnacl": "^1.0.3" }, "peerDependencies": { "@solana/web3.js": "^1.87.3" } }, + "node_modules/@bonfida/spl-name-service/node_modules/@solana/spl-token": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.9.tgz", + "integrity": "sha512-1EXHxKICMnab35MvvY/5DBc/K/uQAOJCYnDZXw83McCAYUAfi+rwq6qfd6MmITmSTEhcfBcl/zYxmW/OSN0RmA==", + "dependencies": { + "@solana/buffer-layout": "^4.0.0", + "@solana/buffer-layout-utils": "^0.2.0", + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "@solana/web3.js": "^1.47.4" + } + }, "node_modules/@censo-custody/solana-wallet-adapter": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@censo-custody/solana-wallet-adapter/-/solana-wallet-adapter-0.1.0.tgz", @@ -2843,9 +2895,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", - "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -2893,9 +2945,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.54.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", - "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", + "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -7050,9 +7102,9 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.2.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz", - "integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==", + "version": "18.2.41", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.41.tgz", + "integrity": "sha512-CwOGr/PiLiNBxEBqpJ7fO3kocP/2SSuC9fpH5K7tusrg4xPSRT/193rzolYwQnTN02We/ATXKnb6GqA5w4fRxw==", "dev": true, "dependencies": { "@types/prop-types": "*", @@ -7061,9 +7113,9 @@ } }, "node_modules/@types/react-dom": { - "version": "18.2.15", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.15.tgz", - "integrity": "sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==", + "version": "18.2.17", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.17.tgz", + "integrity": "sha512-rvrT/M7Df5eykWFxn6MYt5Pem/Dbyc1N8Y0S9Mrkw2WFCRiqUgw9P7ul2NpwsXCSM1DVdENzdG9J5SreqfAIWg==", "dev": true, "dependencies": { "@types/react": "*" @@ -7082,9 +7134,9 @@ "dev": true }, "node_modules/@types/semver": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.5.tgz", - "integrity": "sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==", + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, "node_modules/@types/stack-utils": { @@ -7117,16 +7169,16 @@ "peer": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.11.0.tgz", - "integrity": "sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.2.tgz", + "integrity": "sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.11.0", - "@typescript-eslint/type-utils": "6.11.0", - "@typescript-eslint/utils": "6.11.0", - "@typescript-eslint/visitor-keys": "6.11.0", + "@typescript-eslint/scope-manager": "6.13.2", + "@typescript-eslint/type-utils": "6.13.2", + "@typescript-eslint/utils": "6.13.2", + "@typescript-eslint/visitor-keys": "6.13.2", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -7152,15 +7204,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.11.0.tgz", - "integrity": "sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.2.tgz", + "integrity": "sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.11.0", - "@typescript-eslint/types": "6.11.0", - "@typescript-eslint/typescript-estree": "6.11.0", - "@typescript-eslint/visitor-keys": "6.11.0", + "@typescript-eslint/scope-manager": "6.13.2", + "@typescript-eslint/types": "6.13.2", + "@typescript-eslint/typescript-estree": "6.13.2", + "@typescript-eslint/visitor-keys": "6.13.2", "debug": "^4.3.4" }, "engines": { @@ -7180,13 +7232,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz", - "integrity": "sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.2.tgz", + "integrity": "sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.11.0", - "@typescript-eslint/visitor-keys": "6.11.0" + "@typescript-eslint/types": "6.13.2", + "@typescript-eslint/visitor-keys": "6.13.2" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -7197,13 +7249,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.11.0.tgz", - "integrity": "sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.2.tgz", + "integrity": "sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.11.0", - "@typescript-eslint/utils": "6.11.0", + "@typescript-eslint/typescript-estree": "6.13.2", + "@typescript-eslint/utils": "6.13.2", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -7224,9 +7276,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.11.0.tgz", - "integrity": "sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.2.tgz", + "integrity": "sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -7237,13 +7289,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz", - "integrity": "sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.2.tgz", + "integrity": "sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.11.0", - "@typescript-eslint/visitor-keys": "6.11.0", + "@typescript-eslint/types": "6.13.2", + "@typescript-eslint/visitor-keys": "6.13.2", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -7264,17 +7316,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.11.0.tgz", - "integrity": "sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.2.tgz", + "integrity": "sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.11.0", - "@typescript-eslint/types": "6.11.0", - "@typescript-eslint/typescript-estree": "6.11.0", + "@typescript-eslint/scope-manager": "6.13.2", + "@typescript-eslint/types": "6.13.2", + "@typescript-eslint/typescript-estree": "6.13.2", "semver": "^7.5.4" }, "engines": { @@ -7289,12 +7341,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz", - "integrity": "sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==", + "version": "6.13.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.2.tgz", + "integrity": "sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/types": "6.13.2", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -10044,15 +10096,15 @@ } }, "node_modules/eslint": { - "version": "8.54.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", - "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", + "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.3", - "@eslint/js": "8.54.0", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.55.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -10111,9 +10163,9 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.4.tgz", - "integrity": "sha512-eD83+65e8YPVg6603Om2iCIwcQJf/y7++MWm4tACtEswFLYMwxwVWAfwN+e19f5Ad/FOyyNg9Dfi5lXhH3Y3rA==", + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.5.tgz", + "integrity": "sha512-D53FYKJa+fDmZMtriODxvhwrO+IOqrxoEo21gMA0sjHdU6dPVH4OhyFip9ypl8HOF5RV5KdTo+rBQLvnY2cO8w==", "dev": true, "peerDependencies": { "eslint": ">=7" @@ -14837,9 +14889,9 @@ } }, "node_modules/postcss": { - "version": "8.4.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", - "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "version": "8.4.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", + "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", "dev": true, "funding": [ { @@ -14856,7 +14908,7 @@ } ], "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -16645,11 +16697,6 @@ "node": ">=0.10.0" } }, - "node_modules/split-graphemes": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/split-graphemes/-/split-graphemes-0.5.0.tgz", - "integrity": "sha512-TTZ4IPmxuGZOPqhKLHscOeVf568gDP8JE8FxaZU/k30Q3Ra1BRhMv8d9jq1R6A/6T8wSz6ozYn3aJ5skgP6omA==" - }, "node_modules/split-on-first": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", @@ -16946,12 +16993,12 @@ } }, "node_modules/tailwind-merge": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.0.0.tgz", - "integrity": "sha512-WO8qghn9yhsldLSg80au+3/gY9E4hFxIvQ3qOmlpXnqpDKoMruKfi/56BbbMg6fHTQJ9QD3cc79PoWqlaQE4rw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.1.0.tgz", + "integrity": "sha512-l11VvI4nSwW7MtLSLYT4ldidDEUwQAMWuSHk7l4zcXZDgnCRa0V3OdCwFfM7DCzakVXMNRwAeje9maFFXT71dQ==", "dev": true, "dependencies": { - "@babel/runtime": "^7.23.1" + "@babel/runtime": "^7.23.5" }, "funding": { "type": "github", @@ -17293,9 +17340,9 @@ } }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -17757,9 +17804,9 @@ } }, "node_modules/vite-plugin-dts": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-3.6.3.tgz", - "integrity": "sha512-NyRvgobl15rYj65coi/gH7UAEH+CpSjh539DbGb40DfOTZSvDLNYTzc8CK4460W+LqXuMK7+U3JAxRB3ksrNPw==", + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-3.6.4.tgz", + "integrity": "sha512-yOVhUI/kQhtS6lCXRYYLv2UUf9bftcwQK9ROxCX2ul17poLQs02ctWX7+vXB8GPRzH8VCK3jebEFtPqqijXx6w==", "dev": true, "dependencies": { "@microsoft/api-extractor": "^7.38.0", @@ -17783,9 +17830,9 @@ } }, "node_modules/vite-plugin-node-polyfills": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.16.0.tgz", - "integrity": "sha512-uj1ymOmk7TliMxiivmXokpMY5gVMBpFPSZPLQSCv/LjkJGGKwyLjpbFL64dbYZEdFSUQ3tM7pbrxNh25yvhqOA==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.17.0.tgz", + "integrity": "sha512-iPmPn7376e5u6QvoTSJa16hf5Q0DFwHFXJk2uYpsNlmI3JdPms7hWyh55o+OysJ5jo9J5XPhLC9sMOYifwFd1w==", "dev": true, "dependencies": { "@rollup/plugin-inject": "^5.0.5", @@ -17797,7 +17844,7 @@ "url": "https://github.com/sponsors/davidmyersdev" }, "peerDependencies": { - "vite": "^2.0.0 || ^3.0.0 || ^4.0.0" + "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" } }, "node_modules/vlq": { diff --git a/package.json b/package.json index 0aeb9fa..7d24011 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bonfida/sns-widget", - "version": "0.0.3", + "version": "0.0.4", "description": "SNS Widget for 3rd-party apps for quick domain search and register", "repository": { "type": "git", @@ -37,10 +37,10 @@ "analyse": "vite-bundle-visualizer" }, "peerDependencies": { + "@pythnetwork/client": "^2.19.0", "@solana/wallet-adapter-react": "^0.15", "@solana/wallet-adapter-react-ui": "^0.9", "@solana/wallet-adapter-wallets": "^0.19.23", - "@pythnetwork/client": "^2.19.0", "@solana/web3.js": "^1.87.6", "react": "^18", "react-dom": "^18" @@ -50,37 +50,37 @@ "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", - "@types/react": "^18.2.37", - "@types/react-dom": "^18.2.15", - "@typescript-eslint/eslint-plugin": "^6.11.0", - "@typescript-eslint/parser": "^6.11.0", + "@types/react": "^18.2.41", + "@types/react-dom": "^18.2.17", + "@typescript-eslint/eslint-plugin": "^6.13.2", + "@typescript-eslint/parser": "^6.13.2", "@vitejs/plugin-react": "^4.2.0", "autoprefixer": "^10.4.16", - "eslint": "^8.54.0", + "eslint": "^8.55.0", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.4.4", + "eslint-plugin-react-refresh": "^0.4.5", "gh-pages": "^6.1.0", - "postcss": "^8.4.31", + "postcss": "^8.4.32", "prettier": "3.1.0", - "tailwind-merge": "^2.0.0", + "tailwind-merge": "^2.1.0", "tailwindcss": "^3.3.5", - "typescript": "^5.2.2", + "typescript": "^5.3.2", "vite": "^4.5.0", "vite-bundle-visualizer": "^0.11.0", - "vite-plugin-dts": "^3.6.3", - "vite-plugin-node-polyfills": "^0.16.0" + "vite-plugin-dts": "^3.6.4", + "vite-plugin-node-polyfills": "^0.17.0" }, "dependencies": { - "@bonfida/emojis": "^1.0.1", - "@bonfida/spl-name-service": "2.0.0-alpha.23", + "@bonfida/emojis": "^1.0.2", + "@bonfida/sns-react": "^2.0.2", + "@bonfida/spl-name-service": "2.0.1", "@pythnetwork/client": "^2.19.0", - "@solana/wallet-adapter-react": "^0.15.35", - "@solana/wallet-adapter-react-ui": "^0.9.34", + "@solana/wallet-adapter-react": "^0.15", + "@solana/wallet-adapter-react-ui": "^0.9", "@solana/wallet-adapter-wallets": "^0.19.23", "@solana/web3.js": "^1.87.6", "ahooks": "^3.7.8", - "react-async-hook": "^4.0.0", - "split-graphemes": "^0.5.0" + "react-async-hook": "^4.0.0" }, "volta": { "node": "20.9.0" diff --git a/preview-build/assets/index-6fefd1d6.js b/preview-build/assets/index-3e67d3a8.js similarity index 98% rename from preview-build/assets/index-6fefd1d6.js rename to preview-build/assets/index-3e67d3a8.js index ce2b066..cfd0586 100644 --- a/preview-build/assets/index-6fefd1d6.js +++ b/preview-build/assets/index-3e67d3a8.js @@ -1 +1 @@ -import{G as I,q as R,v as q,P as U}from"./index-fa8ce1ea.js";var D=globalThis&&globalThis.__extends||function(){var s=function(i,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},s(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");s(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),W=function(s){D(i,s);function i(){return s!==null&&s.apply(this,arguments)||this}return i}(I),M=R.Buffer;function z(s){if(s.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),e=0;e>>0,p=new Uint8Array(y);v!==w;){for(var b=f[v],A=0,_=y-1;(b!==0||A>>0,p[_]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");m=A,v++}for(var g=y-m;g!==y&&p[g]===0;)g++;for(var S=l.repeat(d);g>>0,y=new Uint8Array(w);f[d];){var p=i[f.charCodeAt(d)];if(p===255)return;for(var b=0,A=w-1;(p!==0||b>>0,y[A]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");v=b,d++}for(var _=w-v;_!==w&&y[_]===0;)_++;var g=M.allocUnsafe(m+(w-_));g.fill(0,0,m);for(var S=m;_!==w;)g[S++]=y[_++];return g}function C(f){var d=h(f);if(d)return d;throw new Error("Non-base"+c+" character")}return{encode:a,decodeUnsafe:h,decode:C}}var $=z,H=$,L="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",G=H(L);const j=q(G);var T=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})};class B extends I{constructor(i,e){if(super(),this._network=e,this._publicKey=null,this._popup=null,this._handlerAdded=!1,this._nextRequestId=1,this._autoApprove=!1,this._responsePromises=new Map,this.handleMessage=t=>{var r;if(this._injectedProvider&&t.source===window||t.origin===((r=this._providerUrl)===null||r===void 0?void 0:r.origin)&&t.source===this._popup){if(t.data.method==="connected"){const n=new U(t.data.params.publicKey);(!this._publicKey||!this._publicKey.equals(n))&&(this._publicKey&&!this._publicKey.equals(n)&&this.handleDisconnect(),this._publicKey=n,this._autoApprove=!!t.data.params.autoApprove,this.emit("connect",this._publicKey))}else if(t.data.method==="disconnected")this.handleDisconnect();else if(t.data.result||t.data.error){const n=this._responsePromises.get(t.data.id);if(n){const[c,l]=n;t.data.result?c(t.data.result):l(new Error(t.data.error))}}}},this._beforeUnload=()=>{this.disconnect()},N(i))this._injectedProvider=i;else if(F(i))this._providerUrl=new URL(i),this._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:this._network}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.")}handleConnect(){var i;return this._handlerAdded||(this._handlerAdded=!0,window.addEventListener("message",this.handleMessage),window.addEventListener("beforeunload",this._beforeUnload)),this._injectedProvider?new Promise(e=>{this.sendRequest("connect",{}),e()}):(window.name="parent",this._popup=window.open((i=this._providerUrl)===null||i===void 0?void 0:i.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(e=>{this.once("connect",e)}))}handleDisconnect(){this._handlerAdded&&(this._handlerAdded=!1,window.removeEventListener("message",this.handleMessage),window.removeEventListener("beforeunload",this._beforeUnload)),this._publicKey&&(this._publicKey=null,this.emit("disconnect")),this._responsePromises.forEach(([,i],e)=>{this._responsePromises.delete(e),i(new Error("Wallet disconnected"))})}sendRequest(i,e){return T(this,void 0,void 0,function*(){if(i!=="connect"&&!this.connected)throw new Error("Wallet not connected");const t=this._nextRequestId;return++this._nextRequestId,new Promise((r,n)=>{var c,l,u,o;this._responsePromises.set(t,[r,n]),this._injectedProvider?this._injectedProvider.postMessage({jsonrpc:"2.0",id:t,method:i,params:Object.assign({network:this._network},e)}):((c=this._popup)===null||c===void 0||c.postMessage({jsonrpc:"2.0",id:t,method:i,params:e},(u=(l=this._providerUrl)===null||l===void 0?void 0:l.origin)!==null&&u!==void 0?u:""),this.autoApprove||(o=this._popup)===null||o===void 0||o.focus())})})}get publicKey(){return this._publicKey}get connected(){return this._publicKey!==null}get autoApprove(){return this._autoApprove}connect(){return T(this,void 0,void 0,function*(){this._popup&&this._popup.close(),yield this.handleConnect()})}disconnect(){return T(this,void 0,void 0,function*(){this._injectedProvider&&(yield this.sendRequest("disconnect",{})),this._popup&&this._popup.close(),this.handleDisconnect()})}sign(i,e){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");const t=yield this.sendRequest("sign",{data:i,display:e}),r=j.decode(t.signature),n=new U(t.publicKey);return{signature:r,publicKey:n}})}signTransaction(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signTransaction",{message:j.encode(i.serializeMessage())}),t=j.decode(e.signature),r=new U(e.publicKey);return i.addSignature(r,t),i})}signAllTransactions(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signAllTransactions",{messages:i.map(n=>j.encode(n.serializeMessage()))}),t=e.signatures.map(n=>j.decode(n)),r=new U(e.publicKey);return i=i.map((n,c)=>(n.addSignature(r,t[c]),n)),i})}diffieHellman(i){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return yield this.sendRequest("diffieHellman",{publicKey:i})})}}function F(s){return typeof s=="string"}function N(s){return J(s)&&"postMessage"in s&&typeof s.postMessage=="function"}function J(s){return typeof s=="object"&&s!==null}var Q=globalThis&&globalThis.__extends||function(){var s=function(i,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},s(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");s(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),O=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})},k=globalThis&&globalThis.__generator||function(s,i){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(o){return function(a){return u([o,a])}}function u(o){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,r&&(n=o[0]&2?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,r=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),e=0;e>>0,p=new Uint8Array(y);v!==w;){for(var b=f[v],A=0,_=y-1;(b!==0||A>>0,p[_]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");m=A,v++}for(var g=y-m;g!==y&&p[g]===0;)g++;for(var S=l.repeat(d);g>>0,y=new Uint8Array(w);f[d];){var p=i[f.charCodeAt(d)];if(p===255)return;for(var b=0,A=w-1;(p!==0||b>>0,y[A]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");v=b,d++}for(var _=w-v;_!==w&&y[_]===0;)_++;var g=M.allocUnsafe(m+(w-_));g.fill(0,0,m);for(var S=m;_!==w;)g[S++]=y[_++];return g}function C(f){var d=h(f);if(d)return d;throw new Error("Non-base"+c+" character")}return{encode:a,decodeUnsafe:h,decode:C}}var $=z,H=$,L="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",B=H(L);const j=q(B);var T=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})};class F extends I{constructor(i,e){if(super(),this._network=e,this._publicKey=null,this._popup=null,this._handlerAdded=!1,this._nextRequestId=1,this._autoApprove=!1,this._responsePromises=new Map,this.handleMessage=t=>{var r;if(this._injectedProvider&&t.source===window||t.origin===((r=this._providerUrl)===null||r===void 0?void 0:r.origin)&&t.source===this._popup){if(t.data.method==="connected"){const n=new U(t.data.params.publicKey);(!this._publicKey||!this._publicKey.equals(n))&&(this._publicKey&&!this._publicKey.equals(n)&&this.handleDisconnect(),this._publicKey=n,this._autoApprove=!!t.data.params.autoApprove,this.emit("connect",this._publicKey))}else if(t.data.method==="disconnected")this.handleDisconnect();else if(t.data.result||t.data.error){const n=this._responsePromises.get(t.data.id);if(n){const[c,l]=n;t.data.result?c(t.data.result):l(new Error(t.data.error))}}}},this._beforeUnload=()=>{this.disconnect()},N(i))this._injectedProvider=i;else if(G(i))this._providerUrl=new URL(i),this._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:this._network}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.")}handleConnect(){var i;return this._handlerAdded||(this._handlerAdded=!0,window.addEventListener("message",this.handleMessage),window.addEventListener("beforeunload",this._beforeUnload)),this._injectedProvider?new Promise(e=>{this.sendRequest("connect",{}),e()}):(window.name="parent",this._popup=window.open((i=this._providerUrl)===null||i===void 0?void 0:i.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(e=>{this.once("connect",e)}))}handleDisconnect(){this._handlerAdded&&(this._handlerAdded=!1,window.removeEventListener("message",this.handleMessage),window.removeEventListener("beforeunload",this._beforeUnload)),this._publicKey&&(this._publicKey=null,this.emit("disconnect")),this._responsePromises.forEach(([,i],e)=>{this._responsePromises.delete(e),i(new Error("Wallet disconnected"))})}sendRequest(i,e){return T(this,void 0,void 0,function*(){if(i!=="connect"&&!this.connected)throw new Error("Wallet not connected");const t=this._nextRequestId;return++this._nextRequestId,new Promise((r,n)=>{var c,l,u,o;this._responsePromises.set(t,[r,n]),this._injectedProvider?this._injectedProvider.postMessage({jsonrpc:"2.0",id:t,method:i,params:Object.assign({network:this._network},e)}):((c=this._popup)===null||c===void 0||c.postMessage({jsonrpc:"2.0",id:t,method:i,params:e},(u=(l=this._providerUrl)===null||l===void 0?void 0:l.origin)!==null&&u!==void 0?u:""),this.autoApprove||(o=this._popup)===null||o===void 0||o.focus())})})}get publicKey(){return this._publicKey}get connected(){return this._publicKey!==null}get autoApprove(){return this._autoApprove}connect(){return T(this,void 0,void 0,function*(){this._popup&&this._popup.close(),yield this.handleConnect()})}disconnect(){return T(this,void 0,void 0,function*(){this._injectedProvider&&(yield this.sendRequest("disconnect",{})),this._popup&&this._popup.close(),this.handleDisconnect()})}sign(i,e){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");const t=yield this.sendRequest("sign",{data:i,display:e}),r=j.decode(t.signature),n=new U(t.publicKey);return{signature:r,publicKey:n}})}signTransaction(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signTransaction",{message:j.encode(i.serializeMessage())}),t=j.decode(e.signature),r=new U(e.publicKey);return i.addSignature(r,t),i})}signAllTransactions(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signAllTransactions",{messages:i.map(n=>j.encode(n.serializeMessage()))}),t=e.signatures.map(n=>j.decode(n)),r=new U(e.publicKey);return i=i.map((n,c)=>(n.addSignature(r,t[c]),n)),i})}diffieHellman(i){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return yield this.sendRequest("diffieHellman",{publicKey:i})})}}function G(s){return typeof s=="string"}function N(s){return J(s)&&"postMessage"in s&&typeof s.postMessage=="function"}function J(s){return typeof s=="object"&&s!==null}var Q=globalThis&&globalThis.__extends||function(){var s=function(i,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},s(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");s(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),O=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})},k=globalThis&&globalThis.__generator||function(s,i){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(o){return function(a){return u([o,a])}}function u(o){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,r&&(n=o[0]&2?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,r=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]o.equals(t));s>=0&&(i.signatures[s]=e)}}var D=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};function H(i){return D(this,void 0,void 0,function*(){try{return yield i.request({method:"wallet_getSnaps"}),!0}catch{return!1}})}function oe(){return D(this,void 0,void 0,function*(){try{const i=window.ethereum;if(!i)return null;if(i.providers&&Array.isArray(i.providers)){const t=i.providers;for(const e of t)if(yield H(e))return e}if(i.detected&&Array.isArray(i.detected)){const t=i.detected;for(const e of t)if(yield H(e))return e}return(yield H(i))?i:null}catch(i){return console.error(i),null}})}const ae="solana:mainnet",ce="solana:devnet",le="solana:testnet",de="solana:localnet",$=[ae,ce,le,de];function L(i){return $.includes(i)}var E=globalThis&&globalThis.__classPrivateFieldGet||function(i,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!n:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(i):n?n.value:t.get(i)},A=globalThis&&globalThis.__classPrivateFieldSet||function(i,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,e):s?s.value=e:t.set(i,e),e},T,C,I,K,k,O;const he=$,ue=[G,J,Q];class j{get address(){return E(this,T,"f")}get publicKey(){return E(this,C,"f").slice()}get chains(){return E(this,I,"f").slice()}get features(){return E(this,K,"f").slice()}get label(){return E(this,k,"f")}get icon(){return E(this,O,"f")}constructor({address:t,publicKey:e,label:n,icon:s}){T.set(this,void 0),C.set(this,void 0),I.set(this,void 0),K.set(this,void 0),k.set(this,void 0),O.set(this,void 0),new.target===j&&Object.freeze(this),A(this,T,t,"f"),A(this,C,e,"f"),A(this,I,he,"f"),A(this,K,ue,"f"),A(this,k,n,"f"),A(this,O,s,"f")}}T=new WeakMap,C=new WeakMap,I=new WeakMap,K=new WeakMap,k=new WeakMap,O=new WeakMap;var g=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};class W extends Z{constructor(t){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var n,s;switch(e.type){case"connect":{this._collapseIframe(),!((n=e.data)===null||n===void 0)&&n.publicKey?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected());return}case"disconnect":{this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected();return}case"accountChanged":{!((s=e.data)===null||s===void 0)&&s.publicKey?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected());return}default:return}},this._handleResize=e=>{e.resizeMode==="full"?e.params.mode==="fullscreen"?this._expandIframe():e.params.mode==="hide"&&this._collapseIframe():e.resizeMode==="coordinates"&&this._resizeIframe(e.params)},this._handleMessage=e=>{var n;if(((n=e.data)===null||n===void 0?void 0:n.channel)!=="solflareIframeToWalletAdapter")return;const s=e.data.data||{};if(s.type==="event")this._handleEvent(s.event);else if(s.type==="resize")this._handleResize(s);else if(s.type==="response"&&this._messageHandlers[s.id]){const{resolve:o,reject:d}=this._messageHandlers[s.id];delete this._messageHandlers[s.id],s.error?d(s.error):o(s.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const n of e)n.parentElement&&n.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),n=Object.keys(e).map(o=>`${o}=${encodeURIComponent(e[o])}`).join("&"),s=`${W.IFRAME_URL}?${n}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=` +import{f as q,d as B,M as G,O as J,Q,P as X,J as b,V as z}from"./index-f54a1fc2.js";var R={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function s(h,a,r){this.fn=h,this.context=a,this.once=r||!1}function o(h,a,r,c,v){if(typeof r!="function")throw new TypeError("The listener must be a function");var p=new s(r,c||h,v),f=e?e+a:a;return h._events[f]?h._events[f].fn?h._events[f]=[h._events[f],p]:h._events[f].push(p):(h._events[f]=p,h._eventsCount++),h}function d(h,a){--h._eventsCount===0?h._events=new n:delete h._events[a]}function u(){this._events=new n,this._eventsCount=0}u.prototype.eventNames=function(){var a=[],r,c;if(this._eventsCount===0)return a;for(c in r=this._events)t.call(r,c)&&a.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(r)):a},u.prototype.listeners=function(a){var r=e?e+a:a,c=this._events[r];if(!c)return[];if(c.fn)return[c.fn];for(var v=0,p=c.length,f=new Array(p);vo.equals(t));s>=0&&(i.signatures[s]=e)}}var D=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};function H(i){return D(this,void 0,void 0,function*(){try{return yield i.request({method:"wallet_getSnaps"}),!0}catch{return!1}})}function oe(){return D(this,void 0,void 0,function*(){try{const i=window.ethereum;if(!i)return null;if(i.providers&&Array.isArray(i.providers)){const t=i.providers;for(const e of t)if(yield H(e))return e}if(i.detected&&Array.isArray(i.detected)){const t=i.detected;for(const e of t)if(yield H(e))return e}return(yield H(i))?i:null}catch(i){return console.error(i),null}})}const ae="solana:mainnet",ce="solana:devnet",le="solana:testnet",de="solana:localnet",$=[ae,ce,le,de];function L(i){return $.includes(i)}var E=globalThis&&globalThis.__classPrivateFieldGet||function(i,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!n:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(i):n?n.value:t.get(i)},A=globalThis&&globalThis.__classPrivateFieldSet||function(i,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,e):s?s.value=e:t.set(i,e),e},T,C,I,K,k,O;const he=$,ue=[G,J,Q];class j{get address(){return E(this,T,"f")}get publicKey(){return E(this,C,"f").slice()}get chains(){return E(this,I,"f").slice()}get features(){return E(this,K,"f").slice()}get label(){return E(this,k,"f")}get icon(){return E(this,O,"f")}constructor({address:t,publicKey:e,label:n,icon:s}){T.set(this,void 0),C.set(this,void 0),I.set(this,void 0),K.set(this,void 0),k.set(this,void 0),O.set(this,void 0),new.target===j&&Object.freeze(this),A(this,T,t,"f"),A(this,C,e,"f"),A(this,I,he,"f"),A(this,K,ue,"f"),A(this,k,n,"f"),A(this,O,s,"f")}}T=new WeakMap,C=new WeakMap,I=new WeakMap,K=new WeakMap,k=new WeakMap,O=new WeakMap;var g=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};class W extends Z{constructor(t){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var n,s;switch(e.type){case"connect":{this._collapseIframe(),!((n=e.data)===null||n===void 0)&&n.publicKey?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected());return}case"disconnect":{this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected();return}case"accountChanged":{!((s=e.data)===null||s===void 0)&&s.publicKey?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected());return}default:return}},this._handleResize=e=>{e.resizeMode==="full"?e.params.mode==="fullscreen"?this._expandIframe():e.params.mode==="hide"&&this._collapseIframe():e.resizeMode==="coordinates"&&this._resizeIframe(e.params)},this._handleMessage=e=>{var n;if(((n=e.data)===null||n===void 0?void 0:n.channel)!=="solflareIframeToWalletAdapter")return;const s=e.data.data||{};if(s.type==="event")this._handleEvent(s.event);else if(s.type==="resize")this._handleResize(s);else if(s.type==="response"&&this._messageHandlers[s.id]){const{resolve:o,reject:d}=this._messageHandlers[s.id];delete this._messageHandlers[s.id],s.error?d(s.error):o(s.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const n of e)n.parentElement&&n.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),n=Object.keys(e).map(o=>`${o}=${encodeURIComponent(e[o])}`).join("&"),s=`${W.IFRAME_URL}?${n}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=` `,document.body.appendChild(this._element),this._iframe=this._element.querySelector("iframe"),window.addEventListener("message",this._handleMessage,!1)},this._collapseIframe=()=>{this._iframe&&(this._iframe.style.top="",this._iframe.style.right="",this._iframe.style.height="2px",this._iframe.style.width="2px")},this._expandIframe=()=>{this._iframe&&(this._iframe.style.top="0px",this._iframe.style.bottom="0px",this._iframe.style.left="0px",this._iframe.style.right="0px",this._iframe.style.width="100%",this._iframe.style.height="100%")},this._resizeIframe=e=>{this._iframe&&(this._iframe.style.top=isFinite(e.top)?`${e.top}px`:"",this._iframe.style.bottom=isFinite(e.bottom)?`${e.bottom}px`:"",this._iframe.style.left=isFinite(e.left)?`${e.left}px`:"",this._iframe.style.right=isFinite(e.right)?`${e.right}px`:"",this._iframe.style.width=isFinite(e.width)?`${e.width}px`:e.width,this._iframe.style.height=isFinite(e.height)?`${e.height}px`:e.height)},this._sendIframeMessage=e=>{if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");return new Promise((n,s)=>{var o,d;const u=se();this._messageHandlers[u]={resolve:n,reject:s},(d=(o=this._iframe)===null||o===void 0?void 0:o.contentWindow)===null||d===void 0||d.postMessage({channel:"solflareWalletAdapterToIframe",data:Object.assign({id:u},e)},"*")})},this._connected=()=>{this._isConnected=!0,this.emit("connect",this.publicKey),this._standardConnected()},this._disconnected=()=>{this._publicKey=null,this._isConnected=!1,window.removeEventListener("message",this._handleMessage,!1),this._removeElement(),this.emit("disconnect"),this._standardDisconnected()},this._standardConnected=()=>{if(!this.publicKey)return;const e=this.publicKey.toString();(!this._account||this._account.address!==e)&&(this._account=new j({address:e,publicKey:this.publicKey.toBytes()}),this.emit("standard_change",{accounts:this.standardAccounts}))},this._standardDisconnected=()=>{this._account&&(this._account=null,this.emit("standard_change",{accounts:this.standardAccounts}))},t!=null&&t.network&&(this._network=t==null?void 0:t.network),window.SolflareMetaMaskParams&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),window.SolflareMetaMaskParams)),t!=null&&t.params&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),t==null?void 0:t.params))}get publicKey(){return this._publicKey?new X(this._publicKey):null}get standardAccount(){return this._account}get standardAccounts(){return this._account?[this._account]:[]}get isConnected(){return this._isConnected}get connected(){return this.isConnected}get autoApprove(){return!1}connect(){return g(this,void 0,void 0,function*(){this.connected||(this._injectElement(),yield new Promise((t,e)=>{this._connectHandler={resolve:t,reject:e}}))})}disconnect(){return g(this,void 0,void 0,function*(){yield this._sendIframeMessage({method:"disconnect"}),this._disconnected()})}signTransaction(t){var e;return g(this,void 0,void 0,function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=F(t),{signature:s}=yield this._sendIframeMessage({method:"signTransaction",params:{message:b.encode(n)}});return U(t,this.publicKey,b.decode(s)),t}catch(n){throw new Error(((e=n==null?void 0:n.toString)===null||e===void 0?void 0:e.call(n))||"Failed to sign transaction")}})}signAllTransactions(t){var e;return g(this,void 0,void 0,function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=t.map(o=>F(o)),{signatures:s}=yield this._sendIframeMessage({method:"signAllTransactions",params:{messages:n.map(o=>b.encode(o))}});for(let o=0;o1)for(const n of t)e.push(...yield this.standardSignAndSendTransaction(n));return e})}standardSignTransaction(...t){return g(this,void 0,void 0,function*(){if(!this.connected)throw new Error("not connected");const e=[];if(t.length===1){const{transaction:n,account:s,chain:o}=t[0];if(s!==this._account)throw new Error("invalid account");if(o&&!L(o))throw new Error("invalid chain");const d=yield this.signTransaction(z.deserialize(n));e.push({signedTransaction:d.serialize()})}else if(t.length>1){let n;for(const d of t){if(d.account!==this._account)throw new Error("invalid account");if(d.chain){if(!L(d.chain))throw new Error("invalid chain");if(n){if(d.chain!==n)throw new Error("conflicting chain")}else n=d.chain}}const s=t.map(({transaction:d})=>z.deserialize(d)),o=yield this.signAllTransactions(s);e.push(...o.map(d=>({signedTransaction:d.serialize()})))}return e})}standardSignMessage(...t){return g(this,void 0,void 0,function*(){if(!this.connected)throw new Error("not connected");const e=[];if(t.length===1){const{message:n,account:s}=t[0];if(s!==this._account)throw new Error("invalid account");const o=yield this.signMessage(n);e.push({signedMessage:n,signature:o})}else if(t.length>1)for(const n of t)e.push(...yield this.standardSignMessage(n));return e})}}W.IFRAME_URL="https://widget.solflare.com/";export{j as StandardSolflareMetaMaskWalletAccount,W as default}; diff --git a/preview-build/assets/index-28169dc7.js b/preview-build/assets/index-eb9ef66c.js similarity index 95% rename from preview-build/assets/index-28169dc7.js rename to preview-build/assets/index-eb9ef66c.js index 50e87dd..a21c1b1 100644 --- a/preview-build/assets/index-28169dc7.js +++ b/preview-build/assets/index-eb9ef66c.js @@ -1,3 +1,3 @@ -import{v as V,P,J as _,h as C}from"./index-fa8ce1ea.js";var D={exports:{}};(function(a){var s=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function t(u,i,l){this.fn=u,this.context=i,this.once=l||!1}function e(u,i,l,f,y){if(typeof l!="function")throw new TypeError("The listener must be a function");var g=new t(l,f||u,y),h=r?r+i:i;return u._events[h]?u._events[h].fn?u._events[h]=[u._events[h],g]:u._events[h].push(g):(u._events[h]=g,u._eventsCount++),u}function o(u,i){--u._eventsCount===0?u._events=new n:delete u._events[i]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var i=[],l,f;if(this._eventsCount===0)return i;for(f in l=this._events)s.call(l,f)&&i.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(l)):i},c.prototype.listeners=function(i){var l=r?r+i:i,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var y=0,g=f.length,h=new Array(g);y0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0)&&!(t=n.next()).done;)e.push(t.value)}catch(c){o={error:c}}finally{try{t&&!t.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return e},J=function(a){B(s,a);function s(r,n){var t=a.call(this)||this;if(t._handleMessage=function(e){if(t._injectedProvider&&e.source===window||e.origin===t._providerUrl.origin&&e.source===t._popup){if(e.data.method==="connected"){var o=new P(e.data.params.publicKey);(!t._publicKey||!t._publicKey.equals(o))&&(t._publicKey&&!t._publicKey.equals(o)&&t._handleDisconnect(),t._publicKey=o,t._autoApprove=!!e.data.params.autoApprove,t.emit("connect",t._publicKey))}else if(e.data.method==="disconnected")t._handleDisconnect();else if((e.data.result||e.data.error)&&t._responsePromises.has(e.data.id)){var c=H(t._responsePromises.get(e.data.id),2),u=c[0],i=c[1];e.data.result?u(e.data.result):i(new Error(e.data.error))}}},t._handleConnect=function(){return t._handlerAdded||(t._handlerAdded=!0,window.addEventListener("message",t._handleMessage),window.addEventListener("beforeunload",t.disconnect)),t._injectedProvider?new Promise(function(e){t._sendRequest("connect",{}),e()}):(window.name="parent",t._popup=window.open(t._providerUrl.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(function(e){t.once("connect",e)}))},t._handleDisconnect=function(){t._handlerAdded&&(t._handlerAdded=!1,window.removeEventListener("message",t._handleMessage),window.removeEventListener("beforeunload",t.disconnect)),t._publicKey&&(t._publicKey=null,t.emit("disconnect")),t._responsePromises.forEach(function(e,o){var c=H(e,2);c[0];var u=c[1];t._responsePromises.delete(o),u("Wallet disconnected")})},t._sendRequest=function(e,o){return E(t,void 0,void 0,function(){var c,u=this;return I(this,function(i){if(e!=="connect"&&!this.connected)throw new Error("Wallet not connected");return c=this._nextRequestId,++this._nextRequestId,[2,new Promise(function(l,f){u._responsePromises.set(c,[l,f]),u._injectedProvider?u._injectedProvider.postMessage({jsonrpc:"2.0",id:c,method:e,params:W({network:u._network},o)}):(u._popup.postMessage({jsonrpc:"2.0",id:c,method:e,params:o},u._providerUrl.origin),u.autoApprove||u._popup.focus())})]})})},t.connect=function(){return t._popup&&t._popup.close(),t._handleConnect()},t.disconnect=function(){return E(t,void 0,void 0,function(){return I(this,function(e){switch(e.label){case 0:return this._injectedProvider?[4,this._sendRequest("disconnect",{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._popup&&this._popup.close(),this._handleDisconnect(),[2]}})})},t.sign=function(e,o){return E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:if(!(e instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return[4,this._sendRequest("sign",{data:e,display:o})];case 1:return c=l.sent(),u=_.decode(c.signature),i=new P(c.publicKey),[2,{signature:u,publicKey:i}]}})})},t.signTransaction=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signTransaction",{message:_.encode(e.serializeMessage())})];case 1:return o=i.sent(),c=_.decode(o.signature),u=new P(o.publicKey),e.addSignature(u,c),[2,e]}})})},t.signAllTransactions=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signAllTransactions",{messages:e.map(function(l){return _.encode(l.serializeMessage())})})];case 1:return o=i.sent(),c=o.signatures.map(function(l){return _.decode(l)}),u=new P(o.publicKey),e=e.map(function(l,f){return l.addSignature(u,c[f]),l}),[2,e]}})})},t.signAndSendTransaction=function(e,o){return o===void 0&&(o={}),E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:return[4,this._sendRequest("signAndSendTransaction",W({transaction:_.encode(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))},o))];case 1:return c=l.sent(),u=c.publicKey,i=c.signature,[2,{publicKey:new P(u),signature:i}]}})})},X(r))t._injectedProvider=r;else if(Q(r))t._providerUrl=new URL(r),t._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:n}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.");return t._network=n,t._publicKey=null,t._autoApprove=!1,t._popup=null,t._handlerAdded=!1,t._nextRequestId=1,t._responsePromises=new Map,t}return Object.defineProperty(s.prototype,"publicKey",{get:function(){return this._publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"connected",{get:function(){return this._publicKey!==null},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"autoApprove",{get:function(){return this._autoApprove},enumerable:!1,configurable:!0}),s}(U);function Q(a){return typeof a=="string"}function X(a){return Y(a)&&Z(a.postMessage)}function Y(a){return typeof a=="object"&&a!==null}function Z(a){return typeof a=="function"}var ee=globalThis&&globalThis.__extends||function(){var a=function(s,r){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},a(s,r)};return function(s,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");a(s,r);function n(){this.constructor=s}s.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=globalThis&&globalThis.__awaiter||function(a,s,r,n){function t(e){return e instanceof r?e:new r(function(o){o(e)})}return new(r||(r=Promise))(function(e,o){function c(l){try{i(n.next(l))}catch(f){o(f)}}function u(l){try{i(n.throw(l))}catch(f){o(f)}}function i(l){l.done?e(l.value):t(l.value).then(c,u)}i((n=n.apply(a,s||[])).next())})},S=globalThis&&globalThis.__generator||function(a,s){var r={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},n,t,e,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(i){return function(l){return u([i,l])}}function u(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(n=1,t&&(e=i[0]&2?t.return:i[0]?t.throw||((e=t.return)&&e.call(t),0):t.next)&&!(e=e.call(t,i[1])).done)return e;switch(t=0,e&&(i=[i[0]&2,e.value]),i[0]){case 0:case 1:e=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,t=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(e=r.trys,!(e=e.length>0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]=a.length&&(a=void 0),{value:a&&a[n++],done:!a}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")},de=function(a){le(s,a);function s(r){var n=a.call(this)||this;return n._network="mainnet-beta",n._provider=null,n._iframeParams={},n._adapterInstance=null,n._element=null,n._iframe=null,n._connectHandler=null,n._flutterHandlerInterval=null,n._handleEvent=function(t){var e,o,c,u;switch(t.type){case"connect_native_web":{n._collapseIframe(),n._adapterInstance=new ne(n._iframe,n._network,((e=t.data)===null||e===void 0?void 0:e.provider)||n._provider||"https://solflare.com/provider"),n._adapterInstance.on("connect",n._webConnected),n._adapterInstance.on("disconnect",n._webDisconnected),n._adapterInstance.connect(),n._setPreferredAdapter("native_web");return}case"connect":{n._collapseIframe(),n._adapterInstance=new z(n._iframe,((o=t.data)===null||o===void 0?void 0:o.publicKey)||""),n._adapterInstance.connect(),n._setPreferredAdapter((c=t.data)===null||c===void 0?void 0:c.adapter),n._connectHandler&&(n._connectHandler.resolve(),n._connectHandler=null),n.emit("connect",n.publicKey);return}case"disconnect":{n._connectHandler&&(n._connectHandler.reject(),n._connectHandler=null),n._disconnected(),n.emit("disconnect");return}case"accountChanged":{!((u=t.data)===null||u===void 0)&&u.publicKey?(n._adapterInstance=new z(n._iframe,t.data.publicKey),n._adapterInstance.connect(),n.emit("accountChanged",n.publicKey)):n.emit("accountChanged",void 0);return}case"collapse":{n._collapseIframe();return}default:return}},n._handleResize=function(t){t.resizeMode==="full"?t.params.mode==="fullscreen"?n._expandIframe():t.params.mode==="hide"&&n._collapseIframe():t.resizeMode==="coordinates"&&n._iframe&&(n._iframe.style.top=isFinite(t.params.top)?"".concat(t.params.top,"px"):"",n._iframe.style.bottom=isFinite(t.params.bottom)?"".concat(t.params.bottom,"px"):"",n._iframe.style.left=isFinite(t.params.left)?"".concat(t.params.left,"px"):"",n._iframe.style.right=isFinite(t.params.right)?"".concat(t.params.right,"px"):"",n._iframe.style.width=isFinite(t.params.width)?"".concat(t.params.width,"px"):t.params.width,n._iframe.style.height=isFinite(t.params.height)?"".concat(t.params.height,"px"):t.params.height)},n._handleMessage=function(t){var e;if(((e=t.data)===null||e===void 0?void 0:e.channel)==="solflareIframeToWalletAdapter"){var o=t.data.data||{};o.type==="event"?n._handleEvent(o.event):o.type==="resize"?n._handleResize(o):o.type==="response"&&n._adapterInstance&&n._adapterInstance.handleMessage(o)}},n._removeElement=function(){n._flutterHandlerInterval!==null&&(clearInterval(n._flutterHandlerInterval),n._flutterHandlerInterval=null),n._element&&(n._element.remove(),n._element=null)},n._removeDanglingElements=function(){var t,e,o=document.getElementsByClassName("solflare-wallet-adapter-iframe");try{for(var c=ue(o),u=c.next();!u.done;u=c.next()){var i=u.value;i.parentElement&&i.remove()}}catch(l){t={error:l}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}},n._injectElement=function(){n._removeElement(),n._removeDanglingElements();var t=k(k({},n._iframeParams),{cluster:n._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||"",version:1,sdkVersion:ce}),e=n._getPreferredAdapter();e&&(t.adapter=e),n._provider&&(t.provider=n._provider);var o=Object.keys(t).map(function(u){return"".concat(u,"=").concat(encodeURIComponent(t[u]))}).join("&"),c="".concat(s.IFRAME_URL,"?").concat(o);n._element=document.createElement("div"),n._element.className="solflare-wallet-adapter-iframe",n._element.innerHTML=` +import{f as V,P,J as v,d as C}from"./index-f54a1fc2.js";var D={exports:{}};(function(a){var s=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function t(u,i,l){this.fn=u,this.context=i,this.once=l||!1}function e(u,i,l,f,y){if(typeof l!="function")throw new TypeError("The listener must be a function");var g=new t(l,f||u,y),h=r?r+i:i;return u._events[h]?u._events[h].fn?u._events[h]=[u._events[h],g]:u._events[h].push(g):(u._events[h]=g,u._eventsCount++),u}function o(u,i){--u._eventsCount===0?u._events=new n:delete u._events[i]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var i=[],l,f;if(this._eventsCount===0)return i;for(f in l=this._events)s.call(l,f)&&i.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(l)):i},c.prototype.listeners=function(i){var l=r?r+i:i,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var y=0,g=f.length,h=new Array(g);y0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0)&&!(t=n.next()).done;)e.push(t.value)}catch(c){o={error:c}}finally{try{t&&!t.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return e},J=function(a){B(s,a);function s(r,n){var t=a.call(this)||this;if(t._handleMessage=function(e){if(t._injectedProvider&&e.source===window||e.origin===t._providerUrl.origin&&e.source===t._popup){if(e.data.method==="connected"){var o=new P(e.data.params.publicKey);(!t._publicKey||!t._publicKey.equals(o))&&(t._publicKey&&!t._publicKey.equals(o)&&t._handleDisconnect(),t._publicKey=o,t._autoApprove=!!e.data.params.autoApprove,t.emit("connect",t._publicKey))}else if(e.data.method==="disconnected")t._handleDisconnect();else if((e.data.result||e.data.error)&&t._responsePromises.has(e.data.id)){var c=H(t._responsePromises.get(e.data.id),2),u=c[0],i=c[1];e.data.result?u(e.data.result):i(new Error(e.data.error))}}},t._handleConnect=function(){return t._handlerAdded||(t._handlerAdded=!0,window.addEventListener("message",t._handleMessage),window.addEventListener("beforeunload",t.disconnect)),t._injectedProvider?new Promise(function(e){t._sendRequest("connect",{}),e()}):(window.name="parent",t._popup=window.open(t._providerUrl.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(function(e){t.once("connect",e)}))},t._handleDisconnect=function(){t._handlerAdded&&(t._handlerAdded=!1,window.removeEventListener("message",t._handleMessage),window.removeEventListener("beforeunload",t.disconnect)),t._publicKey&&(t._publicKey=null,t.emit("disconnect")),t._responsePromises.forEach(function(e,o){var c=H(e,2);c[0];var u=c[1];t._responsePromises.delete(o),u("Wallet disconnected")})},t._sendRequest=function(e,o){return E(t,void 0,void 0,function(){var c,u=this;return I(this,function(i){if(e!=="connect"&&!this.connected)throw new Error("Wallet not connected");return c=this._nextRequestId,++this._nextRequestId,[2,new Promise(function(l,f){u._responsePromises.set(c,[l,f]),u._injectedProvider?u._injectedProvider.postMessage({jsonrpc:"2.0",id:c,method:e,params:W({network:u._network},o)}):(u._popup.postMessage({jsonrpc:"2.0",id:c,method:e,params:o},u._providerUrl.origin),u.autoApprove||u._popup.focus())})]})})},t.connect=function(){return t._popup&&t._popup.close(),t._handleConnect()},t.disconnect=function(){return E(t,void 0,void 0,function(){return I(this,function(e){switch(e.label){case 0:return this._injectedProvider?[4,this._sendRequest("disconnect",{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._popup&&this._popup.close(),this._handleDisconnect(),[2]}})})},t.sign=function(e,o){return E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:if(!(e instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return[4,this._sendRequest("sign",{data:e,display:o})];case 1:return c=l.sent(),u=v.decode(c.signature),i=new P(c.publicKey),[2,{signature:u,publicKey:i}]}})})},t.signTransaction=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signTransaction",{message:v.encode(e.serializeMessage())})];case 1:return o=i.sent(),c=v.decode(o.signature),u=new P(o.publicKey),e.addSignature(u,c),[2,e]}})})},t.signAllTransactions=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signAllTransactions",{messages:e.map(function(l){return v.encode(l.serializeMessage())})})];case 1:return o=i.sent(),c=o.signatures.map(function(l){return v.decode(l)}),u=new P(o.publicKey),e=e.map(function(l,f){return l.addSignature(u,c[f]),l}),[2,e]}})})},t.signAndSendTransaction=function(e,o){return o===void 0&&(o={}),E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:return[4,this._sendRequest("signAndSendTransaction",W({transaction:v.encode(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))},o))];case 1:return c=l.sent(),u=c.publicKey,i=c.signature,[2,{publicKey:new P(u),signature:i}]}})})},X(r))t._injectedProvider=r;else if(Q(r))t._providerUrl=new URL(r),t._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:n}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.");return t._network=n,t._publicKey=null,t._autoApprove=!1,t._popup=null,t._handlerAdded=!1,t._nextRequestId=1,t._responsePromises=new Map,t}return Object.defineProperty(s.prototype,"publicKey",{get:function(){return this._publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"connected",{get:function(){return this._publicKey!==null},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"autoApprove",{get:function(){return this._autoApprove},enumerable:!1,configurable:!0}),s}(U);function Q(a){return typeof a=="string"}function X(a){return Y(a)&&Z(a.postMessage)}function Y(a){return typeof a=="object"&&a!==null}function Z(a){return typeof a=="function"}var ee=globalThis&&globalThis.__extends||function(){var a=function(s,r){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},a(s,r)};return function(s,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");a(s,r);function n(){this.constructor=s}s.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=globalThis&&globalThis.__awaiter||function(a,s,r,n){function t(e){return e instanceof r?e:new r(function(o){o(e)})}return new(r||(r=Promise))(function(e,o){function c(l){try{i(n.next(l))}catch(f){o(f)}}function u(l){try{i(n.throw(l))}catch(f){o(f)}}function i(l){l.done?e(l.value):t(l.value).then(c,u)}i((n=n.apply(a,s||[])).next())})},S=globalThis&&globalThis.__generator||function(a,s){var r={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},n,t,e,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(i){return function(l){return u([i,l])}}function u(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(n=1,t&&(e=i[0]&2?t.return:i[0]?t.throw||((e=t.return)&&e.call(t),0):t.next)&&!(e=e.call(t,i[1])).done)return e;switch(t=0,e&&(i=[i[0]&2,e.value]),i[0]){case 0:case 1:e=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,t=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(e=r.trys,!(e=e.length>0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]=a.length&&(a=void 0),{value:a&&a[n++],done:!a}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")},de=function(a){le(s,a);function s(r){var n=a.call(this)||this;return n._network="mainnet-beta",n._provider=null,n._iframeParams={},n._adapterInstance=null,n._element=null,n._iframe=null,n._connectHandler=null,n._flutterHandlerInterval=null,n._handleEvent=function(t){var e,o,c,u;switch(t.type){case"connect_native_web":{n._collapseIframe(),n._adapterInstance=new ne(n._iframe,n._network,((e=t.data)===null||e===void 0?void 0:e.provider)||n._provider||"https://solflare.com/provider"),n._adapterInstance.on("connect",n._webConnected),n._adapterInstance.on("disconnect",n._webDisconnected),n._adapterInstance.connect(),n._setPreferredAdapter("native_web");return}case"connect":{n._collapseIframe(),n._adapterInstance=new z(n._iframe,((o=t.data)===null||o===void 0?void 0:o.publicKey)||""),n._adapterInstance.connect(),n._setPreferredAdapter((c=t.data)===null||c===void 0?void 0:c.adapter),n._connectHandler&&(n._connectHandler.resolve(),n._connectHandler=null),n.emit("connect",n.publicKey);return}case"disconnect":{n._connectHandler&&(n._connectHandler.reject(),n._connectHandler=null),n._disconnected(),n.emit("disconnect");return}case"accountChanged":{!((u=t.data)===null||u===void 0)&&u.publicKey?(n._adapterInstance=new z(n._iframe,t.data.publicKey),n._adapterInstance.connect(),n.emit("accountChanged",n.publicKey)):n.emit("accountChanged",void 0);return}case"collapse":{n._collapseIframe();return}default:return}},n._handleResize=function(t){t.resizeMode==="full"?t.params.mode==="fullscreen"?n._expandIframe():t.params.mode==="hide"&&n._collapseIframe():t.resizeMode==="coordinates"&&n._iframe&&(n._iframe.style.top=isFinite(t.params.top)?"".concat(t.params.top,"px"):"",n._iframe.style.bottom=isFinite(t.params.bottom)?"".concat(t.params.bottom,"px"):"",n._iframe.style.left=isFinite(t.params.left)?"".concat(t.params.left,"px"):"",n._iframe.style.right=isFinite(t.params.right)?"".concat(t.params.right,"px"):"",n._iframe.style.width=isFinite(t.params.width)?"".concat(t.params.width,"px"):t.params.width,n._iframe.style.height=isFinite(t.params.height)?"".concat(t.params.height,"px"):t.params.height)},n._handleMessage=function(t){var e;if(((e=t.data)===null||e===void 0?void 0:e.channel)==="solflareIframeToWalletAdapter"){var o=t.data.data||{};o.type==="event"?n._handleEvent(o.event):o.type==="resize"?n._handleResize(o):o.type==="response"&&n._adapterInstance&&n._adapterInstance.handleMessage(o)}},n._removeElement=function(){n._flutterHandlerInterval!==null&&(clearInterval(n._flutterHandlerInterval),n._flutterHandlerInterval=null),n._element&&(n._element.remove(),n._element=null)},n._removeDanglingElements=function(){var t,e,o=document.getElementsByClassName("solflare-wallet-adapter-iframe");try{for(var c=ue(o),u=c.next();!u.done;u=c.next()){var i=u.value;i.parentElement&&i.remove()}}catch(l){t={error:l}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}},n._injectElement=function(){n._removeElement(),n._removeDanglingElements();var t=k(k({},n._iframeParams),{cluster:n._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||"",version:1,sdkVersion:ce}),e=n._getPreferredAdapter();e&&(t.adapter=e),n._provider&&(t.provider=n._provider);var o=Object.keys(t).map(function(u){return"".concat(u,"=").concat(encodeURIComponent(t[u]))}).join("&"),c="".concat(s.IFRAME_URL,"?").concat(o);n._element=document.createElement("div"),n._element.className="solflare-wallet-adapter-iframe",n._element.innerHTML=` `),document.body.appendChild(n._element),n._iframe=n._element.querySelector("iframe"),window.fromFlutter=n._handleMobileMessage,n._flutterHandlerInterval=setInterval(function(){window.fromFlutter=n._handleMobileMessage},100),window.addEventListener("message",n._handleMessage,!1)},n._collapseIframe=function(){n._iframe&&(n._iframe.style.top="",n._iframe.style.right="",n._iframe.style.height="2px",n._iframe.style.width="2px")},n._expandIframe=function(){n._iframe&&(n._iframe.style.top="0px",n._iframe.style.bottom="0px",n._iframe.style.left="0px",n._iframe.style.right="0px",n._iframe.style.width="100%",n._iframe.style.height="100%")},n._getPreferredAdapter=function(){return localStorage&&localStorage.getItem("solflarePreferredWalletAdapter")||null},n._setPreferredAdapter=function(t){localStorage&&t&&localStorage.setItem("solflarePreferredWalletAdapter",t)},n._clearPreferredAdapter=function(){localStorage&&localStorage.removeItem("solflarePreferredWalletAdapter")},n._webConnected=function(){n._connectHandler&&(n._connectHandler.resolve(),n._connectHandler=null),n.emit("connect",n.publicKey)},n._webDisconnected=function(){n._connectHandler&&(n._connectHandler.reject(),n._connectHandler=null),n._disconnected(),n.emit("disconnect")},n._disconnected=function(){window.removeEventListener("message",n._handleMessage,!1),n._removeElement(),n._clearPreferredAdapter(),n._adapterInstance=null},n._handleMobileMessage=function(t){var e,o;(o=(e=n._iframe)===null||e===void 0?void 0:e.contentWindow)===null||o===void 0||o.postMessage({channel:"solflareMobileToIframe",data:t},"*")},r!=null&&r.network&&(n._network=r==null?void 0:r.network),r!=null&&r.provider&&(n._provider=r==null?void 0:r.provider),r!=null&&r.params&&(n._iframeParams=k({},r==null?void 0:r.params)),n}return Object.defineProperty(s.prototype,"publicKey",{get:function(){var r;return((r=this._adapterInstance)===null||r===void 0?void 0:r.publicKey)||null},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isConnected",{get:function(){var r;return!!(!((r=this._adapterInstance)===null||r===void 0)&&r.connected)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"connected",{get:function(){return this.isConnected},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"autoApprove",{get:function(){return!1},enumerable:!1,configurable:!0}),s.prototype.connect=function(){return b(this,void 0,void 0,function(){var r=this;return x(this,function(n){switch(n.label){case 0:return this.connected?[2]:(this._injectElement(),[4,new Promise(function(t,e){r._connectHandler={resolve:t,reject:e}})]);case 1:return n.sent(),[2]}})})},s.prototype.disconnect=function(){return b(this,void 0,void 0,function(){return x(this,function(r){switch(r.label){case 0:return this._adapterInstance?[4,this._adapterInstance.disconnect()]:[2];case 1:return r.sent(),this._disconnected(),this.emit("disconnect"),[2]}})})},s.prototype.signTransaction=function(r){return b(this,void 0,void 0,function(){var n,t,e,o,c=this;return x(this,function(u){switch(u.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return n=K(r)?r.serializeMessage():r.message.serialize(),[4,this._adapterInstance.signTransaction(n)];case 1:return t=u.sent(),K(r)?r.addSignature(this.publicKey,C.Buffer.from(t)):(e=r.message.staticAccountKeys.slice(0,r.message.header.numRequiredSignatures),o=e.findIndex(function(i){return i.equals(c.publicKey)}),o>=0&&(r.signatures[o]=t)),[2,r]}})})},s.prototype.signAllTransactions=function(r){return b(this,void 0,void 0,function(){var n,t,e,o,c,u,i=this;return x(this,function(l){switch(l.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return n=r.map(function(f){return K(f)?f.serializeMessage():f.message.serialize()}),[4,this._adapterInstance.signAllTransactions(n)];case 1:for(t=l.sent(),e=0;e=0&&(o.signatures[u]=t[e]));return[2,r]}})})},s.prototype.signAndSendTransaction=function(r,n){return b(this,void 0,void 0,function(){var t;return x(this,function(e){switch(e.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return t=K(r)?r.serialize({verifySignatures:!1,requireAllSignatures:!1}):r.serialize(),[4,this._adapterInstance.signAndSendTransaction(t,n)];case 1:return[2,e.sent()]}})})},s.prototype.signMessage=function(r,n){return n===void 0&&(n="utf8"),b(this,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return[4,this._adapterInstance.signMessage(r,n)];case 1:return[2,t.sent()]}})})},s.prototype.sign=function(r,n){return n===void 0&&(n="utf8"),b(this,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:return[4,this.signMessage(r,n)];case 1:return[2,t.sent()]}})})},s.prototype.detectWallet=function(r){var n;return r===void 0&&(r=10),b(this,void 0,void 0,function(){return x(this,function(t){return window.SolflareApp||!((n=window.solflare)===null||n===void 0)&&n.isSolflare?[2,!0]:[2,new Promise(function(e){var o,c;o=setInterval(function(){var u;(window.SolflareApp||!((u=window.solflare)===null||u===void 0)&&u.isSolflare)&&(clearInterval(o),clearTimeout(c),e(!0))},500),c=setTimeout(function(){clearInterval(o),e(!1)},r*1e3)})]})})},s.IFRAME_URL="https://connect.solflare.com/",s}(U);export{de as default}; diff --git a/preview-build/assets/index-fa8ce1ea.js b/preview-build/assets/index-f54a1fc2.js similarity index 90% rename from preview-build/assets/index-fa8ce1ea.js rename to preview-build/assets/index-f54a1fc2.js index e0d5d7b..9cf58bc 100644 --- a/preview-build/assets/index-fa8ce1ea.js +++ b/preview-build/assets/index-f54a1fc2.js @@ -47,4 +47,4 @@ Error generating stack: `+o.message+` `,n)}try{window.addEventListener("wallet-standard:app-ready",({detail:n})=>e(n))}catch(n){console.error(`wallet-standard:app-ready event listener could not be added `,n)}}class RT extends Event{constructor(e){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),Al.set(this,void 0),jT(this,Al,e,"f")}get detail(){return UT(this,Al,"f")}get type(){return"wallet-standard:register-wallet"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Al=new WeakMap;globalThis&&globalThis.__classPrivateFieldSet;globalThis&&globalThis.__classPrivateFieldGet;function CT(t,e){if(t===e)return!0;const n=t.length;if(n!==e.length)return!1;for(let r=0;r=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(M);D!==I;){for(var j=v[D],C=0,U=M-1;(j!==0||C>>0,w[U]=j%s>>>0,j=j/s>>>0;if(j!==0)throw new Error("Non-zero carry");k=C,D++}for(var O=M-k;O!==M&&w[O]===0;)O++;for(var B=a.repeat(A);O>>0,M=new Uint8Array(I);v[A];){var w=e[v.charCodeAt(A)];if(w===255)return;for(var j=0,C=I-1;(w!==0||j>>0,M[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=j,A++}for(var U=I-D;U!==I&&M[U]===0;)U++;var O=ul.allocUnsafe(k+(I-U));O.fill(0,0,k);for(var B=k;U!==I;)O[B++]=M[U++];return O}function x(v){var A=y(v);if(A)return A;throw new Error("Non-base"+s+" character")}return{encode:g,decodeUnsafe:y,decode:x}}var BT=OT,FT=BT,WT="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",VT=FT(WT);const PT=Or(VT);var Ft=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},pe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},on,An,oo,so,Hi,Ks,hc,Ce,pc,Zf,Dl,Yf,sa,Gf,oy,sy,ay,ly;class QT extends SM{constructor({wallet:e}){super(),on.add(this),An.set(this,void 0),oo.set(this,void 0),so.set(this,void 0),Hi.set(this,void 0),Ks.set(this,void 0),hc.set(this,void 0),Ce.set(this,void 0),pc.set(this,typeof window>"u"||typeof document>"u"?$.Unsupported:$.Installed),Gf.set(this,n=>{if("accounts"in n){const r=pe(this,Ce,"f").accounts[0];pe(this,An,"f")&&!pe(this,Hi,"f")&&r!==pe(this,An,"f")&&(r?pe(this,on,"m",Dl).call(this,r):(this.emit("error",new Vr),pe(this,on,"m",Yf).call(this)))}"features"in n&&pe(this,on,"m",sa).call(this)}),Ft(this,Ce,e,"f"),Ft(this,An,null,"f"),Ft(this,oo,null,"f"),Ft(this,so,!1,"f"),Ft(this,Hi,!1,"f"),Ft(this,Ks,pe(this,Ce,"f").features[W0].on("change",pe(this,Gf,"f")),"f"),pe(this,on,"m",sa).call(this)}get name(){return pe(this,Ce,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return pe(this,Ce,"f").icon}get readyState(){return pe(this,pc,"f")}get publicKey(){return pe(this,oo,"f")}get connecting(){return pe(this,so,"f")}get supportedTransactionVersions(){return pe(this,hc,"f")}get wallet(){return pe(this,Ce,"f")}get standard(){return!0}destroy(){Ft(this,An,null,"f"),Ft(this,oo,null,"f"),Ft(this,so,!1,"f"),Ft(this,Hi,!1,"f");const e=pe(this,Ks,"f");e&&(Ft(this,Ks,null,"f"),e())}async autoConnect(){return pe(this,on,"m",Zf).call(this,{silent:!0})}async connect(){return pe(this,on,"m",Zf).call(this)}async disconnect(){if(Wf in pe(this,Ce,"f").features)try{Ft(this,Hi,!0,"f"),await pe(this,Ce,"f").features[Wf].disconnect()}catch(e){this.emit("error",new Pr(e==null?void 0:e.message,e))}finally{Ft(this,Hi,!1,"f")}pe(this,on,"m",Yf).call(this)}async sendTransaction(e,n,r={}){try{const i=pe(this,An,"f");if(!i)throw new me;let o;if(qr in pe(this,Ce,"f").features)if(i.features.includes(qr))o=qr;else if(Kt in pe(this,Ce,"f").features&&i.features.includes(Kt))o=Kt;else throw new qt;else if(Kt in pe(this,Ce,"f").features){if(!i.features.includes(Kt))throw new qt;o=Kt}else throw new Ei;const s=zT(n.rpcEndpoint);if(!i.chains.includes(s))throw new mr;try{const{signers:a,...l}=r;let d;if(xi(e)?(a!=null&&a.length&&e.sign(a),d=e.serialize()):(e=await this.prepareTransaction(e,n,l),a!=null&&a.length&&e.partialSign(...a),d=new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))),o===qr){const[g]=await pe(this,Ce,"f").features[qr].signAndSendTransaction({account:i,chain:s,transaction:d,options:{preflightCommitment:kd(l.preflightCommitment||n.commitment),skipPreflight:l.skipPreflight,maxRetries:l.maxRetries,minContextSlot:l.minContextSlot}});return PT.encode(g.signature)}else{const[g]=await pe(this,Ce,"f").features[Kt].signTransaction({account:i,chain:s,transaction:d,options:{preflightCommitment:kd(l.preflightCommitment||n.commitment),minContextSlot:l.minContextSlot}});return await n.sendRawTransaction(g.signedTransaction,{...l,preflightCommitment:kd(l.preflightCommitment||n.commitment)})}}catch(a){throw a instanceof Qt?a:new mr(a==null?void 0:a.message,a)}}catch(i){throw this.emit("error",i),i}}}An=new WeakMap,oo=new WeakMap,so=new WeakMap,Hi=new WeakMap,Ks=new WeakMap,hc=new WeakMap,Ce=new WeakMap,pc=new WeakMap,Gf=new WeakMap,on=new WeakSet,Zf=async function(e){try{if(this.connected||this.connecting)return;if(pe(this,pc,"f")!==$.Installed)throw new en;if(Ft(this,so,!0,"f"),!pe(this,Ce,"f").accounts.length)try{await pe(this,Ce,"f").features[F0].connect(e)}catch(r){throw new lr(r==null?void 0:r.message,r)}const n=pe(this,Ce,"f").accounts[0];if(!n)throw new qt;pe(this,on,"m",Dl).call(this,n)}catch(n){throw this.emit("error",n),n}finally{Ft(this,so,!1,"f")}},Dl=function(e){let n;try{n=new X(e.address)}catch(r){throw new Sn(r==null?void 0:r.message,r)}Ft(this,An,e,"f"),Ft(this,oo,n,"f"),pe(this,on,"m",sa).call(this),this.emit("connect",n)},Yf=function(){Ft(this,An,null,"f"),Ft(this,oo,null,"f"),pe(this,on,"m",sa).call(this),this.emit("disconnect")},sa=function(){var n,r;const e=qr in pe(this,Ce,"f").features?pe(this,Ce,"f").features[qr].supportedTransactionVersions:pe(this,Ce,"f").features[Kt].supportedTransactionVersions;Ft(this,hc,CT(e,["legacy"])?null:new Set(e),"f"),Kt in pe(this,Ce,"f").features&&((n=pe(this,An,"f"))!=null&&n.features.includes(Kt))?(this.signTransaction=pe(this,on,"m",oy),this.signAllTransactions=pe(this,on,"m",sy)):(delete this.signTransaction,delete this.signAllTransactions),Uo in pe(this,Ce,"f").features&&((r=pe(this,An,"f"))!=null&&r.features.includes(Uo))?this.signMessage=pe(this,on,"m",ay):delete this.signMessage,Nd in pe(this,Ce,"f").features?this.signIn=pe(this,on,"m",ly):delete this.signIn},oy=async function(e){try{const n=pe(this,An,"f");if(!n)throw new me;if(!(Kt in pe(this,Ce,"f").features))throw new Ei;if(!n.features.includes(Kt))throw new qt;try{const i=(await pe(this,Ce,"f").features[Kt].signTransaction({account:n,transaction:xi(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))[0].signedTransaction;return xi(e)?ws.deserialize(i):Ue.from(i)}catch(r){throw r instanceof Qt?r:new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}},sy=async function(e){try{const n=pe(this,An,"f");if(!n)throw new me;if(!(Kt in pe(this,Ce,"f").features))throw new Ei;if(!n.features.includes(Kt))throw new qt;try{const r=await pe(this,Ce,"f").features[Kt].signTransaction(...e.map(i=>({account:n,transaction:xi(i)?i.serialize():new Uint8Array(i.serialize({requireAllSignatures:!1,verifySignatures:!1}))})));return e.map((i,o)=>{const s=r[o].signedTransaction;return xi(i)?ws.deserialize(s):Ue.from(s)})}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}},ay=async function(e){try{const n=pe(this,An,"f");if(!n)throw new me;if(!(Uo in pe(this,Ce,"f").features))throw new Ei;if(!n.features.includes(Uo))throw new qt;try{return(await pe(this,Ce,"f").features[Uo].signMessage({account:n,message:e}))[0].signature}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}},ly=async function(e={}){try{if(!(Nd in pe(this,Ce,"f").features))throw new Ei;let n;try{[n]=await pe(this,Ce,"f").features[Nd].signIn(e)}catch(r){throw new qg(r==null?void 0:r.message,r)}if(!n)throw new qg;return pe(this,on,"m",Dl).call(this,n.account),n}catch(n){throw this.emit("error",n),n}};const ZT=Wx;var YT=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},GT=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Ll;let Fn;const zl=new Set,Ko={};function HT(){if(Fn||(Fn=Object.freeze({register:cy,get:KT,on:JT}),typeof window>"u"))return Fn;const t=Object.freeze({register:cy});try{window.addEventListener("wallet-standard:register-wallet",({detail:e})=>e(t))}catch(e){console.error(`wallet-standard:register-wallet event listener could not be added `,e)}try{window.dispatchEvent(new XT(t))}catch(e){console.error(`wallet-standard:app-ready event could not be dispatched -`,e)}return Fn}function cy(...t){var e;return t=t.filter(n=>!zl.has(n)),t.length?(t.forEach(n=>zl.add(n)),(e=Ko.register)==null||e.forEach(n=>Hf(()=>n(...t))),function(){var r;t.forEach(i=>zl.delete(i)),(r=Ko.unregister)==null||r.forEach(i=>Hf(()=>i(...t)))}):()=>{}}function KT(){return[...zl]}function JT(t,e){var n;return(n=Ko[t])!=null&&n.push(e)||(Ko[t]=[e]),function(){var i;Ko[t]=(i=Ko[t])==null?void 0:i.filter(o=>e!==o)}}function Hf(t){try{t()}catch(e){console.error(e)}}class XT extends Event{constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),Ll.set(this,void 0),YT(this,Ll,e,"f")}get detail(){return GT(this,Ll,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Ll=new WeakMap;function qT(){if(Fn||(Fn=HT(),typeof window>"u"))return Fn;const t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),Fn;const{register:e}=Fn,n=(...r)=>r.forEach(i=>Hf(()=>i({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:n})})}catch{return console.error("window.navigator.wallets could not be set"),Fn}return n(...t),Fn}function $T(t){const e=uy(()=>new Set),{get:n,on:r}=uy(()=>qT()),[i,o]=oe.useState(()=>dy(n()));oe.useEffect(()=>{const a=[r("register",(...l)=>o(d=>[...d,...dy(l)])),r("unregister",(...l)=>o(d=>d.filter(g=>l.some(y=>y===g.wallet))))];return()=>a.forEach(l=>l())},[r]);const s=e4(i);return oe.useEffect(()=>{if(!s)return;const a=new Set(i);new Set(s.filter(d=>!a.has(d))).forEach(d=>d.destroy())},[s,i]),oe.useEffect(()=>()=>i.forEach(a=>a.destroy()),[]),oe.useMemo(()=>[...i,...t.filter(({name:a})=>i.some(l=>l.name===a)?(e.has(a)||(e.add(a),console.warn(`${a} was registered as a Standard Wallet. The Wallet Adapter for ${a} can be removed from your app.`)),!1):!0)],[i,t,e])}function uy(t){const e=oe.useRef();return e.current||(e.current={value:t()}),e.current.value}function e4(t){const e=oe.useRef();return oe.useEffect(()=>{e.current=t}),e.current}function dy(t){return t.filter(ZT).map(e=>new QT({wallet:e}))}var ss;(function(t){t[t.DESKTOP_WEB=0]="DESKTOP_WEB",t[t.MOBILE_WEB=1]="MOBILE_WEB"})(ss||(ss={}));function t4(t){return/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(t)}function n4({adapters:t,userAgentString:e}){return t.some(n=>n.name!==Mi&&n.readyState===$.Installed)?ss.DESKTOP_WEB:e&&/android/i.test(e)&&!t4(e)?ss.MOBILE_WEB:ss.DESKTOP_WEB}function r4(t){return t?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta"}function i4({children:t,wallets:e,adapter:n,isUnloadingRef:r,onAutoConnectRequest:i,onConnectError:o,onError:s,onSelectWallet:a}){const l=oe.useRef(!1),[d,g]=oe.useState(!1),y=oe.useRef(!1),[x,v]=oe.useState(!1),[A,k]=oe.useState(()=>(n==null?void 0:n.publicKey)??null),[D,I]=oe.useState(()=>(n==null?void 0:n.connected)??!1),M=oe.useRef(s);oe.useEffect(()=>(M.current=s,()=>{M.current=void 0}),[s]);const w=oe.useRef((p,S)=>(r.current||(M.current?M.current(p,S):(console.error(p,S),p instanceof en&&typeof window<"u"&&S&&window.open(S.url,"_blank"))),p)),[j,C]=oe.useState(()=>e.map(p=>({adapter:p,readyState:p.readyState})).filter(({readyState:p})=>p!==$.Unsupported));oe.useEffect(()=>{C(S=>e.map((z,b)=>{const N=S[b];return N&&N.adapter===z&&N.readyState===z.readyState?N:{adapter:z,readyState:z.readyState}}).filter(({readyState:z})=>z!==$.Unsupported));function p(S){C(z=>{const b=z.findIndex(({adapter:T})=>T===this);if(b===-1)return z;const{adapter:N}=z[b];return[...z.slice(0,b),{adapter:N,readyState:S},...z.slice(b+1)].filter(({readyState:T})=>T!==$.Unsupported)})}return e.forEach(S=>S.on("readyStateChange",p,S)),()=>{e.forEach(S=>S.off("readyStateChange",p,S))}},[n,e]);const U=oe.useMemo(()=>j.find(p=>p.adapter===n)??null,[n,j]);oe.useEffect(()=>{if(!n)return;const p=b=>{k(b),l.current=!1,g(!1),I(!0),y.current=!1,v(!1)},S=()=>{r.current||(k(null),l.current=!1,g(!1),I(!1),y.current=!1,v(!1))},z=b=>{w.current(b,n)};return n.on("connect",p),n.on("disconnect",S),n.on("error",z),()=>{n.off("connect",p),n.off("disconnect",S),n.off("error",z),S()}},[n,r]);const O=oe.useRef(!1);oe.useEffect(()=>()=>{O.current=!1},[n]),oe.useEffect(()=>{O.current||l.current||D||!i||!((U==null?void 0:U.readyState)===$.Installed||(U==null?void 0:U.readyState)===$.Loadable)||(l.current=!0,g(!0),O.current=!0,async function(){try{await i()}catch{o()}finally{g(!1),l.current=!1}}())},[D,i,o,U]);const B=oe.useCallback(async(p,S,z)=>{if(!n)throw w.current(new ey);if(!D)throw w.current(new me,n);return await n.sendTransaction(p,S,z)},[n,D]),Y=oe.useMemo(()=>n&&"signTransaction"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signTransaction(p)}:void 0,[n,D]),G=oe.useMemo(()=>n&&"signAllTransactions"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signAllTransactions(p)}:void 0,[n,D]),q=oe.useMemo(()=>n&&"signMessage"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signMessage(p)}:void 0,[n,D]),ie=oe.useMemo(()=>n&&"signIn"in n?async p=>await n.signIn(p):void 0,[n]),R=oe.useCallback(async()=>{if(l.current||y.current||U!=null&&U.adapter.connected)return;if(!U)throw w.current(new ey);const{adapter:p,readyState:S}=U;if(!(S===$.Installed||S===$.Loadable))throw w.current(new en,p);l.current=!0,g(!0);try{await p.connect()}catch(z){throw o(),z}finally{g(!1),l.current=!1}},[o,U]),c=oe.useCallback(async()=>{if(!y.current&&n){y.current=!0,v(!0);try{await n.disconnect()}finally{v(!1),y.current=!1}}},[n]);return te.createElement(bM.Provider,{value:{autoConnect:!!i,wallets:j,wallet:U,publicKey:A,connected:D,connecting:d,disconnecting:x,select:a,connect:R,disconnect:c,sendTransaction:B,signTransaction:Y,signAllTransactions:G,signMessage:q,signIn:ie}},t)}let Ed;function o4(){var t;return Ed===void 0&&(Ed=((t=globalThis.navigator)==null?void 0:t.userAgent)??null),Ed}function dl(t){const e=o4();return n4({adapters:t,userAgentString:e})===ss.MOBILE_WEB}function s4(){const t=globalThis.location;if(t)return`${t.protocol}//${t.host}`}function a4({children:t,wallets:e,autoConnect:n,localStorageKey:r="walletName",onError:i}){const{connection:o}=Ox(),s=$T(e),a=oe.useMemo(()=>{if(!dl(s))return null;const M=s.find(w=>w.name===Mi);return M||new kT({addressSelector:ET(),appIdentity:{uri:s4()},authorizationResultCache:xT(),cluster:r4(o==null?void 0:o.rpcEndpoint),onWalletNotFound:AT()})},[s,o==null?void 0:o.rpcEndpoint]),l=oe.useMemo(()=>a==null||s.indexOf(a)!==-1?s:[a,...s],[s,a]),[d,g]=Px(r,dl(s)?Mi:null),y=oe.useMemo(()=>l.find(M=>M.name===d)??null,[l,d]),x=oe.useCallback(M=>{d!==M&&(y&&y.name!==Mi&&y.disconnect(),g(M))},[y,g,d]);oe.useEffect(()=>{if(!y)return;function M(){k.current||d===Mi&&dl(s)||g(null)}return y.on("disconnect",M),()=>{y.off("disconnect",M)}},[y,s,g,d]);const v=oe.useRef(!1),A=oe.useMemo(()=>{if(!(!n||!y))return async()=>{(n===!0||await n(y))&&(v.current?await y.connect():await y.autoConnect())}},[n,y]),k=oe.useRef(!1);oe.useEffect(()=>{if(d===Mi&&dl(s)){k.current=!1;return}function M(){k.current=!0}return window.addEventListener("beforeunload",M),()=>{window.removeEventListener("beforeunload",M)}},[s,d]);const D=oe.useCallback(()=>{y&&y.name!==Mi&&x(null)},[y,x]),I=oe.useCallback(M=>{v.current=!0,x(M)},[x]);return te.createElement(i4,{wallets:l,adapter:y,isUnloadingRef:k,onAutoConnectRequest:A,onConnectError:D,onError:i,onSelectWallet:I},t)}const l4="BitKeep";class c4 extends Xn{constructor(e={}){super(),this.name=l4,this.url="https://bitkeep.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iNjQiIGZpbGw9IiM3NTI0RjkiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMDIgNDUuNjAyN1Y0OS44MjA0QzEwMi4wMDEgNTAuMjI4MyAxMDEuODkzIDUwLjYyOTIgMTAxLjY4NyA1MC45ODI3QzEwMS40ODEgNTEuMzM2MSAxMDEuMTg1IDUxLjYyOTYgMTAwLjgyOCA1MS44MzM1TDg3LjA5MDggNTkuNjgwMUw5OS4zNjMzIDY2LjY3MUMxMDAuMTY1IDY3LjEyOTUgMTAwLjgzMSA2Ny43ODkyIDEwMS4yOTQgNjguNTgzNkMxMDEuNzU3IDY5LjM3OCAxMDIuMDAxIDcwLjI3OTEgMTAyIDcxLjE5NjJWODIuNDQyNEMxMDIuMDAxIDgzLjM2IDEwMS43NTggODQuMjYxNyAxMDEuMjk1IDg1LjA1NjdDMTAwLjgzMiA4NS44NTE2IDEwMC4xNjYgODYuNTExNyA5OS4zNjMzIDg2Ljk3MDVMNjcuMDg2OSAxMDUuM0M2Ni4yODUzIDEwNS43NTkgNjUuMzc1OSAxMDYgNjQuNDUwMiAxMDZDNjMuNTI0NSAxMDYgNjIuNjE1MSAxMDUuNzU5IDYxLjgxMzUgMTA1LjNMNTEuMjUyIDk5LjI2MTFDNTEuMDczNyA5OS4xNTkzIDUwLjkyNTYgOTkuMDEyOCA1MC44MjI3IDk4LjgzNjNDNTAuNzE5OCA5OC42NTk5IDUwLjY2NTYgOTguNDU5NyA1MC42NjU2IDk4LjI1NkM1MC42NjU2IDk4LjA1MjIgNTAuNzE5OCA5Ny44NTIgNTAuODIyNyA5Ny42NzU2QzUwLjkyNTYgOTcuNDk5MSA1MS4wNzM3IDk3LjM1MjcgNTEuMjUyIDk3LjI1MDhMODYuMTE1MiA3Ny4zODM1Qzg2LjIwNCA3Ny4zMzI1IDg2LjI3NzcgNzcuMjU5MyA4Ni4zMjkgNzcuMTcxMkM4Ni4zODAyIDc3LjA4MzIgODYuNDA3MiA3Ni45ODMzIDg2LjQwNzIgNzYuODgxN0M4Ni40MDcyIDc2Ljc4IDg2LjM4MDIgNzYuNjgwMiA4Ni4zMjkgNzYuNTkyMUM4Ni4yNzc3IDc2LjUwNCA4Ni4yMDQgNzYuNDMwOCA4Ni4xMTUyIDc2LjM3OThMNzMuMTcxOSA2OC45NzcxQzcyLjgxNTYgNjguNzczNCA3Mi40MTE0IDY4LjY2NjIgNzIgNjguNjY2MkM3MS41ODg2IDY4LjY2NjIgNzEuMTg0NCA2OC43NzM0IDcwLjgyODEgNjguOTc3MUwzNS40MTcgODkuMTcyMkMzNS4xNDk4IDg5LjMyNSAzNC44NDY3IDg5LjQwNTQgMzQuNTM4MSA4OS40MDU0QzM0LjIyOTUgODkuNDA1NCAzMy45MjY0IDg5LjMyNSAzMy42NTkyIDg5LjE3MjJMMjkuNjQ4NCA4Ni45MDA5QzI4Ljg0MjQgODYuNDQyOCAyOC4xNzI5IDg1Ljc4MiAyNy43MDc4IDg0Ljk4NTNDMjcuMjQyNyA4NC4xODg2IDI2Ljk5ODUgODMuMjg0MyAyNyA4Mi4zNjQxVjc3Ljc2NjRDMjYuOTk5OCA3Ny40NjA3IDI3LjA4MDkgNzcuMTYwMyAyNy4yMzUyIDc2Ljg5NTVDMjcuMzg5NSA3Ni42MzA3IDI3LjYxMTUgNzYuNDEwOSAyNy44Nzg5IDc2LjI1OEw3OC42NTA0IDQ3LjM2OTNDNzguNzM5MiA0Ny4zMTgzIDc4LjgxMjkgNDcuMjQ1MSA3OC44NjQxIDQ3LjE1N0M3OC45MTU0IDQ3LjA2ODkgNzguOTQyMyA0Ni45NjkxIDc4Ljk0MjMgNDYuODY3NEM3OC45NDIzIDQ2Ljc2NTggNzguOTE1NCA0Ni42NjU5IDc4Ljg2NDEgNDYuNTc3OUM3OC44MTI5IDQ2LjQ4OTggNzguNzM5MiA0Ni40MTY2IDc4LjY1MDQgNDYuMzY1Nkw2NS42ODY1IDM4LjkzNjdDNjUuMzMwMiAzOC43MzMxIDY0LjkyNjEgMzguNjI1OCA2NC41MTQ2IDM4LjYyNThDNjQuMTAzMiAzOC42MjU4IDYzLjY5OTEgMzguNzMzMSA2My4zNDI4IDM4LjkzNjdMMjguNzU3OCA1OC42M0MyOC41Nzk4IDU4LjczMTggMjguMzc3OCA1OC43ODU0IDI4LjE3MjIgNTguNzg1NUMyNy45NjY2IDU4Ljc4NTUgMjcuNzY0NiA1OC43MzIgMjcuNTg2NSA1OC42MzAzQzI3LjQwODQgNTguNTI4NiAyNy4yNjA0IDU4LjM4MjMgMjcuMTU3NSA1OC4yMDYxQzI3LjA1NDUgNTguMDI5OSAyNy4wMDAyIDU3LjgzIDI3IDU3LjYyNjRWNDUuNTQ3NkMyNi45OTg5IDQ0LjYzIDI3LjI0MiA0My43MjgzIDI3LjcwNDkgNDIuOTMzNEMyOC4xNjc4IDQyLjEzODQgMjguODM0MSA0MS40NzgzIDI5LjYzNjcgNDEuMDE5NUw2MS45MDcyIDIyLjY5NTRDNjIuNzA3MSAyMi4yMzk4IDYzLjYxMzggMjIgNjQuNTM2NiAyMkM2NS40NTk0IDIyIDY2LjM2NjEgMjIuMjM5OCA2Ny4xNjYgMjIuNjk1NEw5OS4zNjMzIDQxLjA4MzNDMTAwLjE2NSA0MS41NDE0IDEwMC44MyA0Mi4yMDAxIDEwMS4yOTMgNDIuOTkzNEMxMDEuNzU2IDQzLjc4NjcgMTAyIDQ0LjY4NjYgMTAyIDQ1LjYwMjdaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.bitkeep)==null?void 0:n.solana)!=null&&r.isBitKeep?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.bitkeep.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const u4="modulepreload",d4=function(t){return"/sns-widget/"+t},fy={},Ba=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=d4(o),o in fy)return;fy[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let g=i.length-1;g>=0;g--){const y=i[g];if(y.href===o&&(!s||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const d=document.createElement("link");if(d.rel=s?"stylesheet":u4,s||(d.as="script",d.crossOrigin=""),d.href=o,document.head.appendChild(d),s)return new Promise((g,y)=>{d.addEventListener("load",g),d.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},f4="Clover";class h4 extends Xn{constructor(e={}){super(),this.name=f4,this.url="https://clv.org",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTM2LjQ4IDBIMTEuNTJDNS4xNTc2OCAwIDAgNS4xNTc2OCAwIDExLjUyVjM2LjQ4QzAgNDIuODQyMyA1LjE1NzY4IDQ4IDExLjUyIDQ4SDM2LjQ4QzQyLjg0MjMgNDggNDggNDIuODQyMyA0OCAzNi40OFYxMS41MkM0OCA1LjE1NzY4IDQyLjg0MjMgMCAzNi40OCAwWiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzc5MTBfMTYzMzUxKSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTI0LjAwMDYgMzkuMzYwNkMzMi40ODM3IDM5LjM2MDYgMzkuMzYwNiAzMi40ODM3IDM5LjM2MDYgMjQuMDAwNkMzOS4zNjA2IDE1LjUxNzUgMzIuNDgzNyA4LjY0MDYyIDI0LjAwMDYgOC42NDA2MkMxNS41MTc1IDguNjQwNjIgOC42NDA2MiAxNS41MTc1IDguNjQwNjIgMjQuMDAwNkM4LjY0MDYyIDMyLjQ4MzcgMTUuNTE3NSAzOS4zNjA2IDI0LjAwMDYgMzkuMzYwNlpNMjEuMjg5OSAxNS44Njg4SDI2LjcxMVYyMS4zNDdIMjEuMjkwNFYyNi42NTRIMjYuNzExVjMyLjEzMjJIMjEuMjg5OVYyNi44MjUySDE1Ljg2OTNWMjEuMzQ3SDIxLjI4OTlWMTUuODY4OFpNMjYuNzEyIDIxLjM0N0gzMi4xMzMxVjI2LjgyNTJIMjYuNzEyVjIxLjM0N1oiIGZpbGw9ImJsYWNrIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNzkxMF8xNjMzNTEiIHgxPSI0OCIgeTE9Ii0xLjQzMDUxZS0wNiIgeDI9IjEuNDMwNTFlLTA2IiB5Mj0iNDgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0E5RkZFMCIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM4NkQ1RkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.clover_solana)!=null&&n.isCloverWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.clover_solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return Uint8Array.from(r)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}var fl=_c.Buffer;function p4(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(M);D!==I;){for(var j=v[D],C=0,U=M-1;(j!==0||C>>0,w[U]=j%s>>>0,j=j/s>>>0;if(j!==0)throw new Error("Non-zero carry");k=C,D++}for(var O=M-k;O!==M&&w[O]===0;)O++;for(var B=a.repeat(A);O>>0,M=new Uint8Array(I);v[A];){var w=e[v.charCodeAt(A)];if(w===255)return;for(var j=0,C=I-1;(w!==0||j>>0,M[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=j,A++}for(var U=I-D;U!==I&&M[U]===0;)U++;var O=fl.allocUnsafe(k+(I-U));O.fill(0,0,k);for(var B=k;U!==I;)O[B++]=M[U++];return O}function x(v){var A=y(v);if(A)return A;throw new Error("Non-base"+s+" character")}return{encode:g,decodeUnsafe:y,decode:x}}var g4=p4,y4=g4,m4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",w4=y4(m4);const xd=Or(w4),M4="Coin98";class N4 extends Xn{constructor(e={}){super(),this.name=M4,this.url="https://coin98.com",this.icon="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3NiA3NSI+CiAgPGRlZnM+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSIxMDEuNjgxJSIgeDI9Ii0xLjU1NyUiIHkxPSIxNS4yNjglIiB5Mj0iODQuOTE3JSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNGMUQ5NjEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjQ0RBMTQ2Ii8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPHJlY3Qgd2lkdGg9Ijc1IiBoZWlnaHQ9Ijc1IiBmaWxsPSIjMDAwIiByeD0iMTYiLz4KICAgIDxwYXRoIGZpbGw9InVybCgjYSkiIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYxLjQ0IDBhMTMuNzE0IDEzLjcxNCAwIDAgMSA5LjY4IDQuMDEgMTMuNjYxIDEzLjY2MSAwIDAgMSA0LjAwOCA5LjY2OHY0Ny42NDZhMTMuNjYgMTMuNjYgMCAwIDEtNC4wMDcgOS42NjZBMTMuNzEzIDEzLjcxMyAwIDAgMSA2MS40NCA3NUgxMy42ODZhMTMuNzEzIDEzLjcxMyAwIDAgMS05LjY4LTQuMDFBMTMuNjYgMTMuNjYgMCAwIDEgMCA2MS4zMjRWMTMuNjc4YzAtMy42MjUgMS40NC03LjEwMiA0LjAwNy05LjY2N0ExMy43MTQgMTMuNzE0IDAgMCAxIDEzLjY4NyAwWk0yMC4wNjMgNDYuMjMxaC00LjgyNWExMC4wMzIgMTAuMDMyIDAgMCAwIDIuOTQ2IDcuMDg2IDEwLjA3IDEwLjA3IDAgMCAwIDcuMSAyLjk0MiAxMC4wNjUgMTAuMDY1IDAgMCAwIDcuMTA4LTIuOTM1IDEwLjAzIDEwLjAzIDAgMCAwIDIuOTQ2LTcuMDkzaC00LjgyNGE1LjIwNyA1LjIwNyAwIDAgMS0xLjUzIDMuNjg4IDUuMjI1IDUuMjI1IDAgMCAxLTMuNjk2IDEuNTI4IDUuMjM0IDUuMjM0IDAgMCAxLTMuNjk1LTEuNTI4IDUuMjEzIDUuMjEzIDAgMCAxLTEuNTMtMy42ODhaTTU0LjMzIDMzLjcxNmExMS43NjMgMTEuNzYzIDAgMCAwLTEyLjc5OSAyLjUzOEExMS42OTcgMTEuNjk3IDAgMCAwIDM4Ljk5IDQ5LjAzYTExLjcyMyAxMS43MjMgMCAwIDAgNC4zMjggNS4yNTkgMTEuNzU3IDExLjc1NyAwIDAgMCA2LjUyNiAxLjk3IDExLjc2NiAxMS43NjYgMCAwIDAgOC4yOS0zLjQzNSAxMS43MiAxMS43MiAwIDAgMCAzLjQ0Mi04LjI3NCAxMS43MDIgMTEuNzAyIDAgMCAwLTEuOTc1LTYuNTE0IDExLjczNiAxMS43MzYgMCAwIDAtNS4yNjktNC4zMlptLTQuNDg4IDMuOTJhNi45MzcgNi45MzcgMCAwIDEgNC45IDIuMDI1IDYuOTEgNi45MSAwIDAgMSAyLjAyOCA0Ljg5MiA2Ljg5NyA2Ljg5NyAwIDAgMS0xLjE3IDMuODM0IDYuOTMyIDYuOTMyIDAgMCAxLTEwLjY0MyAxLjA0MiA2LjkwMiA2LjkwMiAwIDAgMS0xLjUtNy41MjIgNi45MDkgNi45MDkgMCAwIDEgMi41NDQtMy4xIDYuOTI4IDYuOTI4IDAgMCAxIDMuODQxLTEuMTY3Wm0uMTcgNC41NTJhMi40MzEgMi40MzEgMCAwIDAtMi4yNDEgMS4xNTQgMi40MTggMi40MTggMCAwIDAtLjM1NiAxLjI1NyAyLjM5NSAyLjM5NSAwIDAgMCAxLjYxOSAyLjI5djEuNzUzaDEuNjE4di0xLjc1NGEyLjQyNyAyLjQyNyAwIDAgMCAxLjU5NC0xLjk1IDIuNDE4IDIuNDE4IDAgMCAwLTEtMi4zMSAyLjQzMSAyLjQzMSAwIDAgMC0xLjIzNC0uNDRabS0yMC4yMi0yMi41NTJhMTEuNzYyIDExLjc2MiAwIDAgMC0xMi43OTYgMi41MzEgMTEuNjk3IDExLjY5NyAwIDAgMC0yLjU1NCAxMi43NjkgMTEuNzIzIDExLjcyMyAwIDAgMCA0LjMyIDUuMjYyIDExLjc1NyAxMS43NTcgMCAwIDAgMTQuODI1LTEuNDQ2IDExLjcxNyAxMS43MTcgMCAwIDAgMy40NDUtOC4yODQgMTEuNzAzIDExLjcwMyAwIDAgMC0xLjk3NC02LjUxMiAxMS43MzYgMTEuNzM2IDAgMCAwLTUuMjY2LTQuMzJabS00LjUxIDMuOTE3YTYuOTQ1IDYuOTQ1IDAgMCAxIDQuODk3IDIuMDI5IDYuOTE4IDYuOTE4IDAgMCAxIDIuMDMyIDQuODg2IDYuOTA2IDYuOTA2IDAgMCAxLTEuMTY4IDMuODQyIDYuOTQgNi45NCAwIDAgMS0xMC42NiAxLjA0OCA2LjkxMSA2LjkxMSAwIDAgMS0xLjUtNy41MzYgNi45MTggNi45MTggMCAwIDEgMi41NS0zLjEwMyA2LjkzNyA2LjkzNyAwIDAgMSAzLjg1LTEuMTY2Wm0yNC41Ni00LjgxYTEwLjA1OSAxMC4wNTkgMCAwIDAtNy4xMDMgMi45NCAxMC4wMiAxMC4wMiAwIDAgMC0yLjk0IDcuMDkgOS45IDkuOSAwIDAgMCAxLjIzIDQuNzk1IDEzLjU3NSAxMy41NzUgMCAwIDEgNC4yMTQtMi4zMjIgNS4wODIgNS4wODIgMCAwIDEtLjYyNS0yLjQ3NyA1LjIwNiA1LjIwNiAwIDAgMSAxLjUwMy0zLjczNiA1LjIyMyA1LjIyMyAwIDAgMSAzLjcyMi0xLjU1NCA1LjIzNCA1LjIzNCAwIDAgMSAzLjcyIDEuNTU0IDUuMjEzIDUuMjEzIDAgMCAxIDEuNTA1IDMuNzM2IDUuMjc5IDUuMjc5IDAgMCAxLS42MjMgMi40NzMgMTMuNTc0IDEzLjU3NCAwIDAgMSA0LjIxMyAyLjMyMiA5LjkwMyA5LjkwMyAwIDAgMCAxLjIzLTQuNzk1IDEwLjAzMiAxMC4wMzIgMCAwIDAtMi45NDYtNy4wODYgMTAuMDcgMTAuMDcgMCAwIDAtNy4xLTIuOTRabS0yMy43NSA3Ljk5aC0xLjYxN3YxLjc1YTIuNDE5IDIuNDE5IDAgMCAwLTEuNTgyIDIuNjg3IDIuNDE0IDIuNDE0IDAgMCAwIDIuMzkgMi4wMDYgMi40NSAyLjQ1IDAgMCAwIDEuNTU1LS41NzQgMi40MTQgMi40MTQgMCAwIDAtLjc0Ni00LjExOXYtMS43NVoiLz4KICA8L2c+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.coin98)!=null&&n.sol?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected())}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coin98.sol;let n;try{n=(await e.connect())[0]}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_sign",params:[e]}),i=new X(r.publicKey),o=xd.decode(r.signature);return e.addSignature(i,o),e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signAllTransactions",params:[e]}),i=new X(r.publicKey),o=r.signatures;return e.map((s,a)=>{const l=xd.decode(o[a]);return s.addSignature(i,l),s})}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signMessage",params:[e]});return xd.decode(r.signature)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const v4="Coinbase Wallet";class S4 extends Xn{constructor(e={}){super(),this.name=v4,this.url="https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzAwNTJGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1MiA1MTJDMTUyIDcxMC44MjMgMzEzLjE3NyA4NzIgNTEyIDg3MkM3MTAuODIzIDg3MiA4NzIgNzEwLjgyMyA4NzIgNTEyQzg3MiAzMTMuMTc3IDcxMC44MjMgMTUyIDUxMiAxNTJDMzEzLjE3NyAxNTIgMTUyIDMxMy4xNzcgMTUyIDUxMlpNNDIwIDM5NkM0MDYuNzQ1IDM5NiAzOTYgNDA2Ljc0NSAzOTYgNDIwVjYwNEMzOTYgNjE3LjI1NSA0MDYuNzQ1IDYyOCA0MjAgNjI4SDYwNEM2MTcuMjU1IDYyOCA2MjggNjE3LjI1NSA2MjggNjA0VjQyMEM2MjggNDA2Ljc0NSA2MTcuMjU1IDM5NiA2MDQgMzk2SDQyMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window!=null&&window.coinbaseSolana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coinbaseSolana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const I4="HuobiWallet";class b4 extends Xn{constructor(e={}){super(),this.name=I4,this.url="https://www.huobiwallet.io",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjI0IiBoZWlnaHQ9IjIyNCIgdmlld0JveD0iMCAwIDIyNCAyMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAwTDIyNCAwVjIyNEgwTDAgMFoiIGZpbGw9IiMyMTU3RTIiLz4KPHBhdGggZD0iTTEzMS4wNTkgODEuMTc3MUMxMzEuMDU5IDU3Ljc1MzEgMTE5LjQ1OCAzNy42MzE1IDExMC42MjUgMzEuMDcyOEMxMTAuNjI1IDMxLjA3MjggMTA5Ljk1MyAzMC43MDQyIDExMCAzMS42MjU4VjMxLjYyNThDMTA5LjI2NSA3Ni44MzAzIDg1Ljc2NzIgODkuMDg3NSA3Mi44MzggMTA1LjU4NEM0My4wMjQxIDE0My42NzcgNzAuNzU4NyAxODUuNDU2IDk4Ljk5MzUgMTkzLjEzNkMxMTQuNzk5IDE5Ny40NTIgOTUuMzUwOCAxODUuNDU2IDkyLjg0OTQgMTYwLjIzNUM4OS44MDA3IDEyOS43NDUgMTMxLjA1OSAxMDYuNDQ0IDEzMS4wNTkgODEuMTc3MVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xMTAxXzEyNSkiLz4KPHBhdGggZD0iTTE0My41OTcgOTYuMzE3NEMxNDMuNDA5IDk2LjE5NDMgMTQzLjE1OCA5Ni4xMDIgMTQyLjk4NiA5Ni4zOTQzQzE0Mi40ODQgMTAyLjEwMiAxMzYuNTYgMTE0LjI4NiAxMjkuMDM3IDEyNS40ODZDMTAzLjU1MiAxNjMuNDU1IDExOC4wNjUgMTgxLjc2MiAxMjYuMjQ3IDE5MS42MzlDMTMwLjk0OSAxOTcuMzQ3IDEyNi4yNDcgMTkxLjYzOSAxMzguMDk2IDE4NS44MDhDMTUyLjczNSAxNzcuMDkyIDE2Mi4yMzQgMTYyLjAyIDE2My42NDMgMTQ1LjI3QzE2NS4yMzMgMTI2Ljc1OCAxNTcuNzk4IDEwOC42IDE0My41OTcgOTYuMzE3NFoiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcl8xMTAxXzEyNSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjEyMi40MDEiIHkxPSIyMDkuMjk1IiB4Mj0iMTc4LjY2MiIgeTI9IjExMC40NDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjE1Ny44NjEiIHkxPSIyMDMuMTc3IiB4Mj0iMTg5LjAxNCIgeTI9IjE0MC4wMjIiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.huobiWallet)!=null&&n.isHuobiWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.huobiWallet;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("disconnect"))}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const k4="MathWallet";class E4 extends IM{constructor(e={}){super(),this.name=k4,this.url="https://mathwallet.org",this.icon="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJtMCAwaDEyOHYxMjhoLTEyOHoiIG9wYWNpdHk9IjAiLz48cGF0aCBkPSJtOTAuODQ3MDA4NiA1Ny43NjEwMDIzYy0yLjI3NzAzNjMtMi4yNzcwMzYzLTIuMjc3MDM2My01Ljk2ODg0MTYgMC04LjI0NTg3NzggMi4yNzcwMzYyLTIuMjc3MDM2MyA1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2NiAyLjI3NzAzNjIgMi4yNzcwMzY2IDUuOTY4ODQxNSAwIDguMjQ1ODc3OC0yLjI3NzAzNjMgMi4yNzcwMzYyLTUuOTY4ODQxNiAyLjI3NzAzNjItOC4yNDU4Nzc4IDB6bS0xOS41ODM5NTk4IDE5LjU4Mzk1OTdjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMzAuOTIyMDQyMi0xMC4zMDczNDcyYy0xLjcwNzc3OC0xLjcwNzc3NzItMS43MDc3NzgtNC40NzY2MzEyIDAtNi4xODQ0MDg0IDEuNzA3Nzc3LTEuNzA3Nzc3MiA0LjQ3NjYzMS0xLjcwNzc3NzIgNi4xODQ0MDggMHMxLjcwNzc3NyA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEgMS43MDc3NzcyLTYuMTg0NDA4IDB6bS0xMC4zMDczNDc3IDEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMjEuNjQ1NDI4Ny0xLjAzMDczNDdjLTEuMTM4NTE4LTEuMTM4NTE4MS0xLjEzODUxOC0yLjk4NDQyMDggMC00LjEyMjkzODkgMS4xMzg1MTktMS4xMzg1MTgxIDIuOTg0NDIxLTEuMTM4NTE4MSA0LjEyMjkzOSAwIDEuMTM4NTE5IDEuMTM4NTE4MSAxLjEzODUxOSAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTggMS4xMzg1MTgxLTIuOTg0NDIgMS4xMzg1MTgxLTQuMTIyOTM5IDB6bS0xMC4zMDczNDcgMTAuMzA3MzQ3MmMtMS4xMzg1MTgtMS4xMzg1MTgxLTEuMTM4NTE4LTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxOC0xLjEzODUxODEgMi45ODQ0MjEtMS4xMzg1MTgxIDQuMTIyOTM5IDAgMS4xMzg1MTggMS4xMzg1MTgyIDEuMTM4NTE4IDIuOTg0NDIwOCAwIDQuMTIyOTM4OS0xLjEzODUxOCAxLjEzODUxODItMi45ODQ0MjEgMS4xMzg1MTgyLTQuMTIyOTM5IDB6bS0yMi42NzYxNjM3LTE4LjU1MzIyNWMtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3M2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2Mi0yLjI3NzAzNjMgNS45Njg4NDE1LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjIgMi4yNzcwMzYyIDIuMjc3MDM2MiA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYzIDIuMjc3MDM2Mi01Ljk2ODg0MTYgMi4yNzcwMzYyLTguMjQ1ODc3OCAwem0tMjAuNzEwNTA2IDBjLTIuMjc3MDM2Mi0yLjI3NzAzNjMtMi4yNzcwMzYyLTUuOTY4ODQxNiAwLTguMjQ1ODc3OCAyLjI3NzAzNjMtMi4yNzcwMzYzIDUuOTY4ODQxNi0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDIuMjc3MDM2MiAyLjI3NzAzNjMgNS45Njg4NDE1IDAgOC4yNDU4Nzc4LTIuMjc3MDM2MiAyLjI3NzAzNjItNS45Njg4NDE1IDIuMjc3MDM2Mi04LjI0NTg3NzggMHptLTE5LjU4Mzk1OTcgMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0zMC45MjIwNDE3LTEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMiAwLTYuMTg0NDA4NHM0LjQ3NjYzMTItMS43MDc3NzcyIDYuMTg0NDA4NCAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEyIDEuNzA3Nzc3Mi02LjE4NDQwODQgMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3MmMtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0tNDAuMTk4NjU0My0xLjAzMDczNDdjLTEuMTM4NTE4MTMtMS4xMzg1MTgxLTEuMTM4NTE4MTMtMi45ODQ0MjA4IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA4LTEuMTM4NTE4MSA0LjEyMjkzODkgMHMxLjEzODUxODEgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTIuOTg0NDIwOCAxLjEzODUxODEtNC4xMjI5Mzg5IDB6bTEwLjMwNzM0NzMgMTAuMzA3MzQ3MmMtMS4xMzg1MTgyLTEuMTM4NTE4MS0xLjEzODUxODItMi45ODQ0MjA3IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA3LTEuMTM4NTE4MSA0LjEyMjkzODggMCAxLjEzODUxODIgMS4xMzg1MTgyIDEuMTM4NTE4MiAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTgxIDEuMTM4NTE4Mi0yLjk4NDQyMDcgMS4xMzg1MTgyLTQuMTIyOTM4OCAwem00MS4yMjkzODg5IDBjLTEuMTM4NTE4MS0xLjEzODUxODEtMS4xMzg1MTgxLTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxODItMS4xMzg1MTgxIDIuOTg0NDIwOC0xLjEzODUxODEgNC4xMjI5Mzg5IDAgMS4xMzg1MTgyIDEuMTM4NTE4MiAxLjEzODUxODIgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTEuMTM4NTE4MSAxLjEzODUxODItMi45ODQ0MjA3IDEuMTM4NTE4Mi00LjEyMjkzODkgMHptLTQyLjI2MDEyMzctMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzEyIDAtNi4xODQ0MDg0czQuNDc2NjMxMi0xLjcwNzc3NzIgNi4xODQ0MDg0IDAgMS43MDc3NzcyIDQuNDc2NjMxMiAwIDYuMTg0NDA4NC00LjQ3NjYzMTIgMS43MDc3NzcyLTYuMTg0NDA4NCAwem0xOS41ODM5NTk4IDEuMDMwNzM0N2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzMgMTAuMzA3MzQ3M2MtMi4yNzcwMzYyLTIuMjc3MDM2My0yLjI3NzAzNjItNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2My0yLjI3NzAzNjMgNS45Njg4NDE2LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjMgMi4yNzcwMzYyIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYyIDIuMjc3MDM2Mi01Ljk2ODg0MTUgMi4yNzcwMzYyLTguMjQ1ODc3OCAweiIvPjwvZz48L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._messaged=n=>{const r=n.data;r&&r.origin==="mathwallet_internal"&&r.type==="lockStatusChanged"&&!r.payload&&this._disconnected()},this._disconnected=()=>{this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.solana)!=null&&n.isMathWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}window.addEventListener("message",this._messaged),this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const x4="Neko";class T4 extends Xn{constructor(e={}){super(),this.name=x4,this.url="https://nekowallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyNDRweCIgaGVpZ2h0PSIyNjBweCIgdmlld0JveD0iMCAwIDI0NCAyNjAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0NCAyNjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyNDQiIGhlaWdodD0iMjYwIiB4PSIwIiB5PSIwIgogICAgaHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFQUUFBQUVFQ0FNQUFBQW9GT2xoQUFBQUJHZEJUVUVBQUxHUEMveGhCUUFBQUNCalNGSk4KQUFCNkpnQUFnSVFBQVBvQUFBQ0E2QUFBZFRBQUFPcGdBQUE2bUFBQUYzQ2N1bEU4QUFBQjQxQk1WRVVBQUFEL2Z5RC9jQ0QvZ0NyLwpmeXIvZ0VEL2dBRC9iU1QvY0JEM2JCajViUnI0YlJuNGJScjViaHI0YmhuNWJCbjRiaG40YlJyNmJodjNiQmo0YlJyM2NCajRiUm41CmJoci9jUno0Ynh2NWJocjNhQmovY3huNWJocjFhaHYzYkJyL2JSdjNiUnIyYkJ2M2JSdjRiQnI0YmhydmNDRDRiUm40YlJyM2NCajQKYmhmM2JSdjRieG4zYkJyM2JCbjRiQm41YlJyNWJScjRiQm4vZGgzNGJocjZhaHY0YXhuL2RTRDNiaHIzYlJqL2JCMzNhQmowYWh2MwpiUnIvYnhINGJCbjRiUnYvYnhENGJSbjZhaFg0YlJyMWJCbjRiUnI2YmhqNGJScjRiUm40YkJuNGJCcjNiUmo0YmhuNGJCcjRiUnI0CmJodjRiUnY5MnNiN3Y1cjVkaWo2bW1INnJYNzh5S245MGJqOHY1djd0b3o1aUVYKzQ5VCs3T1ArOXZILy8vLzVrVlA1ZGluN28zRDcKdG8zNnBIRDVpRWI1ZnpiKzdlTDdyWC81ZnpmLzl2SCs3ZVA3djV2KzdlSC8vLzcrNU5UN3BIRCs0OVA4dG8zOTJzWDZtMkw1ZnpqLwo5dkQ1Z0RqN3JYNzZwSEg4eUtqKzdPSC8vdjc4djVuNGRpbi85ZkQ4djVyNmlFYjd0b3Y5NDlQOHRveis1TlA5MExmNmtWUDRkeW42CmtWVDZtbUQ0ZGlqOTBiZis3T0Q3dFl2KzlmRDdtbUQ4dnBuOHRZdjgwYmo2bzNEOTVOVDZtbUw3bzNIKzl2RDZpRVg4ckgvNm0ySDcKcllEOTI4WDdtbUg4ckg3N3JIN1dKTE5MQUFBQVQzUlNUbE1BQUFBQUFBQUFBQkJBbjkvdno1QlFiOTlmUWQ0Z3YzOEJqODRnQVlBeApnQUh1a0dIUHpoQncvaUZQWUkrZ29JK2VyNzRCenpCd0FZQmdBU0V3N3hDUWp4QytNTEJRcjErdTNyK3VYNC9Pd0xqT0dBQUFBQUZpClMwZEVYM1BSVVMwQUFBQUpjRWhaY3dBQUN4TUFBQXNUQVFDYW5CZ0FBQUFIZEVsTlJRZm1CaHdHRkNaaGFHR2lBQUFPMTBsRVFWUjQKMnUyZCsyTVVWeFhIbDFacU5vWGF0QW1VaDRhdEJiYUNiVVNMSWxTMFZTeDlPTTAweXo2U3pTNGh6UVBMMGhwVEVaWUVBelZxMGFxawppbS8rVkdkMlp2WTVNK2Q3WnM2ZG05MzAreVBNenIyZm5Edm5mdStkZSsra1Vnd05wWWVmM0dQczJUdWM1dnhLb1hhbG43SXFaT3dkCi9vcXlJcDYyN3U5cTVCbmR2RGJ5c3lQTkNvMnFxZERZUHFOZCszVWpwNTQ3MEZHaGc0Y1VNSThZblJyV3pIeDR1S3RDbytMVVE5M00KdW1QOTJGZDdLalE2SkZ6R0FhTlhPdFBaNDEvenFkQzRiQmxqUGtVWSt6UkNIeG54cVZCR050VFArMEZyRFBXWHZ1NWJJZGxRditCYgp4b2cyYU45QUc4WlJ5VEtPR2Y0NnJvazVJTkJHVnJKOXB3T2c5MGpuUzB5N1h4d0pnSmJzdFlLZ3BmTWxLSi91eW9YK2htQXBKNEtnCnRZUjY5NHRCMWNtZUVDeG1QS2dVNDZRRzZNUGZES3lPWk10N0tiQVVRNEhqSlJRY2FNTjRXYkNjZmNIRkpPOVFRZ0p0VENRRG5iaEQKMmZWc1NHVWtPK3FSa0hLU0R2V1JzTXFNQ2haa2hDblpVQWY1RWtkWnVZTEdRcUgzSmdvZEdtaEpTNVlPaFRhU25Eb0tEN1NrSlNPZwpFM1FvZ1FiVWc1YXpaQ2ZDb1JNMG80RUcxSU9XczJUakJIUmlvUTd6SmRKLy8rZVRLeXBjWWI3RWtad2wreFpWVkVKbWxBNjBvQ1hiClI1YVZ6SHd3SFdqamxGaGhJMlJaaVRnVTN4blFMc2xaTXJxc1JNem90NzlEMXlNalZkZ3h1cXdrUWszNEVrZGlsdXdWQkZwOXFJOEEKVDVtY0pVc0RoYWszbzFDZ2pheFVpNk1NbWFNUnhRNEZDclNjSlJ1SG9CVTdGTXFBZXRDbmhjb2pEWmtqcFdhVUdtazBKV1hKYUVPbQpQdFNBTDNFMElWUWdiY2pjVUtzem80QUJkU1ZseWNDR3BkS013b0VXczJSb2Vlb2NDaDVvS1VzR0dUSkhxaHpLZDlFblRNeVNRWVpNCmFhZ3hYK0pDeXlRV3pKQ3BERFhtUzF4b21iODdac2hjcVRDam5FQkxXYkp4RHJRS004b0p0SlFsQXcyWkszbUhBaHBRVHpLV0REVmsKanNUTktHeEFYVTJJbElwM0YwcENqZnNTUnpLV2pQZUhsamFqREYvaVNNYVNNUXNWTnFQY1FCdVpKd1JLWlJneVY1SU9oUjFvR1V2RwpNV1NPSkIwS3c0QjYwQktQRjhlUWlZZWE1VXRjYUluU1dZWk1PdFFzWCtKQ1MxaXljVDYwOGIwelFqckFMMXZFa3ZFTTJUYVFoQ1hqCkdiSnRvQWtCYUhiNjFDMEpTOFpQSlpvbFljbDBNN0FsWU1uNGhreTNCQ3daMzVEcGxvQWxpMkRJZEVQSHQyUVJESmx1NlBpV2JGdzMKQXg4NnZpWHJPME1tWWNuNnpwQkpXTEsrTTJTV0pkc1Zrem5kZDRiTWNpZnB4Mkl4NzljTkVFblovZC9mSFJsNXFBL2J0cU9EWjZOUwpuK3ZEcHUxcDlPeVhJekUvc3lkKzJmcjA2dkVvRDNaL1BzNHRaZmZ6cWZ1ZDJhWitic2N4V3pwNW1NVThITC9FN2FCaERuV0VtZGZ0CnFXRzhoUTlFMjNaMEVzMW1BOFJzWlRPc3YzNWFkMFZscVk4anc0LytteDhpcU5PMEl4M3JZKy9wcjh4WmFrNTRhT0NZZ2RPckJxYXoKYXRkd2VESWJyQ1RtS1hzODdMRWU2K3VCVmJBeVowT2dCL0NCZG5RdzJLTU1raXZwMG5oUUF4K0xmMjlWZXJkZGs1T1Q3QnNFdnVBaQo5bSthb041ci9XUXFkeWxmc1A0cFh5emxwcm4xdEg4OFU1NnRkR3UyYkJaSzFjdE04SDMrR1p4NmExVUJOZWRWK29yWldkbkMvQlJjCngycHhoaWhtcHZnK2h6dDczTStpa0xZRWhWNXdrV2Q5L2krL0FNWFk5N2U5V3B5L2pGTm5maEFsaTRITVp1UGlwYUJxMDlqTGVReTUKZ1gxbEdhWWU3dzAxbmNYQWV0aXRlOG9NL3YrclMrRlJMc0xFYnJUUlJ1NXp3T1pMNUkvQVdsaVJYUDU1NkJVZmhEemFTM2lVUFYxRApnMzF5Tnp2UUlMUkpNbHM1S0lqNnNnbVYwYVhhRWwxNVd6M2RGaDFvRUhxT1pnNmtmcC8rcGI4K3dKcjQrU2U0Z1FhaEY0enJ3RlY1CnZ3SSs1RGR0VHg5QmFid3JnZjlRQ3JwZy9BSzZ6cWRGWWo4TUVQWmdkeVp3WktRQkZUNVh4U3A1dGFmbmlzVU14anJ6STRZWnc2R24KME1mU2xHV3VWRllBaEk0MU9OQjdhS1RrQWw3M2FzZk5meG1YMmNwbUFNTnJqek9IVjBqQkpieU9IYUZlalo3RG1rSjZydXpyVFdocwoyUlJRN3RVOG81SnR3NjdKcUgxVmh6NEdqUDA0SzQxQjBOVElxRU9sMXExalA5Q09nTWM2NDAzOWc5UDdNaFZyYWJGNTUxOEozUkZvCjRNMkZvK0NpUUdub1p2dVdhZHkyUHFZSDdPZGQ2QmZJSzlWQTMzQnYvR3U1VzVaSWl0SGRyS2t4Y2VpYnJFRFhrSXZvVUx1akRuUngKc3pqMExVNmdiODFEbDVHaGR2MEp1dVJWSExyZUNNc2tOcHk4dlFaZHRrNWkvTGdCamI3VmtJZHU5S3RZNnE3bHNLZWdWcVV3TXZaRApEVy9TRUlldTVlemIzc0d1clU0V29BdnpGRWJqb2Y2SlB1aDVBMDVqOWFsSnpPMlI3YnV4MndGZXVpOFBiZmRadjhHdXJSc0c1dXZyCnBCYzlqNDZ3bEVCWE5xeTdMbUdYV3BuK2hoRDBhNHc4aGtNWDBlazlDeHA4VWl0M0RRUHJzOGptYldjeWZJY2RERDEvandIOUNYYnAKQ2pyay9pM0pZV1V5ZkRFUkRyMkpRLzhPdk5TQy9qMXlYZTBQTlBUcmpNMW1NSFQxVXh3YXpHT1YreUQwSDJrT0szMlBLNEEyd0dIVApCa2hTYWZoMHhNWFFhY3l3SnhLQVdYNCtORGlCc29HUHNERG8rcDhRa0FuR3Zpc0dOSlpvYldpd3g4S2dNV2JqZ2dyb0JXTVpoa1puCkVoRm9rTms0eWxoUXhJQTJzTWxOV2VqUC9neUNqQ3FDeHV5SlpQT3Uvd1ZlMnpIS09QSUFocmF1eGV3Skk1RVZER00xK0g5cm4vMFYKV3RmaEtLc0lHck1uRzR3M0d5Vmo3VUhBUXpPYnorRXJlQlJDWS9hRVlVNHNlMkxGY25xdWFKYmIvN0g4b0xqRlhxdWxDaHF6Snd3YgphdW1xTi8rMU1MM1owSUovazZibkJoVkFOeWJ4SVh1eXdaenpYbHdpbjl5RlMrWXRiZENRUGJHaE9XKy9MSm56d2R6VFczbTc3ZC9YCkJnM1pFOFlrUXB0bThwZXFuZVJUMC9hS1NqZk4xVzVRSUNxZ1AyOWNqZGdUR3hyUFpKMHFtNlpaeU9kTmM2YmMrUjgxTXJHcGdIWmUKUENQMnhJYVdlNUhsaW55a0ZVSWo5bVFEdlpDam14cWhFWHZTZ0VaSDFLRG8xcTBFdXRDNEdyRW5EV2p3dFE0cXVuVXJnWGJmTVFEUAphZ1BhK0pza2MyMk9CbEVJRFhUQURyUm9LZ01DclFUNmpuTTVZRThjYU9QdmNzeElvSlZBdXhZWnNDY3V0T0JUalFSYUpUUmdUMXhvCnVRUU9wRzdGMEhUOFBHandkUzJ0MnhDSUNtalArOUt1b3dtOXhscUFGcWhiMkZ5Q0N1aDU5M3JhbmpTaFJaWkpWaDZDVTBZcW9XbDcKMG9LVzZLeHJINElnS3FCejNnL0kvcmNOV3NDQ2I2QWdLcUNiUzExSWU5SlJ6YmpVTUxOYWFITHBRR2M5NDFIanpHcWgvOEdzNkQragpJOVBUSllxaFd3YUJTc25kMFltOFJlbmhKb05aQ1hTcjQ2RHNTVStUWEgwUWlYbUY4WHBET1RSbHRIeWV3emwrc0djNVRWczk5TC80CjBNWXljMDY0Y3BQMVNrY1ZkT3NYbEQzeHo3Z3M3QUw3cFk1cWFNcWVCSFV6eTNtc2tjL2VZMGM1QVdnaVppRjk2MmFlR29PVWk2eVUKblJ3MFlVL0NEY1Z5cnZUQUxQdjhyRHlUTC9KZXprYUhIaGg5QWIxVDlBWDBUaEVIdXN5Ui95Mm10MHI1d2t6WlRzbmw4b3haS0FWYgppNm5wcldMZTlMbXo5YlBpcFdxTTVLMW16VW1sZDB1NEJWRXRtajJqcnFDNStlb1ZreHFoelJUSmZUbEpRM2VOQWFhMi9DRjhOeFJOClhTbGpoU3plNUkydVZFTjNOTnRxTVNoczlkNVdXbVVOT0ZhaWhGc1I5R0xiejZvaG8rcTczV1h3QjlUTXNiUkM2TmFPc09WUWlxNkYKUU9qcFZKMWlOM0pGME0zOFJCeEYxR20rbzg0V1hadkhJUlJDdTMvN1pXSytxSlpydi8rL295SGJvcmROcTRkMkZsVVpWYXF4dHI5awp2TXlkTWVuUVI1d21yZ2JhZVMxUEw0dGJiMk8rSG9mWmF1SzZsejQ3TTkvQWlSYXQweXBXWXpLenFOVkFnOHl0MThtWEJaYWQ0TlJLCm9HMFBpaXo1Ykw2V21Md2VuNWxCclFUYVlwbEdydk5NNkNUeldNRWdJVWMyS1lPZVJnNmZxN1JNYUl5K3FsUHZZU0NLbGo1ank0WGMKcFVBaXF4QWFvZzlFVUFhZFJ6ZmdPYzFSY3UwY3R1aEVCZlFjMXJnOUV5cld1RzFCRFZ6SnV5elFXemttZEZWMHZUZlV3QlZBZnc1dQp0SFJNS0hjUEJ5WG8wRDE1NkRzb1J0MitLWG9xMXl6WUlKQlFLNENHYy9GZFRxRHo2UDVFSU5TcXBvc1EyVE1JYU9xdTVkQW1VYWNUCnVFYm9oZ2xGNDFlYmZoZHRRZlF5STUzUVZjYWk1enJlbmE5dloyaTdIY0k3TFcvQnA4QUFxVXdqdEIwUmVDUHhDcU52STl1M1J1Z1YKVGllOWdoOGtRT2R2amRDMzhUTjhHanZNWUdneWYrdUR0bDlqNFp1bmJ6TE9uQ1QzTkdpRXJuTDJiakJPVDNET2R0dWUwTFlKeFk5Ngo1a0NUT3puMFFkc21GRDhqbW5IS0ViM0ZWQiswYlVMeFRUb3NhQ3A5NjRObUhRMWdQNlk0OUYwQ1JCOTBUaDAwdFExUEUvVHN6SU9GCkhRTnRMM0RjeWkyNDdtSEFvV2ZOZk1tQzdicWhLdWh0a3NnS3ZqZGtRTi9vUTJqN0tUYUxwYTNxZEljdlZ0UlBVNmU3SkovSUxQcTgKVFcvZkVUZFpuUE9zdHE4ajQ1d0RYR0Y2YjJvamkxNUhwbWlVUlUyZDZJTmVOeml2c1FabFBGM2xwTy83REdqS2hlcWNPV0VkVWNXWgpJeVBQOGRFN1I3Ynpaa1B0UncrZTkxN25YTHFOb1J0dmF0SDJYVitBMzNEb09hVUtsZTBoMWtDVVdnNTlFb0RYbGpxaDdjRVFuSjVLCnFDSFRja3JWOWYrZzBJMnp1RkZIdlhnZHUwN1BLVlVsZENHQ1l4ZUZUeVBUZEVwVkNWeFBWWEdIZ0ZJZkNIUC9rSHBPcVNxQjM4dW8KZUoyTDFMbEZEWkZuaHFxQy9oVHRYSnhFdXlhNHZBZzZzbDhKdElGNkovZWxxdURKaXRoaEowcWcwYzl3ZVBNNllnMGNYQkdyQkJvOAp2TDQ1Q0p5VU9aZ0xYdnVzQmhvOWtNZDd2eWl6YWhBOW1Vc1JOTnkrUFo4c1FWMkRqMGhRQXcxMzFldmV2ZU5UdzZlUktZTkd1K3BXCkZ4T1grdUYvY1JCRjBPZ1hoZG9tTHVOUlgrT2M4WklWL3c2SHN4a09iZDl0bmN4YWpQWEFuN0MyVzJiRW9aMk5hR2dxVzIrZnVmeGYKMUgwTjJNbVpUUjJGUCtXSlFqc2JhbEVyMmpua1g0VzlYRWVZdVNmYm5NSS9kc2lDaGwxV1Y1RDRKM094RCtZeWpKZkZ2NHptUXFQdAp1MmVTbW9jZDVjaW03RS94RDVqeW9OR1BvL204anBpRGQ4dWJqNkljZ21GL1YxNzRFNDhlTkdoRmZWZTZMYytSaDE5WXhQZWlIUU5oCkplOFUvajA0SGpUYVZRZk4yRzQrS3BvQnAyQ1VaL0tQTnFNZmRETEIrUHkwSGkzMEtNNnhMcmFzUnpxVk9nYTM3OEZRcHZIOWFielQKR2doTk5LRHhiNWdPZ3R4dnlqTStlRGdBdXVBdzc2aFFlNEZPcFM3b3JrcHltdkNZVTJNN0pvRm5tb0ZPcFU3cnJreEN5cDVPdFdtSAo1TEkzMnBsVHg1N1VYWjhrZFBGUUIzVHEzQTU0ckROZHpEdWgzOHFlUy9Yb2pPNUtxV1kra2ZKUmVxQmJlQ2FkOHRYWUFHZXppK2RTCkFSb2JXR3QyYWlnVnJOTUQyY1F6cDFPaEdvTm5qL3BIYnh4S1VYcmxUZDJWbE5XYmFSTFppZmJBTlBKWG44S1FiUTJkZVN1VHplcXUKY1R4bHM1bUp0NGRnWkVmbnpyeHo2bWNXZWovcTRzVzMzbms3c0pOSy9SOXZRRFNYcURYRjdRQUFBQ1YwUlZoMFpHRjBaVHBqY21WaApkR1VBTWpBeU1pMHdOaTB5T0ZRd05Eb3lNRG96T0Nzd01qb3dNSmVEK2JFQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNakl0Ck1EWXRNamhVTURRNk1qQTZNemdyTURJNk1ERG0za0VOQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.neko)!=null&&n.isNeko?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.neko;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const A4="Nightly";class D4 extends Xn{constructor(){super(),this.name=A4,this.url="https://nightly.app",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQ4IDk2Qzc0LjUwOTcgOTYgOTYgNzQuNTA5NyA5NiA0OEM5NiAyMS40OTAzIDc0LjUwOTcgMCA0OCAwQzIxLjQ5MDMgMCAwIDIxLjQ5MDMgMCA0OEMwIDc0LjUwOTcgMjEuNDkwMyA5NiA0OCA5NloiIGZpbGw9IiM2RDczRjgiLz4KPHBhdGggZD0iTTQ4IDg1LjYzNTZDNDggODUuNjM1NiA1Mi40NTMzIDg1LjYzNTYgNTUuNDQgODIuNTg2N0M1OC45MTU1IDc5LjI4MDEgNTcuMzUxMSA3NS40MzEyIDYyLjI3NTUgNzEuNDMxMkM2Ni45ODY2IDY3LjY0NDUgNzIuOTI0NCA3MC4zMzc5IDcyLjkyNDQgNzAuMzM3OUM3Ny4wMjIyIDYyLjEyNDUgNzQuNzkxMSA1Mi41NjkgNzQuNzkxMSA1Mi41NjlDODEuNzY4OCAzNC4yNTc5IDc1Ljk2NDQgMjEuMTU1NyA3NC40NDQ0IDE3LjM2MDFDNjkuNDQ4OCAyNC4zMzc5IDYzLjE5MTEgMjkuMTczNCA1NS43OTU1IDMyLjQwOUM1My4yMjY2IDMxLjcwNjggNTAuNTk1NSAzMS4zMzM0IDQ4IDMxLjM2MDFDNDUuNDEzMyAzMS4zMzM0IDQyLjc3MzMgMzEuNzA2OCA0MC4yMDQ0IDMyLjQwOUMzMi44MTc3IDI5LjE2NDUgMjYuNTUxMSAyNC4zMzc5IDIxLjU1NTUgMTcuMzYwMUMyMC4wMzU1IDIxLjE1NTcgMTQuMjMxMSAzNC4yNTc5IDIxLjIwODkgNTIuNTY5QzIxLjIwODkgNTIuNTY5IDE4Ljk3NzggNjIuMTI0NSAyMy4wNzU1IDcwLjMzNzlDMjMuMDc1NSA3MC4zMzc5IDI5LjAxMzMgNjcuNjQ0NSAzMy43MjQ0IDcxLjQzMTJDMzguNjU3NyA3NS40MzEyIDM3LjA4NDQgNzkuMjgwMSA0MC41NiA4Mi41ODY3QzQzLjU0NjYgODUuNjM1NiA0OCA4NS42MzU2IDQ4IDg1LjYzNTZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNDIuNDc5OSA2NS4yOThDNDIuMjkzMyA1OS4yMTggMzYuMzAyMSA1Ny4yNjI0IDMyLjIxMzMgNTkuODIyNEMzMi4yMTMzIDU5LjgyMjQgMzIuODUzMyA2Mi40MzU4IDM1LjgzOTkgNjMuNzUxM0MzOC4yNzU1IDY0LjgyNjkgMzkuMzI0NCA2My4zODY5IDQyLjQ3OTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNMjIuNDk3NyAyMy4wOTM1QzIwLjA4ODggMzEuNTQ2OCAyMS4xMjg4IDQyLjI0MDIgMjQuOTMzMyA1MC4wMjY5QzI4LjgyNjYgNDcuMjcxMyAzMi45MTU1IDQzLjAxMzUgMzUuMDkzMyAzOC41MDY5QzI5Ljk2NDQgMzQuNzExMyAyNS42NjIyIDMxLjEwMjQgMjIuNDk3NyAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNTMuNTE5OSA2NS4yOThDNTMuNzA2NiA1OS4yMTggNTkuNjk3NyA1Ny4yNjI0IDYzLjc4NjYgNTkuODIyNEM2My43ODY2IDU5LjgyMjQgNjMuMTQ2NiA2Mi40MzU4IDYwLjE1OTkgNjMuNzUxM0M1Ny43MjQzIDY0LjgyNjkgNTYuNjc1NSA2My4zODY5IDUzLjUxOTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNzMuNTAyMiAyMy4wOTM1Qzc1LjkxMTEgMzEuNTQ2OCA3NC44NzExIDQyLjI0MDIgNzEuMDY2NiA1MC4wMjY5QzY3LjE3MzMgNDcuMjcxMyA2My4wODQ0IDQzLjAxMzUgNjAuOTA2NiAzOC41MDY5QzY2LjAzNTUgMzQuNzExMyA3MC4zMzc3IDMxLjEwMjQgNzMuNTAyMiAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNDcuOTk5OSA4NS4zMDY5QzUwLjE0MDQgODUuMzA2OSA1MS44NzU1IDgzLjc3ODcgNTEuODc1NSA4MS44OTM2QzUxLjg3NTUgODAuMDA4NCA1MC4xNDA0IDc4LjQ4MDIgNDcuOTk5OSA3OC40ODAyQzQ1Ljg1OTUgNzguNDgwMiA0NC4xMjQ0IDgwLjAwODQgNDQuMTI0NCA4MS44OTM2QzQ0LjEyNDQgODMuNzc4NyA0NS44NTk1IDg1LjMwNjkgNDcuOTk5OSA4NS4zMDY5WiIgZmlsbD0iIzdCODFGOSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._publicKey=null,this._wallet=null,this._readyState!==$.Unsupported&&cr(()=>{var e;return(e=window==null?void 0:window.nightly)!=null&&e.solana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get connecting(){return this._connecting}get readyState(){return this._readyState}get publicKey(){return this._publicKey}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.nightly.solana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(e.publicKey.toString()==="11111111111111111111111111111111")throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch{this.emit("error",new Vr)}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return n.signMessage(new TextDecoder().decode(e))}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const L4="Salmon";class z4 extends Xn{constructor({network:e=Vf.Mainnet}={}){super(),this.name=L4,this.url="https://salmonwallet.io",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iODgiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4OCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijg4IiBoZWlnaHQ9Ijg4IiByeD0iMzAiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl84NTVfNTgwKSIvPgo8cGF0aCBkPSJNNTkuODA1NSAyNy42M0M1Ni43OTU1IDI1LjgyMzkgNTMuNjIyMiAyNC41Mzg4IDUwLjM1OTcgMjMuODE0NEw0Ni45MDQyIDE2LjEyODdDNDYuNDkzMyAxNC44NTg1IDQ1LjMwMDIgMTQuMDAwMSA0My45NTM3IDE0LjAwMDFINDMuODE1QzQyLjQ2ODUgMTQuMDAwMSA0MS4yNzU0IDE0Ljg2MzUgNDAuODY0NSAxNi4xMjg3TDM3LjQwOSAyMy44MDk1QzM0LjE0MTYgMjQuNTM4OCAzMC45NTgzIDI1LjgyODkgMjcuOTQzNCAyNy42MzQ5QzIxLjk1MzIgMzkuMjYwMyAyMC4zMjk0IDUwLjU5MjggMjEuMTQxMyA2MS43NjY2QzI0LjY1MTMgNjUuMTY1NCAzMi40MzM2IDY5LjM2OCAzNi42MDcgNzEuMDMwMkMzOS4wNTI2IDcyLjAwMjcgMzkuODAwMSA3Mi40OTM5IDQyLjI1MDYgNzIuOTAwN0M0NC40Mjg5IDczLjUxNiA0NS4wODczIDczLjI3NzggNDYuNzU1NyA3My4xMDQyQzQ5LjMyNTEgNzIuNDE5NSA1MC4zOTQ0IDcxLjcyNDggNTEuNDM0IDcxLjE2NDFDNTUuODQ5OSA2OC44NzY4IDYzLjExNzQgNjUuMTcwNCA2Ni42Mjc0IDYxLjc3MTZDNjcuNTc3OSA0OC44MTE2IDY0Ljk5ODYgMzcuNTgzMiA1OS44MDU1IDI3LjYyNVYyNy42M1pNMzcuNTI3OCA1MS4xNDg1QzM1LjY0MTYgNTEuMTQ4NSAzNC4wODIyIDQ4LjkwMDkgMzQuMDgyMiA0Ni4xMzIyQzM0LjA4MjIgNDMuMzYzNiAzNS41ODcxIDQxLjA5NjEgMzcuNTE3OSA0MS4wOTYxQzM5LjQ0ODYgNDEuMDk2MSA0MC45OTgxIDQzLjM2MzYgNDAuOTYzNSA0Ni4xMzIyQzQwLjkyODggNDguOTAwOSAzOS40NDM3IDUxLjE0ODUgMzcuNTIyOCA1MS4xNDg1SDM3LjUyNzhaTTUwLjIzMSA1MS4xNDg1QzQ4LjMzOTkgNTEuMTQ4NSA0Ni43OTAzIDQ4LjkwMDkgNDYuNzkwMyA0Ni4xMzIyQzQ2Ljc5MDMgNDMuMzYzNiA0OC4yOTUzIDQxLjA5NjEgNTAuMjMxIDQxLjA5NjFDNTIuMTY2NyA0MS4wOTYxIDUzLjcwMTQgNDMuMzYzNiA1My42NjY3IDQ2LjEzMjJDNTMuNjMyMSA0OC45MDA5IDUyLjE1MTggNTEuMTQ4NSA1MC4yMzEgNTEuMTQ4NVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTc1LjQwNTEgNTYuMTIwM0w3MC45NzkzIDQyLjE3MjlDNzAuNDM0NyA0MC40NjYxIDY4Ljg1NTUgMzkuMzA1MSA2Ny4wNjMzIDM5LjMwNTFDNjYuNTI4NyAzOS4zMDUxIDY2LjAwODkgMzkuNDA5MiA2NS41Mjg3IDM5LjYwMjhDNjcuNTQ4NSA0Ni4zMjU5IDY4LjM2MDQgNTMuNTc5OSA2Ny43MjY3IDYxLjQ4NEg3MS40ODQyQzc0LjI2NjUgNjEuNDg0IDc2LjI0MTcgNTguNzc0OSA3NS40MDAxIDU2LjEyMDNINzUuNDA1MVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTEyLjE5MDggNTYuMzgzNUwxNi42MTY2IDQyLjQzNjFDMTcuMTYxMiA0MC43MjkyIDE4Ljc0MDUgMzkuNTY4MiAyMC41MzI2IDM5LjU2ODJDMjEuMDY3MiAzOS41NjgyIDIxLjU4NyAzOS42NzI0IDIyLjA2NzMgMzkuODY1OUMyMC4wNDc0IDQ2LjU4OSAxOS4yMzU1IDUzLjg0MzEgMTkuODY5MiA2MS43NDcxSDE2LjExMTdDMTMuMzI5NSA2MS43NDcxIDExLjM1NDIgNTkuMDM4IDEyLjE5NTggNTYuMzgzNUgxMi4xOTA4WiIgZmlsbD0iI0ZDRkNGQyIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzg1NV81ODAiIHgxPSI0NCIgeTE9IjAiIHgyPSI0NCIgeTI9Ijg4IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNGRjgxNzAiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY1QzQ1Ii8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._network=e,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window.salmon?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./index-6fefd1d6.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new qt;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const j4="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjMxIiB2aWV3Qm94PSIwIDAgMzEgMzEiIHdpZHRoPSIzMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjIwLjI1IiB4Mj0iMjYuNTcxIiB5MT0iMjcuMTczIiB5Mj0iMTkuODU4Ij48c3RvcCBvZmZzZXQ9Ii4wOCIgc3RvcC1jb2xvcj0iIzk5NDVmZiIvPjxzdG9wIG9mZnNldD0iLjMiIHN0b3AtY29sb3I9IiM4NzUyZjMiLz48c3RvcCBvZmZzZXQ9Ii41IiBzdG9wLWNvbG9yPSIjNTQ5N2Q1Ii8+PHN0b3Agb2Zmc2V0PSIuNiIgc3RvcC1jb2xvcj0iIzQzYjRjYSIvPjxzdG9wIG9mZnNldD0iLjcyIiBzdG9wLWNvbG9yPSIjMjhlMGI5Ii8+PHN0b3Agb2Zmc2V0PSIuOTciIHN0b3AtY29sb3I9IiMxOWZiOWIiLz48L2xpbmVhckdyYWRpZW50PjxnIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iLjA5NCI+PHBhdGggZD0ibTI2LjEwOSAzLjY0My05LjM2OSA2Ljk1OSAxLjczMy00LjEwNSA3LjYzNy0yLjg1M3oiIGZpbGw9IiNlMjc2MWIiIHN0cm9rZT0iI2UyNzYxYiIvPjxnIGZpbGw9IiNlNDc2MWIiIHN0cm9rZT0iI2U0NzYxYiI+PHBhdGggZD0ibTQuNDgxIDMuNjQzIDkuMjk0IDcuMDI0LTEuNjQ4LTQuMTcxem0xOC4yNTggMTYuMTMtMi40OTUgMy44MjMgNS4zMzkgMS40NjkgMS41MzUtNS4yMDctNC4zNzgtLjA4NXptLTE5LjI0Ny4wODUgMS41MjUgNS4yMDcgNS4zMzktMS40NjktMi40OTUtMy44MjN6Ii8+PHBhdGggZD0ibTEwLjA1NSAxMy4zMTMtMS40ODggMi4yNTEgNS4zMDEuMjM1LS4xODgtNS42OTd6bTEwLjQ4IDAtMy42NzItMy4yNzctLjEyMiA1Ljc2MyA1LjI5Mi0uMjM1LTEuNDk3LTIuMjUxem0tMTAuMTc4IDEwLjI4MyAzLjE4My0xLjU1NC0yLjc0OS0yLjE0Ny0uNDMzIDMuNzAxem02LjY5NS0xLjU1NCAzLjE5MiAxLjU1NC0uNDQzLTMuNzAxeiIvPjwvZz48cGF0aCBkPSJtMjAuMjQ0IDIzLjU5Ni0zLjE5Mi0xLjU1NC4yNTQgMi4wODEtLjAyOC44NzZ6bS05Ljg4NyAwIDIuOTY2IDEuNDAzLS4wMTktLjg3Ni4yMzUtMi4wODEtMy4xODMgMS41NTR6IiBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiLz48cGF0aCBkPSJtMTMuMzY5IDE4LjUyMS0yLjY1NS0uNzgxIDEuODc0LS44NTd6bTMuODUxIDAgLjc4MS0xLjYzOCAxLjg4My44NTctMi42NjUuNzgxeiIgZmlsbD0iIzIzMzQ0NyIgc3Ryb2tlPSIjMjMzNDQ3Ii8+PHBhdGggZD0ibTEwLjM1NyAyMy41OTYuNDUyLTMuODIzLTIuOTQ3LjA4NXptOS40MzUtMy44MjMuNDUyIDMuODIzIDIuNDk1LTMuNzM4em0yLjI0MS00LjIwOS01LjI5Mi4yMzUuNDkgMi43MjEuNzgyLTEuNjM4IDEuODgzLjg1N3ptLTExLjMxOCAyLjE3NSAxLjg4My0uODU3Ljc3MiAxLjYzOC40OTktMi43MjEtNS4zMDEtLjIzNXoiIGZpbGw9IiNjZDYxMTYiIHN0cm9rZT0iI2NkNjExNiIvPjxwYXRoIGQ9Im04LjU2NyAxNS41NjQgMi4yMjIgNC4zMzEtLjA3NS0yLjE1NnptMTEuMzI4IDIuMTc1LS4wOTQgMi4xNTYgMi4yMzItNC4zMzEtMi4xMzcgMi4xNzV6bS02LjAyNi0xLjk0LS40OTkgMi43MjEuNjIxIDMuMjExLjE0MS00LjIyOC0uMjY0LTEuNzA0em0yLjg3MiAwLS4yNTQgMS42OTUuMTEzIDQuMjM3LjYzMS0zLjIxMXoiIGZpbGw9IiNlNDc1MWYiIHN0cm9rZT0iI2U0NzUxZiIvPjxwYXRoIGQ9Im0xNy4yMyAxOC41Mi0uNjMxIDMuMjExLjQ1Mi4zMTEgMi43NS0yLjE0Ny4wOTQtMi4xNTZ6bS02LjUxNi0uNzgxLjA3NSAyLjE1NiAyLjc1IDIuMTQ3LjQ1Mi0uMzExLS42MjItMy4yMTF6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48cGF0aCBkPSJtMTcuMjc3IDI0Ljk5OS4wMjgtLjg3Ni0uMjM1LS4yMDdoLTMuNTVsLS4yMTcuMjA3LjAxOS44NzYtMi45NjYtMS40MDMgMS4wMzYuODQ4IDIuMSAxLjQ1OWgzLjYwNmwyLjEwOS0xLjQ1OSAxLjAzNi0uODQ4eiIgZmlsbD0iI2MwYWQ5ZSIgc3Ryb2tlPSIjYzBhZDllIi8+PHBhdGggZD0ibTE3LjA1MSAyMi4wNDItLjQ1Mi0uMzExaC0yLjYwOGwtLjQ1Mi4zMTEtLjIzNSAyLjA4MS4yMTctLjIwN2gzLjU1bC4yMzUuMjA3LS4yNTQtMi4wODF6IiBmaWxsPSIjMTYxNjE2IiBzdHJva2U9IiMxNjE2MTYiLz48cGF0aCBkPSJtMjYuNTA1IDExLjA1My44LTMuODQyLTEuMTk2LTMuNTY5LTkuMDU4IDYuNzIzIDMuNDg0IDIuOTQ3IDQuOTI1IDEuNDQxIDEuMDkyLTEuMjcxLS40NzEtLjMzOS43NTMtLjY4Ny0uNTg0LS40NTIuNzUzLS41NzQtLjQ5OS0uMzc3em0tMjMuMjExLTMuODQxLjggMy44NDItLjUwOC4zNzcuNzUzLjU3NC0uNTc0LjQ1Mi43NTMuNjg3LS40NzEuMzM5IDEuMDgzIDEuMjcxIDQuOTI1LTEuNDQxIDMuNDg0LTIuOTQ3LTkuMDU5LTYuNzIzeiIgZmlsbD0iIzc2M2QxNiIgc3Ryb2tlPSIjNzYzZDE2Ii8+PHBhdGggZD0ibTI1LjQ2IDE0Ljc1NC00LjkyNS0xLjQ0MSAxLjQ5NyAyLjI1MS0yLjIzMiA0LjMzMSAyLjkzOC0uMDM4aDQuMzc4bC0xLjY1Ny01LjEwNHptLTE1LjQwNS0xLjQ0MS00LjkyNSAxLjQ0MS0xLjYzOCA1LjEwNGg0LjM2OWwyLjkyOC4wMzgtMi4yMjItNC4zMzEgMS40ODgtMi4yNTF6bTYuNjg1IDIuNDg2LjMxMS01LjQzMyAxLjQzMS0zLjg3aC02LjM1NmwxLjQxMyAzLjg3LjMyOSA1LjQzMy4xMTMgMS43MTQuMDA5IDQuMjE5aDIuNjFsLjAxOS00LjIxOS4xMjItMS43MTR6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48L2c+PGNpcmNsZSBjeD0iMjMuNSIgY3k9IjIzLjUiIGZpbGw9IiMwMDAiIHI9IjYuNSIvPjxwYXRoIGQ9Im0yNy40NzMgMjUuNTQ1LTEuMzEgMS4zNjhjLS4wMjkuMDMtLjA2My4wNTMtLjEwMS4wN2EuMzEuMzEgMCAwIDEgLS4xMjEuMDI0aC02LjIwOWMtLjAzIDAtLjA1OS0uMDA4LS4wODMtLjAyNGEuMTUuMTUgMCAwIDEgLS4wNTYtLjA2NWMtLjAxMi0uMDI2LS4wMTUtLjA1Ni0uMDEtLjA4NHMuMDE4LS4wNTUuMDM5LS4wNzZsMS4zMTEtMS4zNjhjLjAyOC0uMDMuMDYzLS4wNTMuMTAxLS4wNjlhLjMxLjMxIDAgMCAxIC4xMjEtLjAyNWg2LjIwOGMuMDMgMCAuMDU5LjAwOC4wODMuMDI0YS4xNS4xNSAwIDAgMSAuMDU2LjA2NWMuMDEyLjAyNi4wMTUuMDU2LjAxLjA4NHMtLjAxOC4wNTUtLjAzOS4wNzZ6bS0xLjMxLTIuNzU2Yy0uMDI5LS4wMy0uMDYzLS4wNTMtLjEwMS0uMDdhLjMxLjMxIDAgMCAwIC0uMTIxLS4wMjRoLTYuMjA5Yy0uMDMgMC0uMDU5LjAwOC0uMDgzLjAyNHMtLjA0NC4wMzgtLjA1Ni4wNjUtLjAxNS4wNTYtLjAxLjA4NC4wMTguMDU1LjAzOS4wNzZsMS4zMTEgMS4zNjhjLjAyOC4wMy4wNjMuMDUzLjEwMS4wNjlhLjMxLjMxIDAgMCAwIC4xMjEuMDI1aDYuMjA4Yy4wMyAwIC4wNTktLjAwOC4wODMtLjAyNGEuMTUuMTUgMCAwIDAgLjA1Ni0uMDY1Yy4wMTItLjAyNi4wMTUtLjA1Ni4wMS0uMDg0cy0uMDE4LS4wNTUtLjAzOS0uMDc2em0tNi40MzEtLjk4M2g2LjIwOWEuMzEuMzEgMCAwIDAgLjEyMS0uMDI0Yy4wMzgtLjAxNi4wNzMtLjA0LjEwMS0uMDdsMS4zMS0xLjM2OGMuMDItLjAyMS4wMzQtLjA0Ny4wMzktLjA3NnMuMDAxLS4wNTgtLjAxLS4wODRhLjE1LjE1IDAgMCAwIC0uMDU2LS4wNjVjLS4wMjUtLjAxNi0uMDU0LS4wMjQtLjA4My0uMDI0aC02LjIwOGEuMzEuMzEgMCAwIDAgLS4xMjEuMDI1Yy0uMDM4LjAxNi0uMDcyLjA0LS4xMDEuMDY5bC0xLjMxIDEuMzY4Yy0uMDIuMDIxLS4wMzQuMDQ3LS4wMzkuMDc2cy0uMDAxLjA1OC4wMS4wODQuMDMxLjA0OS4wNTYuMDY1LjA1NC4wMjQuMDgzLjAyNHoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4=";var Qe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},U4=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},jl,ao,Kf,Jf,Xf,Mn,qf,zM,jM,$f,eh,th,nh,rh;class _4{constructor(){jl.add(this),ao.set(this,{}),Kf.set(this,"1.0.0"),Jf.set(this,"MetaMask"),Xf.set(this,j4),Mn.set(this,null),qf.set(this,(e,n)=>{var r;return(r=Qe(this,ao,"f")[e])!=null&&r.push(n)||(Qe(this,ao,"f")[e]=[n]),()=>Qe(this,jl,"m",jM).call(this,e,n)}),$f.set(this,async()=>{if(!Qe(this,Mn,"f")){let e;try{e=(await Ba(()=>import("./index-5930b845.js"),[])).default}catch{throw new Error("Unable to load Solflare MetaMask SDK")}U4(this,Mn,new e,"f"),Qe(this,Mn,"f").on("standard_change",n=>Qe(this,jl,"m",zM).call(this,"change",n))}return this.accounts.length||await Qe(this,Mn,"f").connect(),{accounts:this.accounts}}),eh.set(this,async()=>{Qe(this,Mn,"f")&&await Qe(this,Mn,"f").disconnect()}),th.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignAndSendTransaction(...e)}),nh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignTransaction(...e)}),rh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignMessage(...e)})}get version(){return Qe(this,Kf,"f")}get name(){return Qe(this,Jf,"f")}get icon(){return Qe(this,Xf,"f")}get chains(){return[Qf,DM,LM]}get features(){return{[F0]:{version:"1.0.0",connect:Qe(this,$f,"f")},[Wf]:{version:"1.0.0",disconnect:Qe(this,eh,"f")},[W0]:{version:"1.0.0",on:Qe(this,qf,"f")},[qr]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:Qe(this,th,"f")},[Kt]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:Qe(this,nh,"f")},[Uo]:{version:"1.0.0",signMessage:Qe(this,rh,"f")}}}get accounts(){return Qe(this,Mn,"f")?Qe(this,Mn,"f").standardAccounts:[]}}ao=new WeakMap,Kf=new WeakMap,Jf=new WeakMap,Xf=new WeakMap,Mn=new WeakMap,qf=new WeakMap,$f=new WeakMap,eh=new WeakMap,th=new WeakMap,nh=new WeakMap,rh=new WeakMap,jl=new WeakSet,zM=function(e,...n){var r;(r=Qe(this,ao,"f")[e])==null||r.forEach(i=>i.apply(null,n))},jM=function(e,n){var r;Qe(this,ao,"f")[e]=(r=Qe(this,ao,"f")[e])==null?void 0:r.filter(i=>n!==i)};let hy=!1;function R4(){hy||(_T(new _4),hy=!0)}async function C4(){const t="solflare-detect-metamask";function e(){window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:{id:t,jsonrpc:"2.0",method:"wallet_getSnaps"}}},window.location.origin)}function n(r){var o,s;const i=r.data;(i==null?void 0:i.target)==="metamask-inpage"&&((o=i.data)==null?void 0:o.name)==="metamask-provider"&&(((s=i.data.data)==null?void 0:s.id)===t?(window.removeEventListener("message",n),i.data.data.error||R4()):e())}window.addEventListener("message",n),window.setTimeout(()=>window.removeEventListener("message",n),5e3),e()}const O4="Solflare";class B4 extends Xn{constructor(e={}){super(),this.name=O4,this.url="https://solflare.com",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgNTAgNTAiIHdpZHRoPSI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmMxMGIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmYjNmMmUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iYiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2LjQ3ODM1IiB4Mj0iMzQuOTEwNyIgeGxpbms6aHJlZj0iI2EiIHkxPSI3LjkyIiB5Mj0iMzMuNjU5MyIvPjxyYWRpYWxHcmFkaWVudCBpZD0iYyIgY3g9IjAiIGN5PSIwIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDQuOTkyMTg4MzIgMTIuMDYzODc5NjMgLTEyLjE4MTEzNjU1IDUuMDQwNzEwNzQgMjIuNTIwMiAyMC42MTgzKSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHI9IjEiIHhsaW5rOmhyZWY9IiNhIi8+PHBhdGggZD0ibTI1LjE3MDggNDcuOTEwNGMuNTI1IDAgLjk1MDcuNDIxLjk1MDcuOTQwM3MtLjQyNTcuOTQwMi0uOTUwNy45NDAyLS45NTA3LS40MjA5LS45NTA3LS45NDAyLjQyNTctLjk0MDMuOTUwNy0uOTQwM3ptLTEuMDMyOC00NC45MTU2NWMuNDY0Ni4wMzgzNi44Mzk4LjM5MDQuOTAyNy44NDY4MWwxLjEzMDcgOC4yMTU3NGMuMzc5OCAyLjcxNDMgMy42NTM1IDMuODkwNCA1LjY3NDMgMi4wNDU5bDExLjMyOTEtMTAuMzExNThjLjI3MzMtLjI0ODczLjY5ODktLjIzMTQ5Ljk1MDcuMDM4NTEuMjMwOS4yNDc3Mi4yMzc5LjYyNjk3LjAxNjEuODgyNzdsLTkuODc5MSAxMS4zOTU4Yy0xLjgxODcgMi4wOTQyLS40NzY4IDUuMzY0MyAyLjI5NTYgNS41OTc4bDguNzE2OC44NDAzYy40MzQxLjA0MTguNzUxNy40MjM0LjcwOTMuODUyNC0uMDM0OS4zNTM3LS4zMDc0LjYzOTUtLjY2MjguNjk0OWwtOS4xNTk0IDEuNDMwMmMtMi42NTkzLjM2MjUtMy44NjM2IDMuNTExNy0yLjEzMzkgNS41NTc2bDMuMjIgMy43OTYxYy4yNTk0LjMwNTguMjE4OC43NjE1LS4wOTA4IDEuMDE3OC0uMjYyMi4yMTcyLS42NDE5LjIyNTYtLjkxMzguMDIwM2wtMy45Njk0LTIuOTk3OGMtMi4xNDIxLTEuNjEwOS01LjIyOTctLjI0MTctNS40NTYxIDIuNDI0M2wtLjg3NDcgMTAuMzk3NmMtLjAzNjIuNDI5NS0uNDE3OC43NDg3LS44NTI1LjcxMy0uMzY5LS4wMzAzLS42NjcxLS4zMDk3LS43MTcxLS42NzIxbC0xLjM4NzEtMTAuMDQzN2MtLjM3MTctMi43MTQ0LTMuNjQ1NC0zLjg5MDQtNS42NzQzLTIuMDQ1OWwtMTIuMDUxOTUgMTAuOTc0Yy0uMjQ5NDcuMjI3MS0uNjM4MDkuMjExNC0uODY4LS4wMzUtLjIxMDk0LS4yMjYyLS4yMTczNS0uNTcyNC0uMDE0OTMtLjgwNmwxMC41MTgxOC0xMi4xMzg1YzEuODE4Ny0yLjA5NDIuNDg0OS01LjM2NDQtMi4yODc2LTUuNTk3OGwtOC43MTg3Mi0uODQwNWMtLjQzNDEzLS4wNDE4LS43NTE3Mi0uNDIzNS0uNzA5MzYtLjg1MjQuMDM0OTMtLjM1MzcuMzA3MzktLjYzOTQuNjYyNy0uNjk1bDkuMTUzMzgtMS40Mjk5YzIuNjU5NC0uMzYyNSAzLjg3MTgtMy41MTE3IDIuMTQyMS01LjU1NzZsLTIuMTkyLTIuNTg0MWMtLjMyMTctLjM3OTItLjI3MTMtLjk0NDMuMTEyNi0xLjI2MjEuMzI1My0uMjY5NC43OTYzLS4yNzk3IDEuMTMzNC0uMDI0OWwyLjY5MTggMi4wMzQ3YzIuMTQyMSAxLjYxMDkgNS4yMjk3LjI0MTcgNS40NTYxLTIuNDI0M2wuNzI0MS04LjU1OTk4Yy4wNDU3LS41NDA4LjUyNjUtLjk0MjU3IDEuMDczOS0uODk3Mzd6bS0yMy4xODczMyAyMC40Mzk2NWMuNTI1MDQgMCAuOTUwNjcuNDIxLjk1MDY3Ljk0MDNzLS40MjU2My45NDAzLS45NTA2Ny45NDAzYy0uNTI1MDQxIDAtLjk1MDY3LS40MjEtLjk1MDY3LS45NDAzcy40MjU2MjktLjk0MDMuOTUwNjctLjk0MDN6bTQ3LjY3OTczLS45NTQ3Yy41MjUgMCAuOTUwNy40MjEuOTUwNy45NDAzcy0uNDI1Ny45NDAyLS45NTA3Ljk0MDItLjk1MDctLjQyMDktLjk1MDctLjk0MDIuNDI1Ny0uOTQwMy45NTA3LS45NDAzem0tMjQuNjI5Ni0yMi40Nzk3Yy41MjUgMCAuOTUwNi40MjA5NzMuOTUwNi45NDAyNyAwIC41MTkzLS40MjU2Ljk0MDI3LS45NTA2Ljk0MDI3LS41MjUxIDAtLjk1MDctLjQyMDk3LS45NTA3LS45NDAyNyAwLS41MTkyOTcuNDI1Ni0uOTQwMjcuOTUwNy0uOTQwMjd6IiBmaWxsPSJ1cmwoI2IpIi8+PHBhdGggZD0ibTI0LjU3MSAzMi43NzkyYzQuOTU5NiAwIDguOTgwMi0zLjk3NjUgOC45ODAyLTguODgxOSAwLTQuOTA1My00LjAyMDYtOC44ODE5LTguOTgwMi04Ljg4MTlzLTguOTgwMiAzLjk3NjYtOC45ODAyIDguODgxOWMwIDQuOTA1NCA0LjAyMDYgOC44ODE5IDguOTgwMiA4Ljg4MTl6IiBmaWxsPSJ1cmwoI2MpIi8+PC9zdmc+",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._accountChanged=n=>{if(!n)return;const r=this._publicKey;if(r){try{n=new X(n.toBytes())}catch(i){this.emit("error",new Sn(i==null?void 0:i.message,i));return}r.equals(n)||(this._publicKey=n,this.emit("connect",n))}},this._connecting=!1,this._publicKey=null,this._wallet=null,this._config=e,this._readyState!==$.Unsupported&&(cr(()=>{var n;return(n=window.solflare)!=null&&n.isSolflare||window.SolflareApp?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1}),C4())}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async autoConnect(){this.readyState===$.Loadable&&$g()||await this.connect()}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;if(this.readyState===$.Loadable&&$g()){const i=encodeURIComponent(window.location.href),o=encodeURIComponent(window.location.origin);window.location.href=`https://solflare.com/ul/v1/browse/${i}?ref=${o}`;return}let e;try{e=(await Ba(()=>import("./index-28169dc7.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._config.network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(this._connecting=!0,!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new lr;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),n.on("accountChanged",this._accountChanged),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;return xi(e)?o!=null&&o.length&&e.sign(o):(e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o)),s.preflightCommitment=s.preflightCommitment||n.commitment,await i.signAndSendTransaction(e,s)}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const F4="Torus";class W4 extends Xn{constructor({params:e={showTorusButton:!1}}={params:{showTorusButton:!1}}){super(),this.name=F4,this.url="https://tor.us",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzMiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMyAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYuNSIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzAzNjRGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTExLjIxODYgOS40OTIxOUMxMC40NTM5IDkuNDkyMTkgOS44MzM5OCAxMC4xMTIxIDkuODMzOTggMTAuODc2OFYxMi40ODk4QzkuODMzOTggMTMuMjU0NSAxMC40NTM5IDEzLjg3NDQgMTEuMjE4NiAxMy44NzQ0SDEzLjY2ODRWMjIuODk3NkMxMy42Njg0IDIzLjY2MjMgMTQuMjg4MyAyNC4yODIyIDE1LjA1MyAyNC4yODIySDE2LjY2NkMxNy40MzA3IDI0LjI4MjIgMTguMDUwNiAyMy42NjIzIDE4LjA1MDYgMjIuODk3NlYxMi41MDE1QzE4LjA1MDYgMTIuNDk3NiAxOC4wNTA2IDEyLjQ5MzcgMTguMDUwNiAxMi40ODk4VjEwLjg3NjhDMTguMDUwNiAxMC4xMTIxIDE3LjQzMDcgOS40OTIxOSAxNi42NjYgOS40OTIxOUgxNS4wNTNIMTEuMjE4NloiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0yMS4zMzc2IDEzLjg3NDRDMjIuNTQ3NyAxMy44NzQ0IDIzLjUyODcgMTIuODkzNCAyMy41Mjg3IDExLjY4MzNDMjMuNTI4NyAxMC40NzMyIDIyLjU0NzcgOS40OTIxOSAyMS4zMzc2IDkuNDkyMTlDMjAuMTI3NSA5LjQ5MjE5IDE5LjE0NjUgMTAuNDczMiAxOS4xNDY1IDExLjY4MzNDMTkuMTQ2NSAxMi44OTM0IDIwLjEyNzUgMTMuODc0NCAyMS4zMzc2IDEzLjg3NDRaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._connecting=!1,this._wallet=null,this._publicKey=null,this._params=e}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isLoggedIn)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./solanaEmbed.esm-f41f2732.js"),[])).default}catch(o){throw new B0(o==null?void 0:o.message,o)}let n;try{n=window.torus||new e}catch(o){throw new Ei(o==null?void 0:o.message,o)}if(!n.isInitialized)try{await n.init(this._params)}catch(o){throw new lr(o==null?void 0:o.message,o)}let r;try{r=await n.login()}catch(o){throw new qt(o==null?void 0:o.message,o)}let i;try{i=new X(r[0])}catch(o){throw new Sn(o==null?void 0:o.message,o)}this._wallet=n,this._publicKey=i,this.emit("connect",i)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{e.isLoggedIn&&await e.cleanUp()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const V4="Trust";class P4 extends Xn{constructor(e={}){super(),this.name=V4,this.url="https://trustwallet.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgdmlld0JveD0iMCAwIDQwMiA0MDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgo8cmVjdCB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgZmlsbD0idXJsKCNwYXR0ZXJuMCkiLz4KPGRlZnM+CjxwYXR0ZXJuIGlkPSJwYXR0ZXJuMCIgcGF0dGVybkNvbnRlbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPgo8dXNlIHhsaW5rOmhyZWY9IiNpbWFnZTBfMTY5NF8xODk2NyIgdHJhbnNmb3JtPSJzY2FsZSgwLjAwMjQ4NzU2KSIvPgo8L3BhdHRlcm4+CjxpbWFnZSBpZD0iaW1hZ2UwXzE2OTRfMTg5NjciIHdpZHRoPSI0MDIiIGhlaWdodD0iNDAyIiB4bGluazpocmVmPSJkYXRhOmltYWdlL2pwZWc7YmFzZTY0LC85ai80QUFRU2taSlJnQUJBUUFBQVFBQkFBRC8yd0JEQUFjRkJRWUZCQWNHQmdZSUJ3Y0lDeElMQ3dvS0N4WVBFQTBTR2hZYkdoa1dHUmdjSUNnaUhCNG1IaGdaSXpBa0ppb3JMUzR0R3lJeU5URXNOU2dzTFN6LzJ3QkRBUWNJQ0FzSkN4VUxDeFVzSFJrZExDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3ovd2dBUkNBR1NBWklEQVNJQUFoRUJBeEVCLzhRQUd3QUJBQUlEQVFFQUFBQUFBQUFBQUFBQUFBRUdCQVVIQXdML3hBQVpBUUVBQXdFQkFBQUFBQUFBQUFBQUFBQUFBUU1FQlFMLzJnQU1Bd0VBQWhBREVBQUFBZWtBQUFFRXhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaElJRWdBQUFBQVFrQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBQUFRa0FBQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBRUVnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQWlZa0FJa0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBUk1FZ2lZa0FBQUFBQUFBQUFQT29XVjduWFZWdXg5TXllWTNYTG8zSXo2QUFBQUFBQUFBRVNENUV6RWdBQUFBQUFCR0xNWmJSNmUydTVWK3BlT25QazR4cXpCTUFicTE4NlVYOVZjNzNlVFRhV3J6NmJmVWVmUUFBQUFBQUdPSmozbUppUUFBQUFOTlVQckE2Zk95Zm53WFZ6Qk1BZ0EyOXFvdXJtNjNyRnI1cGk5U3JlbWlvc2pIMVpnbUFQdjF4MFRrN0RUUFBycUhyWGJGeStpSGoyQUFBQmppWTk1aVlrQUFBQURtMkhuWVBZNVFzTVRYbCt5cUx1YzdMb0UxV1ZiZTVpaTRLN0FBSTArNWV2TksxWFNtaWpsVHArSGJYenhlNlpkVmppMnE0V1d1V1BsZElLclFBQUFNY1RIdk1URWdBQUFBYzYxK3kxdlg1YTMxQzIxMldnY3pvQUFBQUFBQUFPYTlLNW5yeTR3MzRycFlkRHZ1VjB3cXNBQUFBeHhNZTh4TVNBQUFBQnovVmJuVGRibUxWVmJONTlXOGN2b2dBQUFBQUFBT1lkUDVac3lmSTNZNzF1OVB1T1Qwd3JzQUFBQXh4TWU4eE1TQUFBQUJSOUZZcTcxZWFzVmQzaGVSeXVrQUFBQUFBQUI4OHM2ZHpIZGpEWms2RnM4SE80L1ZEejZBQUFBeHhNZTh4TVNBQUFBQlVxdmNLZjArYzIycHo3UEhSaHlPb0FBQUFBQUFCaGMzNkJ6L29ZUTFaK201RVR4dXFFU0FBQUJqaVk5NWlZa0FBQUFEUlVmb1hQZWpnZTNpMDBkVmVYcnhlcUNRQUFBQUFBTkRTTFpVK2x6M3Y0Ykc2cm9nNC9WQUFBQUF4eE1lOHhNU0FBQUFCNDh3NnJ6TGJreHh0eDlDMmRic25KNllWMkFBQUFBQUFValE1bUgxK1czMmh0dmoxYUJ5K2tBQUFBQmppWTk1aVlrQUFBQUJSYjFYYjZhWU9uenQzZXVXZE53YmZZWk5RQUFBQUFERnlxdlpYVWgxdVk2QlErbjQ5WDBNTzBBQUFBREhFeDd6RXhJQUFBQUR3OXlPV2ZOaHIzWDVpeTFvZFZWeXg4cm9oNTlnQUFBRHhRNXZtNnZwWUEwVWIrN1lHZnl1a0ZWb0FBQUFHT0pqM21KaVFBQUFBQU1mbkhUOVhvbzU4Ky9qcFlHOTBUelBUTW5sdG13N0xZOC9UTG9CSUJyYWpkVFphZGpOK01MYWxrd2I3azFmUXdiUUFBQUFBTWNUSHZNVEVnQUFBQUFBYTZqZEs4NzZlWExQV3VoaCtSNzhlOXRwYXF6cXJudTZ4Yk4vVWRMNTZzNGFNNHpZbkNzTzgzR0xYOC9SajFnQUFBQUFBWTRtUGVZbUpBQUFBQUFBQVl1VW1LUm9lcTYzWGw1NDJXdDI1UW55UHBQemtiKzFaZEdoc01zT3NQUHNBQUFBQUFBUWZEMElpWWxJQUFBQUFBQUFBRVZ1eXZmamxuejB2QjJaYWxkczM2elhoVGNBQUFBQUFBQUFpWUpBaVlKQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFSSUFCRW9KQUFBQUFBQUFBQUFBQUFBQUFBQUFBaVlKQUFBQkVvSkFBQUFBQUFBQUFBQUFBQUFBQUFRRWdBQUFBQkNRUUpSSUFBQUFBQUFBQUFBQUFJSlFKaVFBQUFBQUFBQUErUkhpSkFBQUFBQUFBQUFBQWVub1FCSUFBQUFILzhRQUx4QUFBQVVFQWdFQ0JBVUZBQUFBQUFBQUFBRUNBd1FGRVRBeEVFQVNJRFFURkNGQklpUXpOV0FqTWxCd2dQL2FBQWdCQVFBQkJRTEhZV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVc1di9OTi81TGYrbC92L0FDVDcvd0FLazFOcGhTYTE5V0pEY2h2ckhvRjFsdUpiUk1xaW5PV1hsc09SS2kzSTY5d1d1bXBTVUprVmR0QWVrT3lGZW1OVTNXQXhPWWtkVTlsclBld1ZLWVFIS3RIU0hhdzZvT1BPUEhoWm55R1EzV2lDS2xGV0V1dHI2SjdMV09mUCtWSmN5UXMvbVh3YnpwZ3pNOEVXbHVQQitsTXVOdnhuWTZ2V1Mxa1BtSGg4eStJOVRmYVUyNGwxdkdleTFqbktOYzdDeFRYM2hHZ014dVZJU3RNaWpwTU94M1dEdzBaUm5HeG5zdFk1ZnZmU2xLbEczVHBMZ2FveEJtSXd4NnpJbEU5UzQ3Z2NvN3lRdUsrMTY2TCtqalBaYXh6ZmZjVTZFMUpiS2x4U0NZY2RBSWlJc3FtVzNBcW54VkE2VEZNU0VFMUk0bzN0OFo3TFdPZjcvaWkvcGRPWDd6aWplMHhuc3RZNmorNGNVWCszcHlQZGNVZjJXTTlsckhVLzNIaWlkUjM2dmNVbjJPTTlsckhWZmY4QUZGL1Y2YXZxcmlsL3QrTTlsckhWeS9POFVZL3pQU1VkazgwNHJVL0dleTFqckpmbWVLUWRwdlNmTzBmbUVWb09NOWxySFdpL0Z4VER0VU9sTk8wTG1PVm8yTTlsckhXaS9wY1FUOFozU3FSMnAvSkZaT005bHJIVnl2QzRhVjR2ZEtzS3RENFlUNVNNaDdMV09vcDhvSExTdk5ubzFwWDA0cDZmS2ZrUFpheHZKODJPYWN2emdkR3JyOHBuRklUZVprUFpheVNFZkRrOFVaeTdIUmxyK0pNNG9xUHdaRDJXc2xXYjhKdkZLZCtITTZFbDM0TWJtbXQvRGdaRDJXc2xZYThtT0VxTkMyWENlWnoxaC84QUR3MmczSEVwSktjaDdMV1I1c25tRkpOS3VLVEs4RlpublVzTlBPcWZlNHBEUG5KeW5zdFphdEg4SHVZRlNKd3NqcnFHVVRacXBhK1lVZjVhTmxQWmF5dnNwZlplYVV3N3pGcWJqSVprTnlFNFpWVGFZRDhoeVF2bWxSUE5lWTlsck5OaEpsTnJRcHRmS0ZxYlZHcTRRNGgxUHBrem1Zd2sxQjZSNllNRlVwYVVraE9ZOWxyUExoTnlreUl6a1pmb2FmY1lWRnF5SE9YcERjZEVtcU9PK3FIVEZPaEtTUW5PZXkxMEZvUzRpVlNESUtTYUZlaUxPZGpCK3NGNExjVTZ2MFI0ajBrNHRPYWo5STlscnBQeG1wQlNhVTYxaFpZY2ZWR3BLRUFpSWk2VnV0SmdzeVJKZ3V4dlNTVFVjV2tHWVEybHRQVCt3Ky9WTXJsTHBSS0NrcVFvUllUc280ME5xS25ybjJIb3pNZ0pwY1ZKa1JKTHJmZi9BSnd2M2I5Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN3bkwvQVAvRUFDY1JBQUlCQWdVRkFBSURBQUFBQUFBQUFBRUNBd0FSQkJBd01USVNJQ0ZBUVJSd0lsRlMvOW9BQ0FFREFRRS9BZjBhN2hONk03VkhNRzhIMWIyb3lxS2FjbmF0ODFtWmFXZFRRWUhiMEpKQ1RWejJKQ3pVSWxBdFR3RWNhMnp2UVlpa1BVTDZyYjBxbGpZVitPMUREajdTeHF1M1lWQjNvNGRmbEhEbis2ZU1wdmxGd0dxL0kxRHowc1JzTW8rQTFYNUdvZVkwc1I4eWo0alZsNW1vK1kwc1I4eVhpTldiblNjaHBZamxrTlhFY3RPZm5TK1RyWWdiSEtNM1VhTG03RTFFTHVOYVlYWExEdDR0b08zU3Q4c09QTjlkbDZUYWxicE42Vmd3dU8rV1RxOERLSmVsZGVXUHE4akpXSzdVazRQTHNlVlZwNUMrVU1kLzVIMFpJZzlNaFhmSkpDbTFDZFNQTlBNVzJ5QXZ0U1FmVzlNaTlQQi9taUNOODBnSjNwVkM3ZXN5aHQ2T0hQeWtpQ2ZvL3dEL3hBQWtFUUFDQVFNRUFnTUJBUUFBQUFBQUFBQUJBZ01BQkJFUU1ERXlFaUVnUUVFaWNQL2FBQWdCQWdFQlB3SC9BQTFJeS9GQzNURlNRRmZZK3FBVFN3dWFTMkE3VUJqVjRGYW10M0hGRlNPZm9SUmhWckErRHpxdE5NNU9hUzRCN1VEblhBb29wNUZPdmkyTjFlQlRNRUdUUnVWbzNSL0JUU00zSitDc1Y0b1hMRG1oZEQ5RkpLSDQwbTduZFRxS242YlZyeWRKZTUzWStncWZvZHExL2RKTzUzWXVncVhvZHExL2RIN0hkZzZDbjZuYXR1dWgzYlkveHQyNC9pbU9CbmV0VHlOSlJoenN4akNnVk1jSWQ2QnNQcGNyNzh0aU5mSnNhWFRlZ043aWtieUdhZGZNWU5NaFE0UHpoaThCazZTdjV0bmZobDhEZzhhTW9iMGFlM0k2L0JJV2VraVZOSjVjZnlQb3h6RlBWSTRmalI0bGZtbXQyQndLamdDODZFZ2MxSmNmaWZUQnh4U1hQNDFBZyt4ckpjQWVscG5MYy9XVnluc1VMbGNlNmttTC93Q0gvd0QveEFBM0VBQUJBUVFHQndZR0FnTUFBQUFBQUFBQkFnQURFUklRSUNFaVFGRXhRVkpoY1hLQkV5TXdVR0toQkRJemtaS3hRb0tBa1BELzJnQUlBUUVBQmo4Qy93QkMwcVIyaXR6WG5ObTR0TTdNZkw1bHFDUXhRNXVvejFtbWQyWUZwVlhIbVdmbGtWRUFiMmc1RTV6MU5GNHFOYVZmZUkzNld1cmdySStUM255UHUxMlpmQU4zYVFqM2FMeFpWeDhLeGNSa3ExdTlkZFV0OVNYaTExYVZjRGpwVTJ2RDdORXZsOURCdnJQUHlhMTR2N3RhZkFtZTkyajNMQU8rN1VHZzhURGZxUGdXS0k2dDlWZjVOOVo1K1RYMWRvbmV3V2d4QnhMMG5haDRVU096VG1wb3dtWHRHbVZRQkJ6YUxoVXZwTFFlSUtmQ1duSldKZmN4clFTQ2VEZlRsNXJHNzE1MFMxeDJBYzY4Q0lockIyWjlMWEZKWDdOZmRLSFN1ODVzUzk1cVZLZVJzT3B2a2oxYXh5ajdOWUllTmZkcFZ4RGZSSFJ0Q2gxWjRoT2hKaFN2bXhMM2pTOTQ0Ujl6bWxmUGlYdEwzcGhIdk1hVHo0bDUwL1ZMN3BoRjh4cC9zY1NyZ0tYdkRDRTBvNjRrY3RLeDZjR1RVZGY5cnhLRDZhZUtjRzhQcE5SMXk0bHllTktOOGYxZzMzTFVkREpJeExzNzZYWE5nM25UOTFBTXNUSEpWS0ZaS0J3WUdhcVhhYzFERlBmdlVRck1Sd1RwUEUwdWh2amlscHpTUlVkN3JNRkxzcHBKMlU0dDRqSlZLMFpHT0NlcTMwdlY5TVhOdGlOTXVwWWhnVnZNaFVSNnJjV2w1c0drS0drV3NsNG5Rb1lCTGtjVFNsQTBxTUdDUm9GbUxXN1A4Z3hTZElwN0Jac1Y4dmpsNHMyQmxQRmFUU1hoMEkvZU43WWZLdlR4cUIwK01GNmpuNHBXdFVBMlRzYUJVU2orV2s0MVR0V2dzWGE5SXFCTHkrajNEVE8xUjhLVkhlTDltbWVLalU3ZFl1ajVjZms4R2dzVUxFQ0treUZGSjNNRS9FRCt3YVpDZ29icTBDWmxiSWFFWkVaQ3JFMk9ocExCS1JBRHlDMnhlcFRRZUo2MVpuYWlscFgxeFdlcW1aNHFEU3V1N1Q3MWd0OWRSbHJMQktSQUR5S1ZhUW9NVmZEMmpaTFFVQ0R2cXdqTWpaTGR5bThkclUweTFGUnEzRTJablEweHZyelBrMEhpWTcybWRkNG4zOEdWMmtxYVo4WnpscWFBRUI1VEVpQzlvTkVpS05vVllKRVMwM3hGbnBEU29TRWpkNVpBdFA4QUQzVHN0S29RSW91aUNkb3RkRVZiUjh3N3hFZDdSbEo0bG9KRUIvbkovOFFBS2hBQUFRSUVCQVlEQVFFQkFBQUFBQUFBQVFBUklURmhjUkF3UVZFZ1FJR1JvYkZRNGZEQjhkSC8yZ0FJQVFFQUFUOGh5Q1FFNTI3cGp1bUtnRlFDb0JVQXFBVkFLZ0ZRQ29CVUFxQVZBS2dGUUNvQlVBcUFWQUtnRlFDb0JVQXFBVkFLZ0ZRQ1ltcVZHNlpia0NXVVRPQ0FiNEpta24zaG11OHBib0J2aG9pb1U4cncrSmJVSUY4ancrTEkxRTBJOFJpVzcvR21CZnZ3a3NnR0h4d2hEZ203YjQ4K3NTV0NBWWZJQ0RqQXlmSW1Zd0V6ekI4WUdZSmdPcSsvbFFGV28xRitaSk9XTmhEcVZHWElQNk5pSE1ieW1kamNTczVjQUFGSjVRb0hjeVRCT0Zab2ZaUEg3Um9PbkVPRmlLQ3hUUUJFcG5sWmlrMjVBZ0RrZ0NxbDRwR1U3eE5nZVU1Z2Z1WWs4UjFaVE9Eam9FWkFncVA0SzBtV3drTHduQjVHYmRTYlpnQkRBcnhrRzY4UFFlRi9wRk5GYzBSY2h2a05EMngrR1FnV0xBemU2Y2MyQjREa2VGNUFHUStwZjZSQVFKcWlNOUNtbmpjWmsyNmsyek5FUXV5R1RNcHY3a095WmcvWmh0aVp6YkFFOHZuUjdxOFdhSHJsRkJLRjFHWk51cE5zeUg4VWVKMUYyQjFxME4wQk1YNkg5SzZqQkU5K001Q0pNRUozSnV5N0o2SW51VW9MZUlkK01JOUhyTW0zVW0yWURYV01ieTJITXAwZDVyMzJkN1RLRUd3R2Q0b2txYkJ1STlLUVdpdTFQUWZIOTlNeWJkU2JaZ05peWhVK3VVSi8weHhDSlY2R1pOdXBOc3dHdUQwTVRoMS9ybERjbS91eEJxcGVobVRicVRiTUJxdjhNU2lQN1BsRGQ3K3pFV0d1WVRicVRiTUZxM294S0J1SEtGVkRpTFZEN1prMjZrMnpHaWJpZkp4dlova2NuUVFQd05LaFBsbVRicVRiTXZKdms0d0hjSHJrNkhFOGNEUm9PWk51cE5zeThRSHJHMHdlWEp1YXNjRkRWNHpKdDFKdG1PN2N4NCtzWFRRTzhPVHZ4bmhpQTVZS2xCc3liZFNiWmpmc2o3R1A2NkR5ZEJNZURqUWdlYzJiZFNiWmpHMkE3RHdVWi9Ea3V2eWVNYUVlQVBtemJxVGJNL053T0J5Nmg0bHVTYWRnUDdqWDBQOEFNMmJkU2Jac0FHZUFzK01ZNCtkL25KYThnbUJZUXhZM0pBL3V1Yk51cE5zMXgwQi9qK1l0SkdLNjVqa2Q3b1Y5T0NNSnVQcjlObXpicVRiTmFlYkJzY1Rqc2NBYXJWMEZ1UWFMeFAxNHlDUUNsT0lETm0zVW0yYkxRWXNnSXNSaU1RbGFFY2pvZHM5bVFQdlJUd0Y3WXN5Z3d1L0hPbTNVbTJjY1lmU3hTSzBNUVdYM3pRRWg2bFFDL3dEdHppQVNXRVNuRW03dWROdXBOczZRaXoyTzZEWXhlOWVBYTZHaHFzZFJxTGpLY0dOZ0dDNVZqQU5CYmdza1IxTytmTnVwTnM5NUJoZnFLT2hoaUR3QW9CMUprVVJFZnR3aGtvNmx4T25kcjEyVHZHUDJUcndnSXlSY29FT2dFd0EwejV0MUp0eUdnOUkwVUdRYUJJOEwxWlNSVEdJZDUvNGdRUTRMZzROUmpvTlRaUDdubGY4QUZNOEo0TXpoK2pJZEFaZ0JweUUyNmsyNUUrTU13VTRyVWVqMEtMQlhNQXg0UzREOFNHeVp3ZGlKL0RvME9PcDRlcXJDQk05bklDdzVLYmZsQm5zdEpDT3FlYkNKZW1xSUlMR0J5SE96WFlKbm92Si8xQVFBSkFjbkhIZENaNVVTZTZqN1J1aXBIMXdpNWhwQUJ5VXdtWjF1cFF1QWRBNVF6S1FYdHl3Q0FCQjBLZjJOWFNiYkk3TG5nY0pCT2NqN1U0Uk9ZZVdPZ3drNWdaQ01Ta0k2cDBxV0NoOFFVZ0F3SExpSkhFUWg4ZVN3UURERTc3Zkh6TnVHUnA4YWRoTlNIRE5EWS9Ga3NnTy9HUTZCME0vaVNXUUdwbmtrT25hZmY0ZDlCTkFkOHhtbDJUN3crRGRsRTBVczl0aW5PbzdKbS9PczNUN0JNVE05a0EzS0FBSktvVlVLcUZWQ3FoVlFxb1ZVS3FGVkNxaFZRcW9WVUtxRlZDcWhWUXFvVlVLcUZWQ3FoVlFxb1ZVS2luSE4vOW9BREFNQkFBSUFBd0FBQUJEenp6UlR6enp6enp6enp6enp6enp6VHp6enp6eVJ6enp6enp6enp6enp6enp6enp3elR6enlUenp6enp6enp6enp6enp6enp6enp5anp5aHp6enp6enp6enp6enp6enp6enp6enp4end6enp6enp6enp6enp6enp6enp6enp6enl6enp6enp6enp6enp6OVBmenp6enp6enp6enpEenp6enp6enp6UW9NTU9EN0h6enp6enp6ekx6enp6enl1QUFNTTkrNHNNUE9MM3p6enp3THp6enp6eUVJV1kzenp3MjAwd1A4QTg4ODg4Qzg4ODg4OEtRODg4ODg4ODg4NkQwODg4ODhDODg4ODg4cUU4ODg4ODg4ODhyRGQ4ODg4OEM4ODg4ODhxRzg4ODg4ODg4OGdEVzg4ODg4Qzg4ODg4OGpTODg4ODg4ODg4SkdWODg4ODhDODg4ODg4cEEvODg4ODg4ODhDSDg4ODg4OEM4ODg4ODhNRDE4ODg4ODg4OEpIODg4ODg4Qzg4ODg4OG9EYjg4ODg4ODg1REQ4ODg4ODhDODg4ODg4L0NDLzhBUFBQUFB3UjkvUFBQUFBBdlBQUFBQUE9DQWZ0L1BPOEF5dlBQUFBQUEF2UFBQUFBQUERqUTQwcUF4VDNQUFBQUFBQQXZQUFBQUFBQUExmUUF3RGovQUR6enp6enp6elB6enp6enp6enp6eTJLL3dBODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODhFODhVODg4ODg4ODg4ODg4ODg4ODg4ODg4MGM4OHN3ODg4ODg4ODg4ODg4ODg4ODg4OHM4ODg4ODhjODg4ODg4ODg4ODg4ODg4ODhFODg4ODg4ODg4akJCQkJCQkJCQkJCQkIvOEFQUFBQUFAvRUFDWVJBUUFDQVFNRUFnSURBUUFBQUFBQUFBRUFFU0VRTURGQVFXRnhJS0ZSY0lHUnNmRC8yZ0FJQVFNQkFUOFEvUm8xd2xzYW5ZQjZWSEpuZjc5VEdHb3FyZGNRNUp5V0p5UytnYmw0SjV2aGtPQ1k0dVpUSWlLcDFFY01Xc1pTL251OHZ2U1FkeElMbE9BZkF1aGNaeXFkbkExNzZmWVp4ZFRKajdtZjhQVzF4L2xwOUxkRlFkYlE4ajNvYUR3YnBwUlVuazJuZ2VOQlFHNktMNGcwM0JzdlpWcnhCU2VlZ2l4YlB1amZoZjhBak9saS9IWXVORjYzcUNVeGxVY3g4OUNnV3k3MkRTbUhuZnI5d2lWaGlGcVlUQitvSTVOY0x5emx1UHhvNjdIUTVRd3h1aG9sbGlYREJtT3dORVZDVmY0empvZ0ZNRnovQUVqdEN0Y2ppZmNIbzdWYmg5Q1djc1ROY3Y2UC84UUFKaEVCQUFJQUJRUURBQU1CQUFBQUFBQUFBUUFSRUNFd01WRkJZWEdoSUVDeFlIQ0I4UC9hQUFnQkFnRUJQeEQralg2MmN3bEV1ZFpUNnV3RnpvdGVabVN1QUtESE16Sm5LcHM1UG9ER3JXZHI0WkdOc3BScVpabGZVQVdPS201Q2FoZGNkWDFpZE1VSHNNYjB2aTR0YnFiVUdkU1I5TmZ2V0p2L0FPZnVsNldIdmFydndrRi85ZGRJNXJ4Zzc4anF1L0ZEZmkwaGt2R0N0TzdxdS84QWI5aHN1enBITTk4RmF1cmNqaGlXVkVwclJvTHpMbmdmUUNtZDlIdzVyeXF1K1dGWUhYUXI4RkhKMWhWWkJNOVlLeXFEOGdWb25NRGhjamJwcjh3SU41a0hwdVovbVBjUkduSFBOam1iVHZ6Z1o2N3Y5SFAyWkJyZUJPVFBtYmtEbVp2bmNBYlZFdjhBMG0vMGtWcW1NZnJEYkxNZXJqNmpkdTlLOVJxMk95RzVrZXh4L09qV2ZuLy94QUFxRUFFQUFRSUNDUVVCQVFFQUFBQUFBQUFCRVFBaE1hRVFNRUZSWVhHQmtmRWdRTEhCOEZEUjRmL2FBQWdCQVFBQlB4RFVXUmI3akdwY0ljMVNZdm9SVzhsNXJYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4Vlc0STVNVk13NjE2azRoeVdva2hsYm4yQXFNWGNWR0lodVA5b0JZaitDZ2tKSlU4V09EY292Z1N5ZGJMZGZpMUJnUDRxQ1FralVZTTdqYVVJSkdUVXFCS3dGUTNOdHpmei9rcUhBZHB2b0JicWJ0UVhTNE1PUEgrV2srUlNCSjZ1U0g0ZnpjRndmeDlNUzJMWXF3ZnpyeTlsemw2QzVzV0gzL0FEemFURzRvUkJMam9tVXgyYzZnRGQvUXZibTV5MFhCdXY4QTBiRzMyZEZ6OVAzZjNDUERpWWU1dXZ5R2tTUU51ekE1SmZ1VUV2MkVJWGNObnQ4UjJsKzJqYTcxYy9iWTJvM2c1Y1hoUXEzWE5nNGJtZkxEU2tXeWRvTnliU2pIcXRKZTR2cHZ6OXVSTGNJcktudE1KS2lCMWFMZkd3YUw4NU9kVHFSd2VXTEhxa2dDeFlQNHN6MG9NQlByelk5RjlyTEQydFpWN0JxTllxZ281a1RFRHNGNkhFWmg4aEJ5bzVXNFd2dkJrMWNsTWtxSEl3T21xSi94d2k5em9sRkN2YkRaSHpRUkRPNXZXSXpvc3VtSDBqN0hPcXlyV1JXNkRxVGZ3T0hkS1V1eFE2UUsvYi9kRHdMeFgzVW9EdlUrc0ZZTHRQRmJjUkJjQndjWHRRVVlReU9YdDU0MHpPTEY5eFBveDFHelgzeDhWa3JIOTErMys2ZHgwblFtL0VubkpWMll6OVBFYmF6T3F5cldNVEtUd0xHUnFRUUFWYkFWZkNkZ2lPR042d2NhTWhyWVNqd1lmTGpwTGUwU2cxdkhHUlh5eEhXZVpVMkU0SW5rQ3ozMVN0ek80UUpPNVBYV1oxV1Zhd29IZjV2VURXOXBYWXBzUlBhRU9qZktuRmQrRWZqaFJBbE5sUDFYN2VzSW13TWljUnBGZWJWaTVyZG9wM1laRmw2TnM2ZVlWak4yRW5yNWtEV002ckt0WVFUZjU2UmZaQ2hSQTdxL08zNEpTUXlEQk5uV1ZGaVhBUVphNmF1TzFqTXFSbUg4S0tZZXJuM05PUXBKU3dPM1NTZmF3eTZ6T3F5cldRQ0l2ZTRhWnQwWDg2ZTBCWnVzK21MZkEvZlBXWjFXVmF5RzhidTJtYmQzN24rUGFZM1hkK2ZUTU41eWZyV1oxV1ZheTJON3B1YlJlMDdkWkdNN1dtVWJ4OEgxck02ckt0WktONitIMXBqM3Q5bC8zMmwwcGxjOU1vakhaejYxbWRWbFdzL1djSDFwZzN4N1A5dlo3S3ArdzlIR0R1ays5Wm5WWlZySWZISCsybWQ4bVgxN1B4ano5SEZydkwvZXN6cXNxMWtjVDZaWDNwanV4RHVmWHM3cVJQZEVmZm90NUdUSFdaMVdWYXkwKzJlY3RLNjhUK0p6OW54M0Y2L1JPbERDVllDakp3QWREV1oxV1ZhenlnNTltbTlrWERrSDJkeTd3WEFUNk5OaUp0dk1HdHpxc3Exa0tsek9nL0I2TGd6ZnQ4aCsvWlFCY1F1VUQ1ZE5ucGw3ajZhM09xeXJXUitTa2RVZWlWMlVyaElNZzlsRVRaZzRxL0JOTStscGJpcDhGMXVkVmxXdGUzQVRtUmxHa0c3RVRnSStWMzlrWmpJamZZWkJwbkV4NXlGZmhyYzZyS3RiQVJFejJTWGZCNjZUaHJnQ0grQ2RmWWhKUW5yMnpKU3F5M2RMUVVkOUxaTmF6cXNxMXJuWit6dmNPK25oWXJJTWxZSlFKdmJUb3lkUFlIYzFpTmdXSGVYb2FjMVlCWW9HNENOd0VHdHpxc3ExcmhRc3U5c2VqRDBwTGJ6c1JHRTAzOENCYmE5V3pqejE5eTFFYlZzSEZwRDlqVFlZQWNBZzAzVU1lMnlCMkpkdGRuVlpWcnRpMW9iRSt3bm1Pa1VFVVM0bEFaSFlYQVhaOHVldHhlejRpN2cydkNqb0VMbUw5bnhtNkFRS01BWFZvekppNXY0blFnNmE3T3F5clhCMWdBRjlrT0kxWkVwT3diQndmUWFka0ZiWEJjVGc5eW9LTkd3ZmRpR3FscU8yS2Z4WXlwUzVtSFk5dzJmUG9jcnZzTVA0SHp5MStkVmxXdkpZb0hCUGkrTzhwWU9HdWZ0L293UWdzUjJwelloQmM0N1RtZHF3c3VURGs3bmg2aDRaTFhPcGgxWDRVWTJCVFluYytIRDA3cUZybVptOTJVR2RRMEFOZm5WWlY3QzBrV0RTOENiVGgycVRSSGJ1Vy9XUHBCYlNSZEJNSHJTRFJzSE1tL1ZialFNQUpFWkUwVFlEaXZ1R0xVZmxrS052aS9BNzBxaXFyZFgwOEZCUVAweithZ3ppZUFld3pxc3E5amdxamNsU1EzbFlPRzA1TitMVFRsaFFPWStsMnhOMnNjMjFsd3JFZXdWbnVBeFpjNnhwaHZMeTRIRDB4RjRNWm9iWGdTMDRBSzVlT1J6dSt5MzNhcXdHNjNzNENjUUhaaS9UQ3BTSlhnc2NmbzdVaUJCaEVoSFVRd25FRWN4YkZObURmQWJqdHlIQ2piREFZQTRIc3drNTFXanVaOXJaUjFyZlZzSFB1VS9GTkYzMUdLNTkzMHNkdUZrY0FvcGw3aVhmQnlMOFNzRE9FUS82OGZhT0VNWXRRUUJnV3BzWGNqOW43WU1MUWhJbERHdVZHT2UydUdIS2xHWkE0UjBTT1pRYXpnYjNBNnhVTWpVRW5oRzQ0R2Z0cjNlTTl2eG9HSXhMME1rbUQ3Y1dERUJQSkMvU2pjSFpGUFlSUFdqTzNBd09BZTM0QUxIMys0YWJ6dTRjdjU5NEx1QnpxQU5KYkRITVVJZ2x4L25HUHNzT2ZwTUxhdzRPNythM0V1eU45QUFHQjZVQkRoU1IybXgzL3dBdUJoSzRHK29MdDFpK3NCR0c1M1VrNEh5L2toeExnYjZTY1JaYWtCRFV0K2ZsL3dDTzN3VGtLZ3VzcmJySjduaXcvd0NVR1lFdHp0L2hvc2NkMjJveGJOeGpRQWdJTmNna0pKVXpFT0RjcURhOFZXOWh6dDcxRmhFN3FtNHJ6dFc0QnUvMVFZQ1BhS1VBN3dwdmZOWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxVjQrYWdHUjFYb0FJQURXZi9aIi8+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.trustwallet)==null?void 0:n.solana)!=null&&r.isTrust?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.trustwallet.solana;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const Q4="FoxWallet";class Z4 extends Xn{constructor(e={}){super(),this.name=Q4,this.url="https://foxwallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImZveHdhbGxldCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDEyMDAgMTIwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTIwMCAxMjAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6I0ZGRkZGRjt9Cgkuc3Qxe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF8xXyk7fQoJLnN0MntmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfMl8pO30KCS5zdDN7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzNfKTt9Cgkuc3Q0e2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF80Xyk7fQoJLnN0NXtmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfNV8pO30KCS5zdDZ7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojNzIyQjAwO30KCS5zdDd7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzZfKTt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTQ4NS43LDY3Ny40YzIuNSwwLjgsNS4xLDEuNCw3LjcsMS43YzAsMC0xMC45LDQuMS0zMy40LTMuNmMwLDAtMTYuOS02LjktMjkuNS01LjcKCQljLTE0LjcsMS4zLTI0LjgsMjAuNC0yNC44LDIwLjRjMi45LTEuNiw2LTIuOCw5LjItMy42YzEwLTIsNi42LTAuMyw2LjYtMC4zcy0xOS4yLDguMS0yMC41LDE1LjJjLTAuMywxLjgsNS4xLTMuMywxOS4zLTIuOAoJCWMxNy41LDAuNSwzMi43LDEwLjcsMzguOSwxMi40YzEyLjgsMy40LDMxLjEsNC4yLDQ4LTljMCwwLDE1LjUtOS43LDIwLjMtMjcuN2MxLjItNSwyLTEwLjEsMi4yLTE1LjJjMC4xLTQuNS0wLjQtOS0xLjQtMTMuNQoJCUM1MjguMiw2NDUuNiw1MTkuMSw2NjYuNyw0ODUuNyw2NzcuNHoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8xXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MTYuMjE1MSIgeTE9Ijc0Ni4yNjQzIiB4Mj0iNjMzLjU3ODciIHkyPSIzMTUuMzk3OSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojREFEQjQ4Ii8+CgkJPHN0b3AgIG9mZnNldD0iMC42NTYyIiBzdHlsZT0ic3RvcC1jb2xvcjojNjM3NjIxIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTgxNi4xLDg3NC45YzMzLjktNDIuNSw1Mi4zLTk1LjIsNTIuMy0xNDkuNmMwLTU0LjMtMTguNS0xMDcuMS01Mi4zLTE0OS42bDIxNy4xLTIzLjljMCwwLDIyLjYsNjEuOSwyOC41LDk1CgkJYzAuOCw0LjIsMi4xLDEyLjgsMi4xLDEyLjhzLTMzLjcsODEuOC04NS40LDEyNi43QzkwOSw4NDYuNyw4MTYuMSw4NzQuOSw4MTYuMSw4NzQuOXogTTMwMiw4NzEuOWwtODMuMiwxNS40CgkJYy0yNi40LTY2LjktMzYuMS0xMzkuMi0yOC4xLTIxMC42YzcuOS03MS41LDMzLjMtMTM5LjksNzMuNy0xOTkuM2MxLjgtMi42LDUuNC03LjcsNS40LTcuN2w5MS45LDI1OC45TDMwMiw4NzEuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8yXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MjYuMjQ4IiB5MT0iOTcwLjIzNzEiIHgyPSI0MTUuMTU0MyIgeTI9Ijk3MC4yMzcxIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTIwMikiPgoJCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiNFQzZGMDEiLz4KCQk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMjNEIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MiIgZD0iTTYwMy4xLDM0MC45YzAuMy0wLjQsMC41LTAuNSwwLjgtMC45YzIuMi0yLjQsNTMuOS01Ny45LTcuNy0xNTJjLTQ1LjUtNjkuMy0xNjEuMi02Ny40LTIwOC41LTEwMy41CgkJYzMuNSwyNy44LDMwLjcsNTIuOSwyNy44LDkwLjljLTEuMiwxMi42LTMuNSwyNS03LDM3LjFjLTUuNiwyMS43LTEwLjgsNDIuNC0zLDgyLjljNi4xLDMxLjYsMjAuNSw1NC42LDQyLjgsNjguNQoJCWMyNS42LDE1LjgsNjEsMTkuMyw5Ny4zLDkuNUM1NjkuOCwzNjYuOCw1OTEuNCwzNTQuNiw2MDMuMSwzNDAuOUw2MDMuMSwzNDAuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8zXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MDkuMTIyMSIgeTE9IjkzNC43NDkiIHgyPSI1OTYuNjQ0MSIgeTI9IjExMzguNTYzNSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMzNFIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0ZCNkYxQiIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik02ODAuMiwzMDAuM2MxMy4zLTIyLjksMTUuOC00OS42LDcuNi03OS4yYy0xMS40LTQxLjQtMzMtNjguNi01MC41LTkwLjRjLTUuNS02LjktMTAuNi0xMy4zLTE0LjgtMTkuNAoJCWMtMTYuNi0yNC40LTIzLjgtNTQtMjAuMi04My4yYy0yMS4xLDE1LjItNjEuNyw0My44LTg3LjYsNzQuM2MzNy41LDE4LDY2LjgsMzcuNiw4OS45LDcyLjljMzkuNSw2MC4yLDM4LjgsMTA4LjgsMzEuMywxMzkKCQljLTIuMSw4LjMsMTMuOCwxNS43LDEwLjksMjIuMUM2NjAuMywzMjYuOCw2NzEuNiwzMTQuNSw2ODAuMiwzMDAuM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF80XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIyMzEuMDYzMyIgeTE9Ijc0My41NDg2IiB4Mj0iOTczLjUyOTIiIHkyPSI0NTAuMzA1MyIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRkI2RDFBIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjIzRSIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik05NjcuNyw1NTAuM2MtNDQuMS00LjItMTMzLjQtMTUuMS0xMzMuNC0xNS4xYy0yMDAuOS0xMS4yLTMxNC45LDQ5LjEtNDAwLjksMTI4Yy02Ni40LDY2LTEyNS42LDIzNy0xMjUuNiwyMzcKCQlsLTcxLjktMy45YzAsMCwyMi45LTY4LjIsNDkuNC0xMTcuOWMzMC40LTU2LjksMzcuMi01Mi4zLDMwLjMtNjEuN2MtMzIuMS00NC4xLTQ3LjItNzguOC02MC4xLTE1M2MwLDAsMTUuMSwxMS45LDI2LjUsNC42CgkJYzAsMC0yNS45LTQ1LTI5LjktOTMuNmMtNy4xLTg2LjEsMzMuMi0yMDMuNywzNC4yLTIwNi40Yy0wLjQsMS4yLTIuNSwxMS4zLDIxLjEsMjYuNGMxLjctNy4xLDMuNS0xNC4xLDUuNC0yMC45CgkJYzguMy00MC42LDMwLjYtMTI5LjMsNzUuMS0xODkuNGMwLDAsMjQuOSw4Ni45LDg3LjQsMTI2LjNjMTIxLjcsNzYuOCwxOTcuOSw3Ny4yLDE5Ny45LDc3LjJjMTcxLjksMTkuMiwyNDUuMywxMDMuNiwyNDUuMywxMDMuNgoJCUMxMDQxLjksNTI0LjYsMTE1NCw1MjMuNCwxMTU0LDUyMy40QzExMTMuNyw1NjEuOSw5NjcuNyw1NTAuMyw5NjcuNyw1NTAuM3ogTTI4Ni4yLDI2OC4zYzAsMCwwLTAuMSwwLTAuMUwyODYuMiwyNjguM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF81XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIzOTcuNDM0OCIgeTE9IjMxNC44MjYxIiB4Mj0iMTEwMi40NjUyIiB5Mj0iNjI0LjcwNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjYzRiIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGQjcwMUMiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q1IiBkPSJNMTE1Ni4xLDUyMy40YzAsMC0xNy41LDk2LjgtMTA5LjIsMTA4LjFjMCwwLTMzMi42LTIuMS0zNTYuOSwzMDBsLTUuNiw4NC45bC0zOTktMTE2LjMKCQljMCwwLDM3LjYtMTI4LjMsMTE5LjktMjMxLjNjMCwwLDEzOS43LTE5Ny4zLDUzNy43LTE0NS4zYzAsMCw0Ni41LDkuNCwxMTEuNywxNS41QzExMDkuNyw1NDQuMSwxMTU2LjEsNTIzLjQsMTE1Ni4xLDUyMy40eiIvPgoJPHBhdGggY2xhc3M9InN0NiIgZD0iTTkyOS44LDQ3Ny4zYzAsMC04Ni40LTQ0LjktMTkzLjktNDAuN2MwLDAsNTguNS00NS43LDEzNy41LTM0LjVMOTI5LjgsNDc3LjN6Ii8+CgoJCTxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfNl8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMzI0Ljc0IiB5MT0iODYuNzMzMyIgeDI9IjkzNS4xNDM4IiB5Mj0iNDY3LjMyNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0VDNkYwMCIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGNEIzM0UiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q3IiBkPSJNNzExLjMsODkwLjFjMCwwLDI4LjEsMTkuNCw3Mi43LDkuMWMwLDAtNzIuMSw0MS44LTIyNC4xLTE1LjVjMCwwLTE1Ni43LTcwLjEtMjY3LTU0LjEKCQljLTcwLjksMTAuMy0xMzMuNSw2Ni42LTE3MS41LDEwOS40Yy00NS44LDUxLjgtNDAuMSwyNy42LDc1LDEzLjNjMjcuNy0zLjQsMTEuNyw0LjQsMTEuNyw0LjRTNTQuNCwxMDIxLjIsNDQsMTA3OC41CgkJYy0yLjYsMTQuMyw0MC41LTI2LjEsMTU0LjItMjIuNWMxMzkuNiw0LjQsMjYxLDg1LjQsMzEwLjksOTguOGMxMDIuMiwyNy4zLDI0OC44LDMzLjYsMzgzLjMtNzEuOWMwLDAsMTI0LjEtNzcuOSwxNjIuNS0yMjEuOAoJCWMxMC0zOS45LDE1LjktODAuOCwxNy42LTEyMS45YzItNTMuNi0xNC4zLTExMC0xNC4zLTExMFM5NjcuNiw4MzAuMyw3MTEuMyw4OTAuMXoiLz4KPC9nPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.foxwallet)==null?void 0:n.solana)!=null&&r.isFoxWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.foxwallet.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const UM={setVisible(t){console.error(_M("call","setVisible"))},visible:!1};Object.defineProperty(UM,"visible",{get(){return console.error(_M("read","visible")),!1}});function _M(t,e){return`You have tried to ${t} "${e}" on a WalletModalContext without providing one. Make sure to render a WalletModalProvider as an ancestor of the component that uses WalletModalContext`}const RM=oe.createContext(UM);function CM(){return oe.useContext(RM)}const Y4=t=>te.createElement("button",{className:`wallet-adapter-button ${t.className||""}`,disabled:t.disabled,style:t.style,onClick:t.onClick,tabIndex:t.tabIndex||0,type:"button"},t.startIcon&&te.createElement("i",{className:"wallet-adapter-button-start-icon"},t.startIcon),t.children,t.endIcon&&te.createElement("i",{className:"wallet-adapter-button-end-icon"},t.endIcon)),G4=({wallet:t,...e})=>t&&te.createElement("img",{src:t.adapter.icon,alt:`${t.adapter.name} icon`,...e}),py=({id:t,children:e,expanded:n=!1})=>{const r=oe.useRef(null),i=oe.useRef(!0),o="height 250ms ease-out",s=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.scrollHeight+"px"})},a=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.offsetHeight+"px",l.style.overflow="hidden",requestAnimationFrame(()=>{l.style.height="0"})})};return oe.useLayoutEffect(()=>{n?s():a()},[n]),oe.useLayoutEffect(()=>{const l=r.current;if(!l)return;function d(){l&&(l.style.overflow=n?"initial":"hidden",n&&(l.style.height="auto"))}function g(y){l&&y.target===l&&y.propertyName==="height"&&d()}return i.current&&(d(),i.current=!1),l.addEventListener("transitionend",g),()=>l.removeEventListener("transitionend",g)},[n]),te.createElement("div",{className:"wallet-adapter-collapse",id:t,ref:r,role:"region",style:{height:0,transition:i.current?void 0:o}},e)},Td=({handleClick:t,tabIndex:e,wallet:n})=>te.createElement("li",null,te.createElement(Y4,{onClick:t,startIcon:te.createElement(G4,{wallet:n}),tabIndex:e},n.adapter.name,n.readyState===$.Installed&&te.createElement("span",null,"Detected"))),H4=()=>te.createElement("svg",{width:"97",height:"96",viewBox:"0 0 97 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},te.createElement("circle",{cx:"48.5",cy:"48",r:"48",fill:"url(#paint0_linear_880_5115)",fillOpacity:"0.1"}),te.createElement("circle",{cx:"48.5",cy:"48",r:"47",stroke:"url(#paint1_linear_880_5115)",strokeOpacity:"0.4",strokeWidth:"2"}),te.createElement("g",{clipPath:"url(#clip0_880_5115)"},te.createElement("path",{d:"M65.5769 28.1523H31.4231C27.6057 28.1523 24.5 31.258 24.5 35.0754V60.9215C24.5 64.7389 27.6057 67.8446 31.4231 67.8446H65.5769C69.3943 67.8446 72.5 64.7389 72.5 60.9215V35.0754C72.5 31.258 69.3943 28.1523 65.5769 28.1523ZM69.7308 52.1523H59.5769C57.2865 52.1523 55.4231 50.289 55.4231 47.9985C55.4231 45.708 57.2864 43.8446 59.5769 43.8446H69.7308V52.1523ZM69.7308 41.0754H59.5769C55.7595 41.0754 52.6539 44.1811 52.6539 47.9985C52.6539 51.8159 55.7595 54.9215 59.5769 54.9215H69.7308V60.9215C69.7308 63.2119 67.8674 65.0754 65.5769 65.0754H31.4231C29.1327 65.0754 27.2692 63.212 27.2692 60.9215V35.0754C27.2692 32.785 29.1326 30.9215 31.4231 30.9215H65.5769C67.8673 30.9215 69.7308 32.7849 69.7308 35.0754V41.0754Z",fill:"url(#paint2_linear_880_5115)"}),te.createElement("path",{d:"M61.4231 46.6172H59.577C58.8123 46.6172 58.1924 47.2371 58.1924 48.0018C58.1924 48.7665 58.8123 49.3863 59.577 49.3863H61.4231C62.1878 49.3863 62.8077 48.7664 62.8077 48.0018C62.8077 47.2371 62.1878 46.6172 61.4231 46.6172Z",fill:"url(#paint3_linear_880_5115)"})),te.createElement("defs",null,te.createElement("linearGradient",{id:"paint0_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint1_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint2_linear_880_5115",x1:"25.9583",y1:"68.7101",x2:"67.2337",y2:"23.7879",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint3_linear_880_5115",x1:"58.3326",y1:"49.4467",x2:"61.0002",y2:"45.4453",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("clipPath",{id:"clip0_880_5115"},te.createElement("rect",{width:"48",height:"48",fill:"white",transform:"translate(24.5 24)"})))),K4=({className:t="",container:e="body"})=>{const n=oe.useRef(null),{wallets:r,select:i}=kM(),{setVisible:o}=CM(),[s,a]=oe.useState(!1),[l,d]=oe.useState(!1),[g,y]=oe.useState(null),[x,v]=oe.useMemo(()=>{const w=[],j=[],C=[];for(const B of r)B.readyState===$.NotDetected?C.push(B):B.readyState===$.Loadable?j.push(B):B.readyState===$.Installed&&w.push(B);let U=[],O=[];return w.length?(U=w,O=[...j,...C]):(j.length&&(U=j),O=C),[U,O]},[r]),A=oe.useCallback(()=>{d(!1),setTimeout(()=>o(!1),150)},[o]),k=oe.useCallback(w=>{w.preventDefault(),A()},[A]),D=oe.useCallback((w,j)=>{i(j),k(w)},[i,k]),I=oe.useCallback(()=>a(!s),[s]),M=oe.useCallback(w=>{const j=n.current;if(!j)return;const C=j.querySelectorAll("button"),U=C[0],O=C[C.length-1];w.shiftKey?document.activeElement===U&&(O.focus(),w.preventDefault()):document.activeElement===O&&(U.focus(),w.preventDefault())},[n]);return oe.useLayoutEffect(()=>{const w=C=>{C.key==="Escape"?A():C.key==="Tab"&&M(C)},{overflow:j}=window.getComputedStyle(document.body);return setTimeout(()=>d(!0),0),document.body.style.overflow="hidden",window.addEventListener("keydown",w,!1),()=>{document.body.style.overflow=j,window.removeEventListener("keydown",w,!1)}},[A,M]),oe.useLayoutEffect(()=>y(document.querySelector(e)),[e]),g&&Lw.createPortal(te.createElement("div",{"aria-labelledby":"wallet-adapter-modal-title","aria-modal":"true",className:`wallet-adapter-modal ${l&&"wallet-adapter-modal-fade-in"} ${t}`,ref:n,role:"dialog"},te.createElement("div",{className:"wallet-adapter-modal-container"},te.createElement("div",{className:"wallet-adapter-modal-wrapper"},te.createElement("button",{onClick:k,className:"wallet-adapter-modal-button-close"},te.createElement("svg",{width:"14",height:"14"},te.createElement("path",{d:"M14 12.461 8.3 6.772l5.234-5.233L12.006 0 6.772 5.234 1.54 0 0 1.539l5.234 5.233L0 12.006l1.539 1.528L6.772 8.3l5.69 5.7L14 12.461z"}))),x.length?te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"Connect a wallet on Solana to continue"),te.createElement("ul",{className:"wallet-adapter-modal-list"},x.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),wallet:w})),v.length?te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))):null),v.length?te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Less ":"More ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))):null):te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"You'll need a wallet on Solana to continue"),te.createElement("div",{className:"wallet-adapter-modal-middle"},te.createElement(H4,null)),v.length?te.createElement(te.Fragment,null,te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Hide ":"Already have a wallet? View ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))),te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},te.createElement("ul",{className:"wallet-adapter-modal-list"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))))):null))),te.createElement("div",{className:"wallet-adapter-modal-overlay",onMouseDown:k})),g)},J4=({children:t,...e})=>{const[n,r]=oe.useState(!1);return te.createElement(RM.Provider,{value:{visible:n,setVisible:r}},t,n&&te.createElement(K4,{...e}))};const V0="-";function X4(t){const e=$4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;function i(s){const a=s.split(V0);return a[0]===""&&a.length!==1&&a.shift(),OM(a,e)||q4(s)}function o(s,a){const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function OM(t,e){var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?OM(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(V0);return(s=e.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId}const gy=/^\[(.+)\]$/;function q4(t){if(gy.test(t)){const e=gy.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function $4(t){const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return t2(Object.entries(t.classGroups),n).forEach(([o,s])=>{ih(s,r,o,e)}),r}function ih(t,e,n,r){t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:yy(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(e2(i)){ih(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{ih(s,yy(e,o),n,r)})})}function yy(t,e){let n=t;return e.split(V0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function e2(t){return t.isThemeGetter}function t2(t,e){return e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[e+s,a])):o);return[n,i]}):t}function n2(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const BM="!";function r2(t){const e=t.separator,n=e.length===1,r=e[0],i=e.length;return function(s){const a=[];let l=0,d=0,g;for(let k=0;kd?g-d:void 0;return{modifiers:a,hasImportantModifier:x,baseClassName:v,maybePostfixModifierPosition:A}}}function i2(t){if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e}function o2(t){return{cache:n2(t.cacheSize),splitModifiers:r2(t),...X4(t)}}const s2=/\s+/;function a2(t,e){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=new Set;return t.trim().split(s2).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:d,maybePostfixModifierPosition:g}=n(s);let y=r(g?d.substring(0,g):d),x=!!g;if(!y){if(!g)return{isTailwindClass:!1,originalClassName:s};if(y=r(d),!y)return{isTailwindClass:!1,originalClassName:s};x=!1}const v=i2(a).join(":");return{isTailwindClass:!0,modifierId:l?v+BM:v,classGroupId:y,originalClassName:s,hasPostfixModifier:x}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:d}=s,g=a+l;return o.has(g)?!1:(o.add(g),i(l,d).forEach(y=>o.add(a+y)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function l2(){let t=0,e,n,r="";for(;ty(g),t());return n=o2(d),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const g=a2(l,n);return i(l,g),g}return function(){return o(l2.apply(null,arguments))}}function it(t){const e=n=>n[t]||[];return e.isThemeGetter=!0,e}const WM=/^\[(?:([a-z-]+):)?(.+)\]$/i,u2=/^\d+\/\d+$/,d2=new Set(["px","full","screen"]),f2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,h2=/\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$/,p2=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,g2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function fr(t){return lo(t)||d2.has(t)||u2.test(t)}function gi(t){return Ds(t,"length",I2)}function lo(t){return!!t&&!Number.isNaN(Number(t))}function hl(t){return Ds(t,"number",lo)}function Vs(t){return!!t&&Number.isInteger(Number(t))}function y2(t){return t.endsWith("%")&&lo(t.slice(0,-1))}function be(t){return WM.test(t)}function yi(t){return f2.test(t)}const m2=new Set(["length","size","percentage"]);function w2(t){return Ds(t,m2,VM)}function M2(t){return Ds(t,"position",VM)}const N2=new Set(["image","url"]);function v2(t){return Ds(t,N2,k2)}function S2(t){return Ds(t,"",b2)}function Ps(){return!0}function Ds(t,e,n){const r=WM.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1}function I2(t){return h2.test(t)}function VM(){return!1}function b2(t){return p2.test(t)}function k2(t){return g2.test(t)}function E2(){const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),i=it("borderColor"),o=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),d=it("grayscale"),g=it("hueRotate"),y=it("invert"),x=it("gap"),v=it("gradientColorStops"),A=it("gradientColorStopPositions"),k=it("inset"),D=it("margin"),I=it("opacity"),M=it("padding"),w=it("saturate"),j=it("scale"),C=it("sepia"),U=it("skew"),O=it("space"),B=it("translate"),Y=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",be,e],ie=()=>[be,e],R=()=>["",fr,gi],c=()=>["auto",lo,be],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],S=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],b=()=>["start","end","center","between","around","evenly","stretch"],N=()=>["","0",be],T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],m=()=>[lo,hl],u=()=>[lo,be];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[fr,gi],blur:["none","",yi,be],brightness:m(),borderColor:[t],borderRadius:["none","","full",yi,be],borderSpacing:ie(),borderWidth:R(),contrast:m(),grayscale:N(),hueRotate:u(),invert:N(),gap:ie(),gradientColorStops:[t],gradientColorStopPositions:[y2,gi],inset:q(),margin:q(),opacity:m(),padding:ie(),saturate:m(),scale:m(),sepia:N(),skew:u(),space:ie(),translate:ie()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[yi]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),be]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Vs,be]}],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",be]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:["first","last","none",Vs,be]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Vs,be]},be]}],"col-start":[{"col-start":c()}],"col-end":[{"col-end":c()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Vs,be]},be]}],"row-start":[{"row-start":c()}],"row-end":[{"row-end":c()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...b()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...b(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...b(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],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":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",be,e]}],"min-w":[{"min-w":["min","max","fit",be,fr]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[yi]},yi,be]}],h:[{h:[be,e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",fr,be]}],"max-h":[{"max-h":[be,e,"min","max","fit"]}],"font-size":[{text:["base",yi,gi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hl]}],"font-family":[{font:[Ps]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",be]}],"line-clamp":[{"line-clamp":["none",lo,hl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fr,be]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...S(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,gi]}],"underline-offset":[{"underline-offset":["auto",fr,be]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:ie()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],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",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),M2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",w2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},v2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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":[I]}],"border-style":[{border:[...S(),"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":[I]}],"divide-style":[{divide:S()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[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:["",...S()]}],"outline-offset":[{"outline-offset":[fr,be]}],"outline-w":[{outline:[fr,gi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[fr,gi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yi,S2]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":z()}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",yi,be]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[y]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",be]}],duration:[{duration:u()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:u()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Vs,be]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",be]}],accent:[{accent:["auto",t]}],appearance:["appearance-none"],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",be]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ie()}],"scroll-mx":[{"scroll-mx":ie()}],"scroll-my":[{"scroll-my":ie()}],"scroll-ms":[{"scroll-ms":ie()}],"scroll-me":[{"scroll-me":ie()}],"scroll-mt":[{"scroll-mt":ie()}],"scroll-mr":[{"scroll-mr":ie()}],"scroll-mb":[{"scroll-mb":ie()}],"scroll-ml":[{"scroll-ml":ie()}],"scroll-p":[{"scroll-p":ie()}],"scroll-px":[{"scroll-px":ie()}],"scroll-py":[{"scroll-py":ie()}],"scroll-ps":[{"scroll-ps":ie()}],"scroll-pe":[{"scroll-pe":ie()}],"scroll-pt":[{"scroll-pt":ie()}],"scroll-pr":[{"scroll-pr":ie()}],"scroll-pb":[{"scroll-pb":ie()}],"scroll-pl":[{"scroll-pl":ie()}],"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",be]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[fr,gi,hl]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"]},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"],"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"],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-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"]}}}const x2=c2(E2),T2=t=>at.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 56 64",...t,children:[at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",d:"m28 4 .015 13.1M52.46 46.01l-11.137-6.555M4.099 46.01l11.137-6.555"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M28.009 32.01 15 24.49l13.009-7.518L41 24.52l-12.991 7.49Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28.02 46.969-13.003-7.463L15 24.49l13.02 7.52V46.97Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28 46.969 13.003-7.43V24.521L28 32.01v14.958Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M52 46.01V18.032L28 4.042 4 18.032V46.01L28 60l24-13.99Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M4.04 18.056 28 32.047l24.04-13.99"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"3",d:"M28 32.046V60"})]}),A2=oe.lazy(()=>Ba(()=>import("./widget-93dd4fab.js"),[])),D2=({rootWrapperClassNames:t,rootWrapperStyles:e,isDark:n,...r})=>{const[i,o]=oe.useState(!1);return at.jsxs("div",{className:x2("bonfida-widget-root sns-bw",t,n&&"dark"),style:e,children:[at.jsx("button",{onClick:()=>o(!i),className:"w-[50px] h-[50px] rounded-full bg-background-primary overflow-hidden text-text-primary p-2 flex items-center justify-center shadow-xl dark:border dark:border-interactive-border",type:"button","aria-label":i?"Close SNS widget":"Open SNS widget","aria-haspopup":"true",tabIndex:0,children:at.jsx(T2,{className:"w-full h-full"})}),i&&at.jsx(oe.Suspense,{children:at.jsx(A2,{...r})})]})};const L2="https://helius-proxy.bonfida.com",z2=({children:t})=>at.jsx(a4,{autoConnect:!0,wallets:[new B4,new W4,new E4,new N4,new h4,new b4,new S4,new c4,new T4,new P4,new D4,new z4,new Z4],children:at.jsx(J4,{children:t})}),j2=()=>{const t=kM(),{visible:e,setVisible:n}=CM(),[r,i]=oe.useState(!1);return at.jsxs("div",{className:"p-10",children:[at.jsx("h1",{className:"text-[40px] text-center text-white font-medium",children:"SNS Widget Demo"}),at.jsx("div",{className:"mt-10",children:at.jsx("button",{className:"p-3 bg-white rounded-[24px] font-medium",onClick:()=>i(!r),children:"Toggle dark"})}),at.jsx(D2,{endpoint:L2,passthroughWallet:{...t,visible:e,setVisible:n},isDark:r})]})};function U2(){return at.jsx(z2,{children:at.jsx(j2,{})})}const _2="/sns-widget/assets/preview-bg-7f26f3aa.png";Ad.createRoot(document.getElementById("root")).render(at.jsx(te.StrictMode,{children:at.jsx("div",{style:{backgroundImage:`url(${_2})`,backgroundSize:"cover",height:"100vh",width:"100vw"},children:at.jsx(U2,{})})}));export{ye as A,fg as B,Mx as C,Tf as D,C2 as E,R2 as F,Fx as G,mT as H,Le as I,wT as J,_I as K,Rx as L,qr as M,_f as N,Kt as O,X as P,Uo as Q,te as R,B4 as S,Ue as T,ws as V,a4 as W,Cx as a,kM as b,CM as c,J4 as d,st as e,sb as f,my as g,Wt as h,V2 as i,at as j,L1 as k,_e as l,Xe as m,ue as n,cn as o,vr as p,_c as q,oe as r,de as s,x2 as t,Ox as u,Or as v,t1 as w,Ms as x,Lr as y,Rf as z}; +`,e)}return Fn}function cy(...t){var e;return t=t.filter(n=>!zl.has(n)),t.length?(t.forEach(n=>zl.add(n)),(e=Ko.register)==null||e.forEach(n=>Hf(()=>n(...t))),function(){var r;t.forEach(i=>zl.delete(i)),(r=Ko.unregister)==null||r.forEach(i=>Hf(()=>i(...t)))}):()=>{}}function KT(){return[...zl]}function JT(t,e){var n;return(n=Ko[t])!=null&&n.push(e)||(Ko[t]=[e]),function(){var i;Ko[t]=(i=Ko[t])==null?void 0:i.filter(o=>e!==o)}}function Hf(t){try{t()}catch(e){console.error(e)}}class XT extends Event{constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),Ll.set(this,void 0),YT(this,Ll,e,"f")}get detail(){return GT(this,Ll,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Ll=new WeakMap;function qT(){if(Fn||(Fn=HT(),typeof window>"u"))return Fn;const t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),Fn;const{register:e}=Fn,n=(...r)=>r.forEach(i=>Hf(()=>i({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:n})})}catch{return console.error("window.navigator.wallets could not be set"),Fn}return n(...t),Fn}function $T(t){const e=uy(()=>new Set),{get:n,on:r}=uy(()=>qT()),[i,o]=oe.useState(()=>dy(n()));oe.useEffect(()=>{const a=[r("register",(...l)=>o(d=>[...d,...dy(l)])),r("unregister",(...l)=>o(d=>d.filter(g=>l.some(y=>y===g.wallet))))];return()=>a.forEach(l=>l())},[r]);const s=e4(i);return oe.useEffect(()=>{if(!s)return;const a=new Set(i);new Set(s.filter(d=>!a.has(d))).forEach(d=>d.destroy())},[s,i]),oe.useEffect(()=>()=>i.forEach(a=>a.destroy()),[]),oe.useMemo(()=>[...i,...t.filter(({name:a})=>i.some(l=>l.name===a)?(e.has(a)||(e.add(a),console.warn(`${a} was registered as a Standard Wallet. The Wallet Adapter for ${a} can be removed from your app.`)),!1):!0)],[i,t,e])}function uy(t){const e=oe.useRef();return e.current||(e.current={value:t()}),e.current.value}function e4(t){const e=oe.useRef();return oe.useEffect(()=>{e.current=t}),e.current}function dy(t){return t.filter(ZT).map(e=>new QT({wallet:e}))}var ss;(function(t){t[t.DESKTOP_WEB=0]="DESKTOP_WEB",t[t.MOBILE_WEB=1]="MOBILE_WEB"})(ss||(ss={}));function t4(t){return/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(t)}function n4({adapters:t,userAgentString:e}){return t.some(n=>n.name!==Mi&&n.readyState===$.Installed)?ss.DESKTOP_WEB:e&&/android/i.test(e)&&!t4(e)?ss.MOBILE_WEB:ss.DESKTOP_WEB}function r4(t){return t?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta"}function i4({children:t,wallets:e,adapter:n,isUnloadingRef:r,onAutoConnectRequest:i,onConnectError:o,onError:s,onSelectWallet:a}){const l=oe.useRef(!1),[d,g]=oe.useState(!1),y=oe.useRef(!1),[x,v]=oe.useState(!1),[A,k]=oe.useState(()=>(n==null?void 0:n.publicKey)??null),[D,I]=oe.useState(()=>(n==null?void 0:n.connected)??!1),M=oe.useRef(s);oe.useEffect(()=>(M.current=s,()=>{M.current=void 0}),[s]);const w=oe.useRef((p,S)=>(r.current||(M.current?M.current(p,S):(console.error(p,S),p instanceof en&&typeof window<"u"&&S&&window.open(S.url,"_blank"))),p)),[j,C]=oe.useState(()=>e.map(p=>({adapter:p,readyState:p.readyState})).filter(({readyState:p})=>p!==$.Unsupported));oe.useEffect(()=>{C(S=>e.map((z,b)=>{const N=S[b];return N&&N.adapter===z&&N.readyState===z.readyState?N:{adapter:z,readyState:z.readyState}}).filter(({readyState:z})=>z!==$.Unsupported));function p(S){C(z=>{const b=z.findIndex(({adapter:T})=>T===this);if(b===-1)return z;const{adapter:N}=z[b];return[...z.slice(0,b),{adapter:N,readyState:S},...z.slice(b+1)].filter(({readyState:T})=>T!==$.Unsupported)})}return e.forEach(S=>S.on("readyStateChange",p,S)),()=>{e.forEach(S=>S.off("readyStateChange",p,S))}},[n,e]);const U=oe.useMemo(()=>j.find(p=>p.adapter===n)??null,[n,j]);oe.useEffect(()=>{if(!n)return;const p=b=>{k(b),l.current=!1,g(!1),I(!0),y.current=!1,v(!1)},S=()=>{r.current||(k(null),l.current=!1,g(!1),I(!1),y.current=!1,v(!1))},z=b=>{w.current(b,n)};return n.on("connect",p),n.on("disconnect",S),n.on("error",z),()=>{n.off("connect",p),n.off("disconnect",S),n.off("error",z),S()}},[n,r]);const O=oe.useRef(!1);oe.useEffect(()=>()=>{O.current=!1},[n]),oe.useEffect(()=>{O.current||l.current||D||!i||!((U==null?void 0:U.readyState)===$.Installed||(U==null?void 0:U.readyState)===$.Loadable)||(l.current=!0,g(!0),O.current=!0,async function(){try{await i()}catch{o()}finally{g(!1),l.current=!1}}())},[D,i,o,U]);const B=oe.useCallback(async(p,S,z)=>{if(!n)throw w.current(new ey);if(!D)throw w.current(new me,n);return await n.sendTransaction(p,S,z)},[n,D]),Y=oe.useMemo(()=>n&&"signTransaction"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signTransaction(p)}:void 0,[n,D]),G=oe.useMemo(()=>n&&"signAllTransactions"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signAllTransactions(p)}:void 0,[n,D]),q=oe.useMemo(()=>n&&"signMessage"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signMessage(p)}:void 0,[n,D]),ie=oe.useMemo(()=>n&&"signIn"in n?async p=>await n.signIn(p):void 0,[n]),R=oe.useCallback(async()=>{if(l.current||y.current||U!=null&&U.adapter.connected)return;if(!U)throw w.current(new ey);const{adapter:p,readyState:S}=U;if(!(S===$.Installed||S===$.Loadable))throw w.current(new en,p);l.current=!0,g(!0);try{await p.connect()}catch(z){throw o(),z}finally{g(!1),l.current=!1}},[o,U]),c=oe.useCallback(async()=>{if(!y.current&&n){y.current=!0,v(!0);try{await n.disconnect()}finally{v(!1),y.current=!1}}},[n]);return te.createElement(bM.Provider,{value:{autoConnect:!!i,wallets:j,wallet:U,publicKey:A,connected:D,connecting:d,disconnecting:x,select:a,connect:R,disconnect:c,sendTransaction:B,signTransaction:Y,signAllTransactions:G,signMessage:q,signIn:ie}},t)}let Ed;function o4(){var t;return Ed===void 0&&(Ed=((t=globalThis.navigator)==null?void 0:t.userAgent)??null),Ed}function dl(t){const e=o4();return n4({adapters:t,userAgentString:e})===ss.MOBILE_WEB}function s4(){const t=globalThis.location;if(t)return`${t.protocol}//${t.host}`}function a4({children:t,wallets:e,autoConnect:n,localStorageKey:r="walletName",onError:i}){const{connection:o}=Ox(),s=$T(e),a=oe.useMemo(()=>{if(!dl(s))return null;const M=s.find(w=>w.name===Mi);return M||new kT({addressSelector:ET(),appIdentity:{uri:s4()},authorizationResultCache:xT(),cluster:r4(o==null?void 0:o.rpcEndpoint),onWalletNotFound:AT()})},[s,o==null?void 0:o.rpcEndpoint]),l=oe.useMemo(()=>a==null||s.indexOf(a)!==-1?s:[a,...s],[s,a]),[d,g]=Px(r,dl(s)?Mi:null),y=oe.useMemo(()=>l.find(M=>M.name===d)??null,[l,d]),x=oe.useCallback(M=>{d!==M&&(y&&y.name!==Mi&&y.disconnect(),g(M))},[y,g,d]);oe.useEffect(()=>{if(!y)return;function M(){k.current||d===Mi&&dl(s)||g(null)}return y.on("disconnect",M),()=>{y.off("disconnect",M)}},[y,s,g,d]);const v=oe.useRef(!1),A=oe.useMemo(()=>{if(!(!n||!y))return async()=>{(n===!0||await n(y))&&(v.current?await y.connect():await y.autoConnect())}},[n,y]),k=oe.useRef(!1);oe.useEffect(()=>{if(d===Mi&&dl(s)){k.current=!1;return}function M(){k.current=!0}return window.addEventListener("beforeunload",M),()=>{window.removeEventListener("beforeunload",M)}},[s,d]);const D=oe.useCallback(()=>{y&&y.name!==Mi&&x(null)},[y,x]),I=oe.useCallback(M=>{v.current=!0,x(M)},[x]);return te.createElement(i4,{wallets:l,adapter:y,isUnloadingRef:k,onAutoConnectRequest:A,onConnectError:D,onError:i,onSelectWallet:I},t)}const l4="BitKeep";class c4 extends Xn{constructor(e={}){super(),this.name=l4,this.url="https://bitkeep.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iNjQiIGZpbGw9IiM3NTI0RjkiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMDIgNDUuNjAyN1Y0OS44MjA0QzEwMi4wMDEgNTAuMjI4MyAxMDEuODkzIDUwLjYyOTIgMTAxLjY4NyA1MC45ODI3QzEwMS40ODEgNTEuMzM2MSAxMDEuMTg1IDUxLjYyOTYgMTAwLjgyOCA1MS44MzM1TDg3LjA5MDggNTkuNjgwMUw5OS4zNjMzIDY2LjY3MUMxMDAuMTY1IDY3LjEyOTUgMTAwLjgzMSA2Ny43ODkyIDEwMS4yOTQgNjguNTgzNkMxMDEuNzU3IDY5LjM3OCAxMDIuMDAxIDcwLjI3OTEgMTAyIDcxLjE5NjJWODIuNDQyNEMxMDIuMDAxIDgzLjM2IDEwMS43NTggODQuMjYxNyAxMDEuMjk1IDg1LjA1NjdDMTAwLjgzMiA4NS44NTE2IDEwMC4xNjYgODYuNTExNyA5OS4zNjMzIDg2Ljk3MDVMNjcuMDg2OSAxMDUuM0M2Ni4yODUzIDEwNS43NTkgNjUuMzc1OSAxMDYgNjQuNDUwMiAxMDZDNjMuNTI0NSAxMDYgNjIuNjE1MSAxMDUuNzU5IDYxLjgxMzUgMTA1LjNMNTEuMjUyIDk5LjI2MTFDNTEuMDczNyA5OS4xNTkzIDUwLjkyNTYgOTkuMDEyOCA1MC44MjI3IDk4LjgzNjNDNTAuNzE5OCA5OC42NTk5IDUwLjY2NTYgOTguNDU5NyA1MC42NjU2IDk4LjI1NkM1MC42NjU2IDk4LjA1MjIgNTAuNzE5OCA5Ny44NTIgNTAuODIyNyA5Ny42NzU2QzUwLjkyNTYgOTcuNDk5MSA1MS4wNzM3IDk3LjM1MjcgNTEuMjUyIDk3LjI1MDhMODYuMTE1MiA3Ny4zODM1Qzg2LjIwNCA3Ny4zMzI1IDg2LjI3NzcgNzcuMjU5MyA4Ni4zMjkgNzcuMTcxMkM4Ni4zODAyIDc3LjA4MzIgODYuNDA3MiA3Ni45ODMzIDg2LjQwNzIgNzYuODgxN0M4Ni40MDcyIDc2Ljc4IDg2LjM4MDIgNzYuNjgwMiA4Ni4zMjkgNzYuNTkyMUM4Ni4yNzc3IDc2LjUwNCA4Ni4yMDQgNzYuNDMwOCA4Ni4xMTUyIDc2LjM3OThMNzMuMTcxOSA2OC45NzcxQzcyLjgxNTYgNjguNzczNCA3Mi40MTE0IDY4LjY2NjIgNzIgNjguNjY2MkM3MS41ODg2IDY4LjY2NjIgNzEuMTg0NCA2OC43NzM0IDcwLjgyODEgNjguOTc3MUwzNS40MTcgODkuMTcyMkMzNS4xNDk4IDg5LjMyNSAzNC44NDY3IDg5LjQwNTQgMzQuNTM4MSA4OS40MDU0QzM0LjIyOTUgODkuNDA1NCAzMy45MjY0IDg5LjMyNSAzMy42NTkyIDg5LjE3MjJMMjkuNjQ4NCA4Ni45MDA5QzI4Ljg0MjQgODYuNDQyOCAyOC4xNzI5IDg1Ljc4MiAyNy43MDc4IDg0Ljk4NTNDMjcuMjQyNyA4NC4xODg2IDI2Ljk5ODUgODMuMjg0MyAyNyA4Mi4zNjQxVjc3Ljc2NjRDMjYuOTk5OCA3Ny40NjA3IDI3LjA4MDkgNzcuMTYwMyAyNy4yMzUyIDc2Ljg5NTVDMjcuMzg5NSA3Ni42MzA3IDI3LjYxMTUgNzYuNDEwOSAyNy44Nzg5IDc2LjI1OEw3OC42NTA0IDQ3LjM2OTNDNzguNzM5MiA0Ny4zMTgzIDc4LjgxMjkgNDcuMjQ1MSA3OC44NjQxIDQ3LjE1N0M3OC45MTU0IDQ3LjA2ODkgNzguOTQyMyA0Ni45NjkxIDc4Ljk0MjMgNDYuODY3NEM3OC45NDIzIDQ2Ljc2NTggNzguOTE1NCA0Ni42NjU5IDc4Ljg2NDEgNDYuNTc3OUM3OC44MTI5IDQ2LjQ4OTggNzguNzM5MiA0Ni40MTY2IDc4LjY1MDQgNDYuMzY1Nkw2NS42ODY1IDM4LjkzNjdDNjUuMzMwMiAzOC43MzMxIDY0LjkyNjEgMzguNjI1OCA2NC41MTQ2IDM4LjYyNThDNjQuMTAzMiAzOC42MjU4IDYzLjY5OTEgMzguNzMzMSA2My4zNDI4IDM4LjkzNjdMMjguNzU3OCA1OC42M0MyOC41Nzk4IDU4LjczMTggMjguMzc3OCA1OC43ODU0IDI4LjE3MjIgNTguNzg1NUMyNy45NjY2IDU4Ljc4NTUgMjcuNzY0NiA1OC43MzIgMjcuNTg2NSA1OC42MzAzQzI3LjQwODQgNTguNTI4NiAyNy4yNjA0IDU4LjM4MjMgMjcuMTU3NSA1OC4yMDYxQzI3LjA1NDUgNTguMDI5OSAyNy4wMDAyIDU3LjgzIDI3IDU3LjYyNjRWNDUuNTQ3NkMyNi45OTg5IDQ0LjYzIDI3LjI0MiA0My43MjgzIDI3LjcwNDkgNDIuOTMzNEMyOC4xNjc4IDQyLjEzODQgMjguODM0MSA0MS40NzgzIDI5LjYzNjcgNDEuMDE5NUw2MS45MDcyIDIyLjY5NTRDNjIuNzA3MSAyMi4yMzk4IDYzLjYxMzggMjIgNjQuNTM2NiAyMkM2NS40NTk0IDIyIDY2LjM2NjEgMjIuMjM5OCA2Ny4xNjYgMjIuNjk1NEw5OS4zNjMzIDQxLjA4MzNDMTAwLjE2NSA0MS41NDE0IDEwMC44MyA0Mi4yMDAxIDEwMS4yOTMgNDIuOTkzNEMxMDEuNzU2IDQzLjc4NjcgMTAyIDQ0LjY4NjYgMTAyIDQ1LjYwMjdaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.bitkeep)==null?void 0:n.solana)!=null&&r.isBitKeep?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.bitkeep.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const u4="modulepreload",d4=function(t){return"/sns-widget/"+t},fy={},Ba=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=d4(o),o in fy)return;fy[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let g=i.length-1;g>=0;g--){const y=i[g];if(y.href===o&&(!s||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const d=document.createElement("link");if(d.rel=s?"stylesheet":u4,s||(d.as="script",d.crossOrigin=""),d.href=o,document.head.appendChild(d),s)return new Promise((g,y)=>{d.addEventListener("load",g),d.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},f4="Clover";class h4 extends Xn{constructor(e={}){super(),this.name=f4,this.url="https://clv.org",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTM2LjQ4IDBIMTEuNTJDNS4xNTc2OCAwIDAgNS4xNTc2OCAwIDExLjUyVjM2LjQ4QzAgNDIuODQyMyA1LjE1NzY4IDQ4IDExLjUyIDQ4SDM2LjQ4QzQyLjg0MjMgNDggNDggNDIuODQyMyA0OCAzNi40OFYxMS41MkM0OCA1LjE1NzY4IDQyLjg0MjMgMCAzNi40OCAwWiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzc5MTBfMTYzMzUxKSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTI0LjAwMDYgMzkuMzYwNkMzMi40ODM3IDM5LjM2MDYgMzkuMzYwNiAzMi40ODM3IDM5LjM2MDYgMjQuMDAwNkMzOS4zNjA2IDE1LjUxNzUgMzIuNDgzNyA4LjY0MDYyIDI0LjAwMDYgOC42NDA2MkMxNS41MTc1IDguNjQwNjIgOC42NDA2MiAxNS41MTc1IDguNjQwNjIgMjQuMDAwNkM4LjY0MDYyIDMyLjQ4MzcgMTUuNTE3NSAzOS4zNjA2IDI0LjAwMDYgMzkuMzYwNlpNMjEuMjg5OSAxNS44Njg4SDI2LjcxMVYyMS4zNDdIMjEuMjkwNFYyNi42NTRIMjYuNzExVjMyLjEzMjJIMjEuMjg5OVYyNi44MjUySDE1Ljg2OTNWMjEuMzQ3SDIxLjI4OTlWMTUuODY4OFpNMjYuNzEyIDIxLjM0N0gzMi4xMzMxVjI2LjgyNTJIMjYuNzEyVjIxLjM0N1oiIGZpbGw9ImJsYWNrIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNzkxMF8xNjMzNTEiIHgxPSI0OCIgeTE9Ii0xLjQzMDUxZS0wNiIgeDI9IjEuNDMwNTFlLTA2IiB5Mj0iNDgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0E5RkZFMCIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM4NkQ1RkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.clover_solana)!=null&&n.isCloverWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.clover_solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return Uint8Array.from(r)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}var fl=_c.Buffer;function p4(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(M);D!==I;){for(var j=v[D],C=0,U=M-1;(j!==0||C>>0,w[U]=j%s>>>0,j=j/s>>>0;if(j!==0)throw new Error("Non-zero carry");k=C,D++}for(var O=M-k;O!==M&&w[O]===0;)O++;for(var B=a.repeat(A);O>>0,M=new Uint8Array(I);v[A];){var w=e[v.charCodeAt(A)];if(w===255)return;for(var j=0,C=I-1;(w!==0||j>>0,M[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=j,A++}for(var U=I-D;U!==I&&M[U]===0;)U++;var O=fl.allocUnsafe(k+(I-U));O.fill(0,0,k);for(var B=k;U!==I;)O[B++]=M[U++];return O}function x(v){var A=y(v);if(A)return A;throw new Error("Non-base"+s+" character")}return{encode:g,decodeUnsafe:y,decode:x}}var g4=p4,y4=g4,m4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",w4=y4(m4);const xd=Or(w4),M4="Coin98";class N4 extends Xn{constructor(e={}){super(),this.name=M4,this.url="https://coin98.com",this.icon="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3NiA3NSI+CiAgPGRlZnM+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSIxMDEuNjgxJSIgeDI9Ii0xLjU1NyUiIHkxPSIxNS4yNjglIiB5Mj0iODQuOTE3JSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNGMUQ5NjEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjQ0RBMTQ2Ii8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPHJlY3Qgd2lkdGg9Ijc1IiBoZWlnaHQ9Ijc1IiBmaWxsPSIjMDAwIiByeD0iMTYiLz4KICAgIDxwYXRoIGZpbGw9InVybCgjYSkiIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYxLjQ0IDBhMTMuNzE0IDEzLjcxNCAwIDAgMSA5LjY4IDQuMDEgMTMuNjYxIDEzLjY2MSAwIDAgMSA0LjAwOCA5LjY2OHY0Ny42NDZhMTMuNjYgMTMuNjYgMCAwIDEtNC4wMDcgOS42NjZBMTMuNzEzIDEzLjcxMyAwIDAgMSA2MS40NCA3NUgxMy42ODZhMTMuNzEzIDEzLjcxMyAwIDAgMS05LjY4LTQuMDFBMTMuNjYgMTMuNjYgMCAwIDEgMCA2MS4zMjRWMTMuNjc4YzAtMy42MjUgMS40NC03LjEwMiA0LjAwNy05LjY2N0ExMy43MTQgMTMuNzE0IDAgMCAxIDEzLjY4NyAwWk0yMC4wNjMgNDYuMjMxaC00LjgyNWExMC4wMzIgMTAuMDMyIDAgMCAwIDIuOTQ2IDcuMDg2IDEwLjA3IDEwLjA3IDAgMCAwIDcuMSAyLjk0MiAxMC4wNjUgMTAuMDY1IDAgMCAwIDcuMTA4LTIuOTM1IDEwLjAzIDEwLjAzIDAgMCAwIDIuOTQ2LTcuMDkzaC00LjgyNGE1LjIwNyA1LjIwNyAwIDAgMS0xLjUzIDMuNjg4IDUuMjI1IDUuMjI1IDAgMCAxLTMuNjk2IDEuNTI4IDUuMjM0IDUuMjM0IDAgMCAxLTMuNjk1LTEuNTI4IDUuMjEzIDUuMjEzIDAgMCAxLTEuNTMtMy42ODhaTTU0LjMzIDMzLjcxNmExMS43NjMgMTEuNzYzIDAgMCAwLTEyLjc5OSAyLjUzOEExMS42OTcgMTEuNjk3IDAgMCAwIDM4Ljk5IDQ5LjAzYTExLjcyMyAxMS43MjMgMCAwIDAgNC4zMjggNS4yNTkgMTEuNzU3IDExLjc1NyAwIDAgMCA2LjUyNiAxLjk3IDExLjc2NiAxMS43NjYgMCAwIDAgOC4yOS0zLjQzNSAxMS43MiAxMS43MiAwIDAgMCAzLjQ0Mi04LjI3NCAxMS43MDIgMTEuNzAyIDAgMCAwLTEuOTc1LTYuNTE0IDExLjczNiAxMS43MzYgMCAwIDAtNS4yNjktNC4zMlptLTQuNDg4IDMuOTJhNi45MzcgNi45MzcgMCAwIDEgNC45IDIuMDI1IDYuOTEgNi45MSAwIDAgMSAyLjAyOCA0Ljg5MiA2Ljg5NyA2Ljg5NyAwIDAgMS0xLjE3IDMuODM0IDYuOTMyIDYuOTMyIDAgMCAxLTEwLjY0MyAxLjA0MiA2LjkwMiA2LjkwMiAwIDAgMS0xLjUtNy41MjIgNi45MDkgNi45MDkgMCAwIDEgMi41NDQtMy4xIDYuOTI4IDYuOTI4IDAgMCAxIDMuODQxLTEuMTY3Wm0uMTcgNC41NTJhMi40MzEgMi40MzEgMCAwIDAtMi4yNDEgMS4xNTQgMi40MTggMi40MTggMCAwIDAtLjM1NiAxLjI1NyAyLjM5NSAyLjM5NSAwIDAgMCAxLjYxOSAyLjI5djEuNzUzaDEuNjE4di0xLjc1NGEyLjQyNyAyLjQyNyAwIDAgMCAxLjU5NC0xLjk1IDIuNDE4IDIuNDE4IDAgMCAwLTEtMi4zMSAyLjQzMSAyLjQzMSAwIDAgMC0xLjIzNC0uNDRabS0yMC4yMi0yMi41NTJhMTEuNzYyIDExLjc2MiAwIDAgMC0xMi43OTYgMi41MzEgMTEuNjk3IDExLjY5NyAwIDAgMC0yLjU1NCAxMi43NjkgMTEuNzIzIDExLjcyMyAwIDAgMCA0LjMyIDUuMjYyIDExLjc1NyAxMS43NTcgMCAwIDAgMTQuODI1LTEuNDQ2IDExLjcxNyAxMS43MTcgMCAwIDAgMy40NDUtOC4yODQgMTEuNzAzIDExLjcwMyAwIDAgMC0xLjk3NC02LjUxMiAxMS43MzYgMTEuNzM2IDAgMCAwLTUuMjY2LTQuMzJabS00LjUxIDMuOTE3YTYuOTQ1IDYuOTQ1IDAgMCAxIDQuODk3IDIuMDI5IDYuOTE4IDYuOTE4IDAgMCAxIDIuMDMyIDQuODg2IDYuOTA2IDYuOTA2IDAgMCAxLTEuMTY4IDMuODQyIDYuOTQgNi45NCAwIDAgMS0xMC42NiAxLjA0OCA2LjkxMSA2LjkxMSAwIDAgMS0xLjUtNy41MzYgNi45MTggNi45MTggMCAwIDEgMi41NS0zLjEwMyA2LjkzNyA2LjkzNyAwIDAgMSAzLjg1LTEuMTY2Wm0yNC41Ni00LjgxYTEwLjA1OSAxMC4wNTkgMCAwIDAtNy4xMDMgMi45NCAxMC4wMiAxMC4wMiAwIDAgMC0yLjk0IDcuMDkgOS45IDkuOSAwIDAgMCAxLjIzIDQuNzk1IDEzLjU3NSAxMy41NzUgMCAwIDEgNC4yMTQtMi4zMjIgNS4wODIgNS4wODIgMCAwIDEtLjYyNS0yLjQ3NyA1LjIwNiA1LjIwNiAwIDAgMSAxLjUwMy0zLjczNiA1LjIyMyA1LjIyMyAwIDAgMSAzLjcyMi0xLjU1NCA1LjIzNCA1LjIzNCAwIDAgMSAzLjcyIDEuNTU0IDUuMjEzIDUuMjEzIDAgMCAxIDEuNTA1IDMuNzM2IDUuMjc5IDUuMjc5IDAgMCAxLS42MjMgMi40NzMgMTMuNTc0IDEzLjU3NCAwIDAgMSA0LjIxMyAyLjMyMiA5LjkwMyA5LjkwMyAwIDAgMCAxLjIzLTQuNzk1IDEwLjAzMiAxMC4wMzIgMCAwIDAtMi45NDYtNy4wODYgMTAuMDcgMTAuMDcgMCAwIDAtNy4xLTIuOTRabS0yMy43NSA3Ljk5aC0xLjYxN3YxLjc1YTIuNDE5IDIuNDE5IDAgMCAwLTEuNTgyIDIuNjg3IDIuNDE0IDIuNDE0IDAgMCAwIDIuMzkgMi4wMDYgMi40NSAyLjQ1IDAgMCAwIDEuNTU1LS41NzQgMi40MTQgMi40MTQgMCAwIDAtLjc0Ni00LjExOXYtMS43NVoiLz4KICA8L2c+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.coin98)!=null&&n.sol?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected())}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coin98.sol;let n;try{n=(await e.connect())[0]}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_sign",params:[e]}),i=new X(r.publicKey),o=xd.decode(r.signature);return e.addSignature(i,o),e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signAllTransactions",params:[e]}),i=new X(r.publicKey),o=r.signatures;return e.map((s,a)=>{const l=xd.decode(o[a]);return s.addSignature(i,l),s})}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signMessage",params:[e]});return xd.decode(r.signature)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const v4="Coinbase Wallet";class S4 extends Xn{constructor(e={}){super(),this.name=v4,this.url="https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzAwNTJGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1MiA1MTJDMTUyIDcxMC44MjMgMzEzLjE3NyA4NzIgNTEyIDg3MkM3MTAuODIzIDg3MiA4NzIgNzEwLjgyMyA4NzIgNTEyQzg3MiAzMTMuMTc3IDcxMC44MjMgMTUyIDUxMiAxNTJDMzEzLjE3NyAxNTIgMTUyIDMxMy4xNzcgMTUyIDUxMlpNNDIwIDM5NkM0MDYuNzQ1IDM5NiAzOTYgNDA2Ljc0NSAzOTYgNDIwVjYwNEMzOTYgNjE3LjI1NSA0MDYuNzQ1IDYyOCA0MjAgNjI4SDYwNEM2MTcuMjU1IDYyOCA2MjggNjE3LjI1NSA2MjggNjA0VjQyMEM2MjggNDA2Ljc0NSA2MTcuMjU1IDM5NiA2MDQgMzk2SDQyMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window!=null&&window.coinbaseSolana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coinbaseSolana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const I4="HuobiWallet";class b4 extends Xn{constructor(e={}){super(),this.name=I4,this.url="https://www.huobiwallet.io",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjI0IiBoZWlnaHQ9IjIyNCIgdmlld0JveD0iMCAwIDIyNCAyMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAwTDIyNCAwVjIyNEgwTDAgMFoiIGZpbGw9IiMyMTU3RTIiLz4KPHBhdGggZD0iTTEzMS4wNTkgODEuMTc3MUMxMzEuMDU5IDU3Ljc1MzEgMTE5LjQ1OCAzNy42MzE1IDExMC42MjUgMzEuMDcyOEMxMTAuNjI1IDMxLjA3MjggMTA5Ljk1MyAzMC43MDQyIDExMCAzMS42MjU4VjMxLjYyNThDMTA5LjI2NSA3Ni44MzAzIDg1Ljc2NzIgODkuMDg3NSA3Mi44MzggMTA1LjU4NEM0My4wMjQxIDE0My42NzcgNzAuNzU4NyAxODUuNDU2IDk4Ljk5MzUgMTkzLjEzNkMxMTQuNzk5IDE5Ny40NTIgOTUuMzUwOCAxODUuNDU2IDkyLjg0OTQgMTYwLjIzNUM4OS44MDA3IDEyOS43NDUgMTMxLjA1OSAxMDYuNDQ0IDEzMS4wNTkgODEuMTc3MVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xMTAxXzEyNSkiLz4KPHBhdGggZD0iTTE0My41OTcgOTYuMzE3NEMxNDMuNDA5IDk2LjE5NDMgMTQzLjE1OCA5Ni4xMDIgMTQyLjk4NiA5Ni4zOTQzQzE0Mi40ODQgMTAyLjEwMiAxMzYuNTYgMTE0LjI4NiAxMjkuMDM3IDEyNS40ODZDMTAzLjU1MiAxNjMuNDU1IDExOC4wNjUgMTgxLjc2MiAxMjYuMjQ3IDE5MS42MzlDMTMwLjk0OSAxOTcuMzQ3IDEyNi4yNDcgMTkxLjYzOSAxMzguMDk2IDE4NS44MDhDMTUyLjczNSAxNzcuMDkyIDE2Mi4yMzQgMTYyLjAyIDE2My42NDMgMTQ1LjI3QzE2NS4yMzMgMTI2Ljc1OCAxNTcuNzk4IDEwOC42IDE0My41OTcgOTYuMzE3NFoiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcl8xMTAxXzEyNSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjEyMi40MDEiIHkxPSIyMDkuMjk1IiB4Mj0iMTc4LjY2MiIgeTI9IjExMC40NDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjE1Ny44NjEiIHkxPSIyMDMuMTc3IiB4Mj0iMTg5LjAxNCIgeTI9IjE0MC4wMjIiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.huobiWallet)!=null&&n.isHuobiWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.huobiWallet;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("disconnect"))}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const k4="MathWallet";class E4 extends IM{constructor(e={}){super(),this.name=k4,this.url="https://mathwallet.org",this.icon="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJtMCAwaDEyOHYxMjhoLTEyOHoiIG9wYWNpdHk9IjAiLz48cGF0aCBkPSJtOTAuODQ3MDA4NiA1Ny43NjEwMDIzYy0yLjI3NzAzNjMtMi4yNzcwMzYzLTIuMjc3MDM2My01Ljk2ODg0MTYgMC04LjI0NTg3NzggMi4yNzcwMzYyLTIuMjc3MDM2MyA1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2NiAyLjI3NzAzNjIgMi4yNzcwMzY2IDUuOTY4ODQxNSAwIDguMjQ1ODc3OC0yLjI3NzAzNjMgMi4yNzcwMzYyLTUuOTY4ODQxNiAyLjI3NzAzNjItOC4yNDU4Nzc4IDB6bS0xOS41ODM5NTk4IDE5LjU4Mzk1OTdjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMzAuOTIyMDQyMi0xMC4zMDczNDcyYy0xLjcwNzc3OC0xLjcwNzc3NzItMS43MDc3NzgtNC40NzY2MzEyIDAtNi4xODQ0MDg0IDEuNzA3Nzc3LTEuNzA3Nzc3MiA0LjQ3NjYzMS0xLjcwNzc3NzIgNi4xODQ0MDggMHMxLjcwNzc3NyA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEgMS43MDc3NzcyLTYuMTg0NDA4IDB6bS0xMC4zMDczNDc3IDEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMjEuNjQ1NDI4Ny0xLjAzMDczNDdjLTEuMTM4NTE4LTEuMTM4NTE4MS0xLjEzODUxOC0yLjk4NDQyMDggMC00LjEyMjkzODkgMS4xMzg1MTktMS4xMzg1MTgxIDIuOTg0NDIxLTEuMTM4NTE4MSA0LjEyMjkzOSAwIDEuMTM4NTE5IDEuMTM4NTE4MSAxLjEzODUxOSAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTggMS4xMzg1MTgxLTIuOTg0NDIgMS4xMzg1MTgxLTQuMTIyOTM5IDB6bS0xMC4zMDczNDcgMTAuMzA3MzQ3MmMtMS4xMzg1MTgtMS4xMzg1MTgxLTEuMTM4NTE4LTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxOC0xLjEzODUxODEgMi45ODQ0MjEtMS4xMzg1MTgxIDQuMTIyOTM5IDAgMS4xMzg1MTggMS4xMzg1MTgyIDEuMTM4NTE4IDIuOTg0NDIwOCAwIDQuMTIyOTM4OS0xLjEzODUxOCAxLjEzODUxODItMi45ODQ0MjEgMS4xMzg1MTgyLTQuMTIyOTM5IDB6bS0yMi42NzYxNjM3LTE4LjU1MzIyNWMtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3M2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2Mi0yLjI3NzAzNjMgNS45Njg4NDE1LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjIgMi4yNzcwMzYyIDIuMjc3MDM2MiA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYzIDIuMjc3MDM2Mi01Ljk2ODg0MTYgMi4yNzcwMzYyLTguMjQ1ODc3OCAwem0tMjAuNzEwNTA2IDBjLTIuMjc3MDM2Mi0yLjI3NzAzNjMtMi4yNzcwMzYyLTUuOTY4ODQxNiAwLTguMjQ1ODc3OCAyLjI3NzAzNjMtMi4yNzcwMzYzIDUuOTY4ODQxNi0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDIuMjc3MDM2MiAyLjI3NzAzNjMgNS45Njg4NDE1IDAgOC4yNDU4Nzc4LTIuMjc3MDM2MiAyLjI3NzAzNjItNS45Njg4NDE1IDIuMjc3MDM2Mi04LjI0NTg3NzggMHptLTE5LjU4Mzk1OTcgMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0zMC45MjIwNDE3LTEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMiAwLTYuMTg0NDA4NHM0LjQ3NjYzMTItMS43MDc3NzcyIDYuMTg0NDA4NCAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEyIDEuNzA3Nzc3Mi02LjE4NDQwODQgMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3MmMtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0tNDAuMTk4NjU0My0xLjAzMDczNDdjLTEuMTM4NTE4MTMtMS4xMzg1MTgxLTEuMTM4NTE4MTMtMi45ODQ0MjA4IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA4LTEuMTM4NTE4MSA0LjEyMjkzODkgMHMxLjEzODUxODEgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTIuOTg0NDIwOCAxLjEzODUxODEtNC4xMjI5Mzg5IDB6bTEwLjMwNzM0NzMgMTAuMzA3MzQ3MmMtMS4xMzg1MTgyLTEuMTM4NTE4MS0xLjEzODUxODItMi45ODQ0MjA3IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA3LTEuMTM4NTE4MSA0LjEyMjkzODggMCAxLjEzODUxODIgMS4xMzg1MTgyIDEuMTM4NTE4MiAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTgxIDEuMTM4NTE4Mi0yLjk4NDQyMDcgMS4xMzg1MTgyLTQuMTIyOTM4OCAwem00MS4yMjkzODg5IDBjLTEuMTM4NTE4MS0xLjEzODUxODEtMS4xMzg1MTgxLTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxODItMS4xMzg1MTgxIDIuOTg0NDIwOC0xLjEzODUxODEgNC4xMjI5Mzg5IDAgMS4xMzg1MTgyIDEuMTM4NTE4MiAxLjEzODUxODIgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTEuMTM4NTE4MSAxLjEzODUxODItMi45ODQ0MjA3IDEuMTM4NTE4Mi00LjEyMjkzODkgMHptLTQyLjI2MDEyMzctMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzEyIDAtNi4xODQ0MDg0czQuNDc2NjMxMi0xLjcwNzc3NzIgNi4xODQ0MDg0IDAgMS43MDc3NzcyIDQuNDc2NjMxMiAwIDYuMTg0NDA4NC00LjQ3NjYzMTIgMS43MDc3NzcyLTYuMTg0NDA4NCAwem0xOS41ODM5NTk4IDEuMDMwNzM0N2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzMgMTAuMzA3MzQ3M2MtMi4yNzcwMzYyLTIuMjc3MDM2My0yLjI3NzAzNjItNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2My0yLjI3NzAzNjMgNS45Njg4NDE2LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjMgMi4yNzcwMzYyIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYyIDIuMjc3MDM2Mi01Ljk2ODg0MTUgMi4yNzcwMzYyLTguMjQ1ODc3OCAweiIvPjwvZz48L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._messaged=n=>{const r=n.data;r&&r.origin==="mathwallet_internal"&&r.type==="lockStatusChanged"&&!r.payload&&this._disconnected()},this._disconnected=()=>{this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.solana)!=null&&n.isMathWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}window.addEventListener("message",this._messaged),this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const x4="Neko";class T4 extends Xn{constructor(e={}){super(),this.name=x4,this.url="https://nekowallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyNDRweCIgaGVpZ2h0PSIyNjBweCIgdmlld0JveD0iMCAwIDI0NCAyNjAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0NCAyNjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyNDQiIGhlaWdodD0iMjYwIiB4PSIwIiB5PSIwIgogICAgaHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFQUUFBQUVFQ0FNQUFBQW9GT2xoQUFBQUJHZEJUVUVBQUxHUEMveGhCUUFBQUNCalNGSk4KQUFCNkpnQUFnSVFBQVBvQUFBQ0E2QUFBZFRBQUFPcGdBQUE2bUFBQUYzQ2N1bEU4QUFBQjQxQk1WRVVBQUFEL2Z5RC9jQ0QvZ0NyLwpmeXIvZ0VEL2dBRC9iU1QvY0JEM2JCajViUnI0YlJuNGJScjViaHI0YmhuNWJCbjRiaG40YlJyNmJodjNiQmo0YlJyM2NCajRiUm41CmJoci9jUno0Ynh2NWJocjNhQmovY3huNWJocjFhaHYzYkJyL2JSdjNiUnIyYkJ2M2JSdjRiQnI0YmhydmNDRDRiUm40YlJyM2NCajQKYmhmM2JSdjRieG4zYkJyM2JCbjRiQm41YlJyNWJScjRiQm4vZGgzNGJocjZhaHY0YXhuL2RTRDNiaHIzYlJqL2JCMzNhQmowYWh2MwpiUnIvYnhINGJCbjRiUnYvYnhENGJSbjZhaFg0YlJyMWJCbjRiUnI2YmhqNGJScjRiUm40YkJuNGJCcjNiUmo0YmhuNGJCcjRiUnI0CmJodjRiUnY5MnNiN3Y1cjVkaWo2bW1INnJYNzh5S245MGJqOHY1djd0b3o1aUVYKzQ5VCs3T1ArOXZILy8vLzVrVlA1ZGluN28zRDcKdG8zNnBIRDVpRWI1ZnpiKzdlTDdyWC81ZnpmLzl2SCs3ZVA3djV2KzdlSC8vLzcrNU5UN3BIRCs0OVA4dG8zOTJzWDZtMkw1ZnpqLwo5dkQ1Z0RqN3JYNzZwSEg4eUtqKzdPSC8vdjc4djVuNGRpbi85ZkQ4djVyNmlFYjd0b3Y5NDlQOHRveis1TlA5MExmNmtWUDRkeW42CmtWVDZtbUQ0ZGlqOTBiZis3T0Q3dFl2KzlmRDdtbUQ4dnBuOHRZdjgwYmo2bzNEOTVOVDZtbUw3bzNIKzl2RDZpRVg4ckgvNm0ySDcKcllEOTI4WDdtbUg4ckg3N3JIN1dKTE5MQUFBQVQzUlNUbE1BQUFBQUFBQUFBQkJBbjkvdno1QlFiOTlmUWQ0Z3YzOEJqODRnQVlBeApnQUh1a0dIUHpoQncvaUZQWUkrZ29JK2VyNzRCenpCd0FZQmdBU0V3N3hDUWp4QytNTEJRcjErdTNyK3VYNC9Pd0xqT0dBQUFBQUZpClMwZEVYM1BSVVMwQUFBQUpjRWhaY3dBQUN4TUFBQXNUQVFDYW5CZ0FBQUFIZEVsTlJRZm1CaHdHRkNaaGFHR2lBQUFPMTBsRVFWUjQKMnUyZCsyTVVWeFhIbDFacU5vWGF0QW1VaDRhdEJiYUNiVVNMSWxTMFZTeDlPTTAweXo2U3pTNGh6UVBMMGhwVEVaWUVBelZxMGFxawppbS8rVkdkMlp2WTVNK2Q3WnM2ZG05MzAreVBNenIyZm5Edm5mdStkZSsra1Vnd05wWWVmM0dQczJUdWM1dnhLb1hhbG43SXFaT3dkCi9vcXlJcDYyN3U5cTVCbmR2RGJ5c3lQTkNvMnFxZERZUHFOZCszVWpwNTQ3MEZHaGc0Y1VNSThZblJyV3pIeDR1S3RDbytMVVE5M00KdW1QOTJGZDdLalE2SkZ6R0FhTlhPdFBaNDEvenFkQzRiQmxqUGtVWSt6UkNIeG54cVZCR050VFArMEZyRFBXWHZ1NWJJZGxRditCYgp4b2cyYU45QUc4WlJ5VEtPR2Y0NnJvazVJTkJHVnJKOXB3T2c5MGpuUzB5N1h4d0pnSmJzdFlLZ3BmTWxLSi91eW9YK2htQXBKNEtnCnRZUjY5NHRCMWNtZUVDeG1QS2dVNDZRRzZNUGZES3lPWk10N0tiQVVRNEhqSlJRY2FNTjRXYkNjZmNIRkpPOVFRZ0p0VENRRG5iaEQKMmZWc1NHVWtPK3FSa0hLU0R2V1JzTXFNQ2haa2hDblpVQWY1RWtkWnVZTEdRcUgzSmdvZEdtaEpTNVlPaFRhU25Eb0tEN1NrSlNPZwpFM1FvZ1FiVWc1YXpaQ2ZDb1JNMG80RUcxSU9XczJUakJIUmlvUTd6SmRKLy8rZVRLeXBjWWI3RWtad2wreFpWVkVKbWxBNjBvQ1hiClI1YVZ6SHd3SFdqamxGaGhJMlJaaVRnVTN4blFMc2xaTXJxc1JNem90NzlEMXlNalZkZ3h1cXdrUWszNEVrZGlsdXdWQkZwOXFJOEEKVDVtY0pVc0RoYWszbzFDZ2pheFVpNk1NbWFNUnhRNEZDclNjSlJ1SG9CVTdGTXFBZXRDbmhjb2pEWmtqcFdhVUdtazBKV1hKYUVPbQpQdFNBTDNFMElWUWdiY2pjVUtzem80QUJkU1ZseWNDR3BkS013b0VXczJSb2Vlb2NDaDVvS1VzR0dUSkhxaHpLZDlFblRNeVNRWVpNCmFhZ3hYK0pDeXlRV3pKQ3BERFhtUzF4b21iODdac2hjcVRDam5FQkxXYkp4RHJRS004b0p0SlFsQXcyWkszbUhBaHBRVHpLV0REVmsKanNUTktHeEFYVTJJbElwM0YwcENqZnNTUnpLV2pQZUhsamFqREYvaVNNYVNNUXNWTnFQY1FCdVpKd1JLWlJneVY1SU9oUjFvR1V2RwpNV1NPSkIwS3c0QjYwQktQRjhlUWlZZWE1VXRjYUluU1dZWk1PdFFzWCtKQ1MxaXljVDYwOGIwelFqckFMMXZFa3ZFTTJUYVFoQ1hqCkdiSnRvQWtCYUhiNjFDMEpTOFpQSlpvbFljbDBNN0FsWU1uNGhreTNCQ3daMzVEcGxvQWxpMkRJZEVQSHQyUVJESmx1NlBpV2JGdzMKQXg4NnZpWHJPME1tWWNuNnpwQkpXTEsrTTJTV0pkc1Zrem5kZDRiTWNpZnB4Mkl4NzljTkVFblovZC9mSFJsNXFBL2J0cU9EWjZOUwpuK3ZEcHUxcDlPeVhJekUvc3lkKzJmcjA2dkVvRDNaL1BzNHRaZmZ6cWZ1ZDJhWitic2N4V3pwNW1NVThITC9FN2FCaERuV0VtZGZ0CnFXRzhoUTlFMjNaMEVzMW1BOFJzWlRPc3YzNWFkMFZscVk4anc0LytteDhpcU5PMEl4M3JZKy9wcjh4WmFrNTRhT0NZZ2RPckJxYXoKYXRkd2VESWJyQ1RtS1hzODdMRWU2K3VCVmJBeVowT2dCL0NCZG5RdzJLTU1raXZwMG5oUUF4K0xmMjlWZXJkZGs1T1Q3QnNFdnVBaQo5bSthb041ci9XUXFkeWxmc1A0cFh5emxwcm4xdEg4OFU1NnRkR3UyYkJaSzFjdE04SDMrR1p4NmExVUJOZWRWK29yWldkbkMvQlJjCngycHhoaWhtcHZnK2h6dDczTStpa0xZRWhWNXdrV2Q5L2krL0FNWFk5N2U5V3B5L2pGTm5maEFsaTRITVp1UGlwYUJxMDlqTGVReTUKZ1gxbEdhWWU3dzAxbmNYQWV0aXRlOG9NL3YrclMrRlJMc0xFYnJUUlJ1NXp3T1pMNUkvQVdsaVJYUDU1NkJVZmhEemFTM2lVUFYxRApnMzF5Tnp2UUlMUkpNbHM1S0lqNnNnbVYwYVhhRWwxNVd6M2RGaDFvRUhxT1pnNmtmcC8rcGI4K3dKcjQrU2U0Z1FhaEY0enJ3RlY1CnZ3SSs1RGR0VHg5QmFid3JnZjlRQ3JwZy9BSzZ6cWRGWWo4TUVQWmdkeVp3WktRQkZUNVh4U3A1dGFmbmlzVU14anJ6STRZWnc2R24KME1mU2xHV3VWRllBaEk0MU9OQjdhS1RrQWw3M2FzZk5meG1YMmNwbUFNTnJqek9IVjBqQkpieU9IYUZlalo3RG1rSjZydXpyVFdocwoyUlJRN3RVOG81SnR3NjdKcUgxVmh6NEdqUDA0SzQxQjBOVElxRU9sMXExalA5Q09nTWM2NDAzOWc5UDdNaFZyYWJGNTUxOEozUkZvCjRNMkZvK0NpUUdub1p2dVdhZHkyUHFZSDdPZGQ2QmZJSzlWQTMzQnYvR3U1VzVaSWl0SGRyS2t4Y2VpYnJFRFhrSXZvVUx1akRuUngKc3pqMExVNmdiODFEbDVHaGR2MEp1dVJWSExyZUNNc2tOcHk4dlFaZHRrNWkvTGdCamI3VmtJZHU5S3RZNnE3bHNLZWdWcVV3TXZaRApEVy9TRUlldTVlemIzc0d1clU0V29BdnpGRWJqb2Y2SlB1aDVBMDVqOWFsSnpPMlI3YnV4MndGZXVpOFBiZmRadjhHdXJSc0c1dXZyCnBCYzlqNDZ3bEVCWE5xeTdMbUdYV3BuK2hoRDBhNHc4aGtNWDBlazlDeHA4VWl0M0RRUHJzOGptYldjeWZJY2RERDEvandIOUNYYnAKQ2pyay9pM0pZV1V5ZkRFUkRyMkpRLzhPdk5TQy9qMXlYZTBQTlBUcmpNMW1NSFQxVXh3YXpHT1YreUQwSDJrT0szMlBLNEEyd0dIVApCa2hTYWZoMHhNWFFhY3l3SnhLQVdYNCtORGlCc29HUHNERG8rcDhRa0FuR3Zpc0dOSlpvYldpd3g4S2dNV2JqZ2dyb0JXTVpoa1puCkVoRm9rTms0eWxoUXhJQTJzTWxOV2VqUC9neUNqQ3FDeHV5SlpQT3Uvd1ZlMnpIS09QSUFocmF1eGV3Skk1RVZER00xK0g5cm4vMFYKV3RmaEtLc0lHck1uRzR3M0d5Vmo3VUhBUXpPYnorRXJlQlJDWS9hRVlVNHNlMkxGY25xdWFKYmIvN0g4b0xqRlhxdWxDaHF6Snd3YgphdW1xTi8rMU1MM1owSUovazZibkJoVkFOeWJ4SVh1eXdaenpYbHdpbjl5RlMrWXRiZENRUGJHaE9XKy9MSm56d2R6VFczbTc3ZC9YCkJnM1pFOFlrUXB0bThwZXFuZVJUMC9hS1NqZk4xVzVRSUNxZ1AyOWNqZGdUR3hyUFpKMHFtNlpaeU9kTmM2YmMrUjgxTXJHcGdIWmUKUENQMnhJYVdlNUhsaW55a0ZVSWo5bVFEdlpDam14cWhFWHZTZ0VaSDFLRG8xcTBFdXRDNEdyRW5EV2p3dFE0cXVuVXJnWGJmTVFEUAphZ1BhK0pza2MyMk9CbEVJRFhUQURyUm9LZ01DclFUNmpuTTVZRThjYU9QdmNzeElvSlZBdXhZWnNDY3V0T0JUalFSYUpUUmdUMXhvCnVRUU9wRzdGMEhUOFBHandkUzJ0MnhDSUNtalArOUt1b3dtOXhscUFGcWhiMkZ5Q0N1aDU5M3JhbmpTaFJaWkpWaDZDVTBZcW9XbDcKMG9LVzZLeHJINElnS3FCejNnL0kvcmNOV3NDQ2I2QWdLcUNiUzExSWU5SlJ6YmpVTUxOYWFITHBRR2M5NDFIanpHcWgvOEdzNkQragpJOVBUSllxaFd3YUJTc25kMFltOFJlbmhKb05aQ1hTcjQ2RHNTVStUWEgwUWlYbUY4WHBET1RSbHRIeWV3emwrc0djNVRWczk5TC80CjBNWXljMDY0Y3BQMVNrY1ZkT3NYbEQzeHo3Z3M3QUw3cFk1cWFNcWVCSFV6eTNtc2tjL2VZMGM1QVdnaVppRjk2MmFlR29PVWk2eVUKblJ3MFlVL0NEY1Z5cnZUQUxQdjhyRHlUTC9KZXprYUhIaGg5QWIxVDlBWDBUaEVIdXN5Ui95Mm10MHI1d2t6WlRzbmw4b3haS0FWYgppNm5wcldMZTlMbXo5YlBpcFdxTTVLMW16VW1sZDB1NEJWRXRtajJqcnFDNStlb1ZreHFoelJUSmZUbEpRM2VOQWFhMi9DRjhOeFJOClhTbGpoU3plNUkydVZFTjNOTnRxTVNoczlkNVdXbVVOT0ZhaWhGc1I5R0xiejZvaG8rcTczV1h3QjlUTXNiUkM2TmFPc09WUWlxNkYKUU9qcFZKMWlOM0pGME0zOFJCeEYxR20rbzg0V1hadkhJUlJDdTMvN1pXSytxSlpydi8rL295SGJvcmROcTRkMkZsVVpWYXF4dHI5awp2TXlkTWVuUVI1d21yZ2JhZVMxUEw0dGJiMk8rSG9mWmF1SzZsejQ3TTkvQWlSYXQweXBXWXpLenFOVkFnOHl0MThtWEJaYWQ0TlJLCm9HMFBpaXo1Ykw2V21Md2VuNWxCclFUYVlwbEdydk5NNkNUeldNRWdJVWMyS1lPZVJnNmZxN1JNYUl5K3FsUHZZU0NLbGo1ank0WGMKcFVBaXF4QWFvZzlFVUFhZFJ6ZmdPYzFSY3UwY3R1aEVCZlFjMXJnOUV5cld1RzFCRFZ6SnV5elFXemttZEZWMHZUZlV3QlZBZnc1dQp0SFJNS0hjUEJ5WG8wRDE1NkRzb1J0MitLWG9xMXl6WUlKQlFLNENHYy9GZFRxRHo2UDVFSU5TcXBvc1EyVE1JYU9xdTVkQW1VYWNUCnVFYm9oZ2xGNDFlYmZoZHRRZlF5STUzUVZjYWk1enJlbmE5dloyaTdIY0k3TFcvQnA4QUFxVXdqdEIwUmVDUHhDcU52STl1M1J1Z1YKVGllOWdoOGtRT2R2amRDMzhUTjhHanZNWUdneWYrdUR0bDlqNFp1bmJ6TE9uQ1QzTkdpRXJuTDJiakJPVDNET2R0dWUwTFlKeFk5Ngo1a0NUT3puMFFkc21GRDhqbW5IS0ViM0ZWQiswYlVMeFRUb3NhQ3A5NjRObUhRMWdQNlk0OUYwQ1JCOTBUaDAwdFExUEUvVHN6SU9GCkhRTnRMM0RjeWkyNDdtSEFvV2ZOZk1tQzdicWhLdWh0a3NnS3ZqZGtRTi9vUTJqN0tUYUxwYTNxZEljdlZ0UlBVNmU3SkovSUxQcTgKVFcvZkVUZFpuUE9zdHE4ajQ1d0RYR0Y2YjJvamkxNUhwbWlVUlUyZDZJTmVOeml2c1FabFBGM2xwTy83REdqS2hlcWNPV0VkVWNXWgpJeVBQOGRFN1I3Ynpaa1B0UncrZTkxN25YTHFOb1J0dmF0SDJYVitBMzNEb09hVUtsZTBoMWtDVVdnNTlFb0RYbGpxaDdjRVFuSjVLCnFDSFRja3JWOWYrZzBJMnp1RkZIdlhnZHUwN1BLVlVsZENHQ1l4ZUZUeVBUZEVwVkNWeFBWWEdIZ0ZJZkNIUC9rSHBPcVNxQjM4dW8KZUoyTDFMbEZEWkZuaHFxQy9oVHRYSnhFdXlhNHZBZzZzbDhKdElGNkovZWxxdURKaXRoaEowcWcwYzl3ZVBNNllnMGNYQkdyQkJvOAp2TDQ1Q0p5VU9aZ0xYdnVzQmhvOWtNZDd2eWl6YWhBOW1Vc1JOTnkrUFo4c1FWMkRqMGhRQXcxMzFldmV2ZU5UdzZlUktZTkd1K3BXCkZ4T1grdUYvY1JCRjBPZ1hoZG9tTHVOUlgrT2M4WklWL3c2SHN4a09iZDl0bmN4YWpQWEFuN0MyVzJiRW9aMk5hR2dxVzIrZnVmeGYKMUgwTjJNbVpUUjJGUCtXSlFqc2JhbEVyMmpua1g0VzlYRWVZdVNmYm5NSS9kc2lDaGwxV1Y1RDRKM094RCtZeWpKZkZ2NHptUXFQdAp1MmVTbW9jZDVjaW03RS94RDVqeW9OR1BvL204anBpRGQ4dWJqNkljZ21GL1YxNzRFNDhlTkdoRmZWZTZMYytSaDE5WXhQZWlIUU5oCkplOFUvajA0SGpUYVZRZk4yRzQrS3BvQnAyQ1VaL0tQTnFNZmRETEIrUHkwSGkzMEtNNnhMcmFzUnpxVk9nYTM3OEZRcHZIOWFielQKR2doTk5LRHhiNWdPZ3R4dnlqTStlRGdBdXVBdzc2aFFlNEZPcFM3b3JrcHltdkNZVTJNN0pvRm5tb0ZPcFU3cnJreEN5cDVPdFdtSAo1TEkzMnBsVHg1N1VYWjhrZFBGUUIzVHEzQTU0ckROZHpEdWgzOHFlUy9Yb2pPNUtxV1kra2ZKUmVxQmJlQ2FkOHRYWUFHZXppK2RTCkFSb2JXR3QyYWlnVnJOTUQyY1F6cDFPaEdvTm5qL3BIYnh4S1VYcmxUZDJWbE5XYmFSTFppZmJBTlBKWG44S1FiUTJkZVN1VHplcXUKY1R4bHM1bUp0NGRnWkVmbnpyeHo2bWNXZWovcTRzVzMzbms3c0pOSy9SOXZRRFNYcURYRjdRQUFBQ1YwUlZoMFpHRjBaVHBqY21WaApkR1VBTWpBeU1pMHdOaTB5T0ZRd05Eb3lNRG96T0Nzd01qb3dNSmVEK2JFQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNakl0Ck1EWXRNamhVTURRNk1qQTZNemdyTURJNk1ERG0za0VOQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.neko)!=null&&n.isNeko?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.neko;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const A4="Nightly";class D4 extends Xn{constructor(){super(),this.name=A4,this.url="https://nightly.app",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQ4IDk2Qzc0LjUwOTcgOTYgOTYgNzQuNTA5NyA5NiA0OEM5NiAyMS40OTAzIDc0LjUwOTcgMCA0OCAwQzIxLjQ5MDMgMCAwIDIxLjQ5MDMgMCA0OEMwIDc0LjUwOTcgMjEuNDkwMyA5NiA0OCA5NloiIGZpbGw9IiM2RDczRjgiLz4KPHBhdGggZD0iTTQ4IDg1LjYzNTZDNDggODUuNjM1NiA1Mi40NTMzIDg1LjYzNTYgNTUuNDQgODIuNTg2N0M1OC45MTU1IDc5LjI4MDEgNTcuMzUxMSA3NS40MzEyIDYyLjI3NTUgNzEuNDMxMkM2Ni45ODY2IDY3LjY0NDUgNzIuOTI0NCA3MC4zMzc5IDcyLjkyNDQgNzAuMzM3OUM3Ny4wMjIyIDYyLjEyNDUgNzQuNzkxMSA1Mi41NjkgNzQuNzkxMSA1Mi41NjlDODEuNzY4OCAzNC4yNTc5IDc1Ljk2NDQgMjEuMTU1NyA3NC40NDQ0IDE3LjM2MDFDNjkuNDQ4OCAyNC4zMzc5IDYzLjE5MTEgMjkuMTczNCA1NS43OTU1IDMyLjQwOUM1My4yMjY2IDMxLjcwNjggNTAuNTk1NSAzMS4zMzM0IDQ4IDMxLjM2MDFDNDUuNDEzMyAzMS4zMzM0IDQyLjc3MzMgMzEuNzA2OCA0MC4yMDQ0IDMyLjQwOUMzMi44MTc3IDI5LjE2NDUgMjYuNTUxMSAyNC4zMzc5IDIxLjU1NTUgMTcuMzYwMUMyMC4wMzU1IDIxLjE1NTcgMTQuMjMxMSAzNC4yNTc5IDIxLjIwODkgNTIuNTY5QzIxLjIwODkgNTIuNTY5IDE4Ljk3NzggNjIuMTI0NSAyMy4wNzU1IDcwLjMzNzlDMjMuMDc1NSA3MC4zMzc5IDI5LjAxMzMgNjcuNjQ0NSAzMy43MjQ0IDcxLjQzMTJDMzguNjU3NyA3NS40MzEyIDM3LjA4NDQgNzkuMjgwMSA0MC41NiA4Mi41ODY3QzQzLjU0NjYgODUuNjM1NiA0OCA4NS42MzU2IDQ4IDg1LjYzNTZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNDIuNDc5OSA2NS4yOThDNDIuMjkzMyA1OS4yMTggMzYuMzAyMSA1Ny4yNjI0IDMyLjIxMzMgNTkuODIyNEMzMi4yMTMzIDU5LjgyMjQgMzIuODUzMyA2Mi40MzU4IDM1LjgzOTkgNjMuNzUxM0MzOC4yNzU1IDY0LjgyNjkgMzkuMzI0NCA2My4zODY5IDQyLjQ3OTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNMjIuNDk3NyAyMy4wOTM1QzIwLjA4ODggMzEuNTQ2OCAyMS4xMjg4IDQyLjI0MDIgMjQuOTMzMyA1MC4wMjY5QzI4LjgyNjYgNDcuMjcxMyAzMi45MTU1IDQzLjAxMzUgMzUuMDkzMyAzOC41MDY5QzI5Ljk2NDQgMzQuNzExMyAyNS42NjIyIDMxLjEwMjQgMjIuNDk3NyAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNTMuNTE5OSA2NS4yOThDNTMuNzA2NiA1OS4yMTggNTkuNjk3NyA1Ny4yNjI0IDYzLjc4NjYgNTkuODIyNEM2My43ODY2IDU5LjgyMjQgNjMuMTQ2NiA2Mi40MzU4IDYwLjE1OTkgNjMuNzUxM0M1Ny43MjQzIDY0LjgyNjkgNTYuNjc1NSA2My4zODY5IDUzLjUxOTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNzMuNTAyMiAyMy4wOTM1Qzc1LjkxMTEgMzEuNTQ2OCA3NC44NzExIDQyLjI0MDIgNzEuMDY2NiA1MC4wMjY5QzY3LjE3MzMgNDcuMjcxMyA2My4wODQ0IDQzLjAxMzUgNjAuOTA2NiAzOC41MDY5QzY2LjAzNTUgMzQuNzExMyA3MC4zMzc3IDMxLjEwMjQgNzMuNTAyMiAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNDcuOTk5OSA4NS4zMDY5QzUwLjE0MDQgODUuMzA2OSA1MS44NzU1IDgzLjc3ODcgNTEuODc1NSA4MS44OTM2QzUxLjg3NTUgODAuMDA4NCA1MC4xNDA0IDc4LjQ4MDIgNDcuOTk5OSA3OC40ODAyQzQ1Ljg1OTUgNzguNDgwMiA0NC4xMjQ0IDgwLjAwODQgNDQuMTI0NCA4MS44OTM2QzQ0LjEyNDQgODMuNzc4NyA0NS44NTk1IDg1LjMwNjkgNDcuOTk5OSA4NS4zMDY5WiIgZmlsbD0iIzdCODFGOSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._publicKey=null,this._wallet=null,this._readyState!==$.Unsupported&&cr(()=>{var e;return(e=window==null?void 0:window.nightly)!=null&&e.solana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get connecting(){return this._connecting}get readyState(){return this._readyState}get publicKey(){return this._publicKey}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.nightly.solana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(e.publicKey.toString()==="11111111111111111111111111111111")throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch{this.emit("error",new Vr)}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return n.signMessage(new TextDecoder().decode(e))}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const L4="Salmon";class z4 extends Xn{constructor({network:e=Vf.Mainnet}={}){super(),this.name=L4,this.url="https://salmonwallet.io",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iODgiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4OCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijg4IiBoZWlnaHQ9Ijg4IiByeD0iMzAiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl84NTVfNTgwKSIvPgo8cGF0aCBkPSJNNTkuODA1NSAyNy42M0M1Ni43OTU1IDI1LjgyMzkgNTMuNjIyMiAyNC41Mzg4IDUwLjM1OTcgMjMuODE0NEw0Ni45MDQyIDE2LjEyODdDNDYuNDkzMyAxNC44NTg1IDQ1LjMwMDIgMTQuMDAwMSA0My45NTM3IDE0LjAwMDFINDMuODE1QzQyLjQ2ODUgMTQuMDAwMSA0MS4yNzU0IDE0Ljg2MzUgNDAuODY0NSAxNi4xMjg3TDM3LjQwOSAyMy44MDk1QzM0LjE0MTYgMjQuNTM4OCAzMC45NTgzIDI1LjgyODkgMjcuOTQzNCAyNy42MzQ5QzIxLjk1MzIgMzkuMjYwMyAyMC4zMjk0IDUwLjU5MjggMjEuMTQxMyA2MS43NjY2QzI0LjY1MTMgNjUuMTY1NCAzMi40MzM2IDY5LjM2OCAzNi42MDcgNzEuMDMwMkMzOS4wNTI2IDcyLjAwMjcgMzkuODAwMSA3Mi40OTM5IDQyLjI1MDYgNzIuOTAwN0M0NC40Mjg5IDczLjUxNiA0NS4wODczIDczLjI3NzggNDYuNzU1NyA3My4xMDQyQzQ5LjMyNTEgNzIuNDE5NSA1MC4zOTQ0IDcxLjcyNDggNTEuNDM0IDcxLjE2NDFDNTUuODQ5OSA2OC44NzY4IDYzLjExNzQgNjUuMTcwNCA2Ni42Mjc0IDYxLjc3MTZDNjcuNTc3OSA0OC44MTE2IDY0Ljk5ODYgMzcuNTgzMiA1OS44MDU1IDI3LjYyNVYyNy42M1pNMzcuNTI3OCA1MS4xNDg1QzM1LjY0MTYgNTEuMTQ4NSAzNC4wODIyIDQ4LjkwMDkgMzQuMDgyMiA0Ni4xMzIyQzM0LjA4MjIgNDMuMzYzNiAzNS41ODcxIDQxLjA5NjEgMzcuNTE3OSA0MS4wOTYxQzM5LjQ0ODYgNDEuMDk2MSA0MC45OTgxIDQzLjM2MzYgNDAuOTYzNSA0Ni4xMzIyQzQwLjkyODggNDguOTAwOSAzOS40NDM3IDUxLjE0ODUgMzcuNTIyOCA1MS4xNDg1SDM3LjUyNzhaTTUwLjIzMSA1MS4xNDg1QzQ4LjMzOTkgNTEuMTQ4NSA0Ni43OTAzIDQ4LjkwMDkgNDYuNzkwMyA0Ni4xMzIyQzQ2Ljc5MDMgNDMuMzYzNiA0OC4yOTUzIDQxLjA5NjEgNTAuMjMxIDQxLjA5NjFDNTIuMTY2NyA0MS4wOTYxIDUzLjcwMTQgNDMuMzYzNiA1My42NjY3IDQ2LjEzMjJDNTMuNjMyMSA0OC45MDA5IDUyLjE1MTggNTEuMTQ4NSA1MC4yMzEgNTEuMTQ4NVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTc1LjQwNTEgNTYuMTIwM0w3MC45NzkzIDQyLjE3MjlDNzAuNDM0NyA0MC40NjYxIDY4Ljg1NTUgMzkuMzA1MSA2Ny4wNjMzIDM5LjMwNTFDNjYuNTI4NyAzOS4zMDUxIDY2LjAwODkgMzkuNDA5MiA2NS41Mjg3IDM5LjYwMjhDNjcuNTQ4NSA0Ni4zMjU5IDY4LjM2MDQgNTMuNTc5OSA2Ny43MjY3IDYxLjQ4NEg3MS40ODQyQzc0LjI2NjUgNjEuNDg0IDc2LjI0MTcgNTguNzc0OSA3NS40MDAxIDU2LjEyMDNINzUuNDA1MVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTEyLjE5MDggNTYuMzgzNUwxNi42MTY2IDQyLjQzNjFDMTcuMTYxMiA0MC43MjkyIDE4Ljc0MDUgMzkuNTY4MiAyMC41MzI2IDM5LjU2ODJDMjEuMDY3MiAzOS41NjgyIDIxLjU4NyAzOS42NzI0IDIyLjA2NzMgMzkuODY1OUMyMC4wNDc0IDQ2LjU4OSAxOS4yMzU1IDUzLjg0MzEgMTkuODY5MiA2MS43NDcxSDE2LjExMTdDMTMuMzI5NSA2MS43NDcxIDExLjM1NDIgNTkuMDM4IDEyLjE5NTggNTYuMzgzNUgxMi4xOTA4WiIgZmlsbD0iI0ZDRkNGQyIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzg1NV81ODAiIHgxPSI0NCIgeTE9IjAiIHgyPSI0NCIgeTI9Ijg4IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNGRjgxNzAiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY1QzQ1Ii8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._network=e,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window.salmon?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./index-3e67d3a8.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new qt;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const j4="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjMxIiB2aWV3Qm94PSIwIDAgMzEgMzEiIHdpZHRoPSIzMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjIwLjI1IiB4Mj0iMjYuNTcxIiB5MT0iMjcuMTczIiB5Mj0iMTkuODU4Ij48c3RvcCBvZmZzZXQ9Ii4wOCIgc3RvcC1jb2xvcj0iIzk5NDVmZiIvPjxzdG9wIG9mZnNldD0iLjMiIHN0b3AtY29sb3I9IiM4NzUyZjMiLz48c3RvcCBvZmZzZXQ9Ii41IiBzdG9wLWNvbG9yPSIjNTQ5N2Q1Ii8+PHN0b3Agb2Zmc2V0PSIuNiIgc3RvcC1jb2xvcj0iIzQzYjRjYSIvPjxzdG9wIG9mZnNldD0iLjcyIiBzdG9wLWNvbG9yPSIjMjhlMGI5Ii8+PHN0b3Agb2Zmc2V0PSIuOTciIHN0b3AtY29sb3I9IiMxOWZiOWIiLz48L2xpbmVhckdyYWRpZW50PjxnIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iLjA5NCI+PHBhdGggZD0ibTI2LjEwOSAzLjY0My05LjM2OSA2Ljk1OSAxLjczMy00LjEwNSA3LjYzNy0yLjg1M3oiIGZpbGw9IiNlMjc2MWIiIHN0cm9rZT0iI2UyNzYxYiIvPjxnIGZpbGw9IiNlNDc2MWIiIHN0cm9rZT0iI2U0NzYxYiI+PHBhdGggZD0ibTQuNDgxIDMuNjQzIDkuMjk0IDcuMDI0LTEuNjQ4LTQuMTcxem0xOC4yNTggMTYuMTMtMi40OTUgMy44MjMgNS4zMzkgMS40NjkgMS41MzUtNS4yMDctNC4zNzgtLjA4NXptLTE5LjI0Ny4wODUgMS41MjUgNS4yMDcgNS4zMzktMS40NjktMi40OTUtMy44MjN6Ii8+PHBhdGggZD0ibTEwLjA1NSAxMy4zMTMtMS40ODggMi4yNTEgNS4zMDEuMjM1LS4xODgtNS42OTd6bTEwLjQ4IDAtMy42NzItMy4yNzctLjEyMiA1Ljc2MyA1LjI5Mi0uMjM1LTEuNDk3LTIuMjUxem0tMTAuMTc4IDEwLjI4MyAzLjE4My0xLjU1NC0yLjc0OS0yLjE0Ny0uNDMzIDMuNzAxem02LjY5NS0xLjU1NCAzLjE5MiAxLjU1NC0uNDQzLTMuNzAxeiIvPjwvZz48cGF0aCBkPSJtMjAuMjQ0IDIzLjU5Ni0zLjE5Mi0xLjU1NC4yNTQgMi4wODEtLjAyOC44NzZ6bS05Ljg4NyAwIDIuOTY2IDEuNDAzLS4wMTktLjg3Ni4yMzUtMi4wODEtMy4xODMgMS41NTR6IiBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiLz48cGF0aCBkPSJtMTMuMzY5IDE4LjUyMS0yLjY1NS0uNzgxIDEuODc0LS44NTd6bTMuODUxIDAgLjc4MS0xLjYzOCAxLjg4My44NTctMi42NjUuNzgxeiIgZmlsbD0iIzIzMzQ0NyIgc3Ryb2tlPSIjMjMzNDQ3Ii8+PHBhdGggZD0ibTEwLjM1NyAyMy41OTYuNDUyLTMuODIzLTIuOTQ3LjA4NXptOS40MzUtMy44MjMuNDUyIDMuODIzIDIuNDk1LTMuNzM4em0yLjI0MS00LjIwOS01LjI5Mi4yMzUuNDkgMi43MjEuNzgyLTEuNjM4IDEuODgzLjg1N3ptLTExLjMxOCAyLjE3NSAxLjg4My0uODU3Ljc3MiAxLjYzOC40OTktMi43MjEtNS4zMDEtLjIzNXoiIGZpbGw9IiNjZDYxMTYiIHN0cm9rZT0iI2NkNjExNiIvPjxwYXRoIGQ9Im04LjU2NyAxNS41NjQgMi4yMjIgNC4zMzEtLjA3NS0yLjE1NnptMTEuMzI4IDIuMTc1LS4wOTQgMi4xNTYgMi4yMzItNC4zMzEtMi4xMzcgMi4xNzV6bS02LjAyNi0xLjk0LS40OTkgMi43MjEuNjIxIDMuMjExLjE0MS00LjIyOC0uMjY0LTEuNzA0em0yLjg3MiAwLS4yNTQgMS42OTUuMTEzIDQuMjM3LjYzMS0zLjIxMXoiIGZpbGw9IiNlNDc1MWYiIHN0cm9rZT0iI2U0NzUxZiIvPjxwYXRoIGQ9Im0xNy4yMyAxOC41Mi0uNjMxIDMuMjExLjQ1Mi4zMTEgMi43NS0yLjE0Ny4wOTQtMi4xNTZ6bS02LjUxNi0uNzgxLjA3NSAyLjE1NiAyLjc1IDIuMTQ3LjQ1Mi0uMzExLS42MjItMy4yMTF6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48cGF0aCBkPSJtMTcuMjc3IDI0Ljk5OS4wMjgtLjg3Ni0uMjM1LS4yMDdoLTMuNTVsLS4yMTcuMjA3LjAxOS44NzYtMi45NjYtMS40MDMgMS4wMzYuODQ4IDIuMSAxLjQ1OWgzLjYwNmwyLjEwOS0xLjQ1OSAxLjAzNi0uODQ4eiIgZmlsbD0iI2MwYWQ5ZSIgc3Ryb2tlPSIjYzBhZDllIi8+PHBhdGggZD0ibTE3LjA1MSAyMi4wNDItLjQ1Mi0uMzExaC0yLjYwOGwtLjQ1Mi4zMTEtLjIzNSAyLjA4MS4yMTctLjIwN2gzLjU1bC4yMzUuMjA3LS4yNTQtMi4wODF6IiBmaWxsPSIjMTYxNjE2IiBzdHJva2U9IiMxNjE2MTYiLz48cGF0aCBkPSJtMjYuNTA1IDExLjA1My44LTMuODQyLTEuMTk2LTMuNTY5LTkuMDU4IDYuNzIzIDMuNDg0IDIuOTQ3IDQuOTI1IDEuNDQxIDEuMDkyLTEuMjcxLS40NzEtLjMzOS43NTMtLjY4Ny0uNTg0LS40NTIuNzUzLS41NzQtLjQ5OS0uMzc3em0tMjMuMjExLTMuODQxLjggMy44NDItLjUwOC4zNzcuNzUzLjU3NC0uNTc0LjQ1Mi43NTMuNjg3LS40NzEuMzM5IDEuMDgzIDEuMjcxIDQuOTI1LTEuNDQxIDMuNDg0LTIuOTQ3LTkuMDU5LTYuNzIzeiIgZmlsbD0iIzc2M2QxNiIgc3Ryb2tlPSIjNzYzZDE2Ii8+PHBhdGggZD0ibTI1LjQ2IDE0Ljc1NC00LjkyNS0xLjQ0MSAxLjQ5NyAyLjI1MS0yLjIzMiA0LjMzMSAyLjkzOC0uMDM4aDQuMzc4bC0xLjY1Ny01LjEwNHptLTE1LjQwNS0xLjQ0MS00LjkyNSAxLjQ0MS0xLjYzOCA1LjEwNGg0LjM2OWwyLjkyOC4wMzgtMi4yMjItNC4zMzEgMS40ODgtMi4yNTF6bTYuNjg1IDIuNDg2LjMxMS01LjQzMyAxLjQzMS0zLjg3aC02LjM1NmwxLjQxMyAzLjg3LjMyOSA1LjQzMy4xMTMgMS43MTQuMDA5IDQuMjE5aDIuNjFsLjAxOS00LjIxOS4xMjItMS43MTR6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48L2c+PGNpcmNsZSBjeD0iMjMuNSIgY3k9IjIzLjUiIGZpbGw9IiMwMDAiIHI9IjYuNSIvPjxwYXRoIGQ9Im0yNy40NzMgMjUuNTQ1LTEuMzEgMS4zNjhjLS4wMjkuMDMtLjA2My4wNTMtLjEwMS4wN2EuMzEuMzEgMCAwIDEgLS4xMjEuMDI0aC02LjIwOWMtLjAzIDAtLjA1OS0uMDA4LS4wODMtLjAyNGEuMTUuMTUgMCAwIDEgLS4wNTYtLjA2NWMtLjAxMi0uMDI2LS4wMTUtLjA1Ni0uMDEtLjA4NHMuMDE4LS4wNTUuMDM5LS4wNzZsMS4zMTEtMS4zNjhjLjAyOC0uMDMuMDYzLS4wNTMuMTAxLS4wNjlhLjMxLjMxIDAgMCAxIC4xMjEtLjAyNWg2LjIwOGMuMDMgMCAuMDU5LjAwOC4wODMuMDI0YS4xNS4xNSAwIDAgMSAuMDU2LjA2NWMuMDEyLjAyNi4wMTUuMDU2LjAxLjA4NHMtLjAxOC4wNTUtLjAzOS4wNzZ6bS0xLjMxLTIuNzU2Yy0uMDI5LS4wMy0uMDYzLS4wNTMtLjEwMS0uMDdhLjMxLjMxIDAgMCAwIC0uMTIxLS4wMjRoLTYuMjA5Yy0uMDMgMC0uMDU5LjAwOC0uMDgzLjAyNHMtLjA0NC4wMzgtLjA1Ni4wNjUtLjAxNS4wNTYtLjAxLjA4NC4wMTguMDU1LjAzOS4wNzZsMS4zMTEgMS4zNjhjLjAyOC4wMy4wNjMuMDUzLjEwMS4wNjlhLjMxLjMxIDAgMCAwIC4xMjEuMDI1aDYuMjA4Yy4wMyAwIC4wNTktLjAwOC4wODMtLjAyNGEuMTUuMTUgMCAwIDAgLjA1Ni0uMDY1Yy4wMTItLjAyNi4wMTUtLjA1Ni4wMS0uMDg0cy0uMDE4LS4wNTUtLjAzOS0uMDc2em0tNi40MzEtLjk4M2g2LjIwOWEuMzEuMzEgMCAwIDAgLjEyMS0uMDI0Yy4wMzgtLjAxNi4wNzMtLjA0LjEwMS0uMDdsMS4zMS0xLjM2OGMuMDItLjAyMS4wMzQtLjA0Ny4wMzktLjA3NnMuMDAxLS4wNTgtLjAxLS4wODRhLjE1LjE1IDAgMCAwIC0uMDU2LS4wNjVjLS4wMjUtLjAxNi0uMDU0LS4wMjQtLjA4My0uMDI0aC02LjIwOGEuMzEuMzEgMCAwIDAgLS4xMjEuMDI1Yy0uMDM4LjAxNi0uMDcyLjA0LS4xMDEuMDY5bC0xLjMxIDEuMzY4Yy0uMDIuMDIxLS4wMzQuMDQ3LS4wMzkuMDc2cy0uMDAxLjA1OC4wMS4wODQuMDMxLjA0OS4wNTYuMDY1LjA1NC4wMjQuMDgzLjAyNHoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4=";var Qe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},U4=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},jl,ao,Kf,Jf,Xf,Mn,qf,zM,jM,$f,eh,th,nh,rh;class _4{constructor(){jl.add(this),ao.set(this,{}),Kf.set(this,"1.0.0"),Jf.set(this,"MetaMask"),Xf.set(this,j4),Mn.set(this,null),qf.set(this,(e,n)=>{var r;return(r=Qe(this,ao,"f")[e])!=null&&r.push(n)||(Qe(this,ao,"f")[e]=[n]),()=>Qe(this,jl,"m",jM).call(this,e,n)}),$f.set(this,async()=>{if(!Qe(this,Mn,"f")){let e;try{e=(await Ba(()=>import("./index-e2c1b9df.js"),[])).default}catch{throw new Error("Unable to load Solflare MetaMask SDK")}U4(this,Mn,new e,"f"),Qe(this,Mn,"f").on("standard_change",n=>Qe(this,jl,"m",zM).call(this,"change",n))}return this.accounts.length||await Qe(this,Mn,"f").connect(),{accounts:this.accounts}}),eh.set(this,async()=>{Qe(this,Mn,"f")&&await Qe(this,Mn,"f").disconnect()}),th.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignAndSendTransaction(...e)}),nh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignTransaction(...e)}),rh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignMessage(...e)})}get version(){return Qe(this,Kf,"f")}get name(){return Qe(this,Jf,"f")}get icon(){return Qe(this,Xf,"f")}get chains(){return[Qf,DM,LM]}get features(){return{[F0]:{version:"1.0.0",connect:Qe(this,$f,"f")},[Wf]:{version:"1.0.0",disconnect:Qe(this,eh,"f")},[W0]:{version:"1.0.0",on:Qe(this,qf,"f")},[qr]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:Qe(this,th,"f")},[Kt]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:Qe(this,nh,"f")},[Uo]:{version:"1.0.0",signMessage:Qe(this,rh,"f")}}}get accounts(){return Qe(this,Mn,"f")?Qe(this,Mn,"f").standardAccounts:[]}}ao=new WeakMap,Kf=new WeakMap,Jf=new WeakMap,Xf=new WeakMap,Mn=new WeakMap,qf=new WeakMap,$f=new WeakMap,eh=new WeakMap,th=new WeakMap,nh=new WeakMap,rh=new WeakMap,jl=new WeakSet,zM=function(e,...n){var r;(r=Qe(this,ao,"f")[e])==null||r.forEach(i=>i.apply(null,n))},jM=function(e,n){var r;Qe(this,ao,"f")[e]=(r=Qe(this,ao,"f")[e])==null?void 0:r.filter(i=>n!==i)};let hy=!1;function R4(){hy||(_T(new _4),hy=!0)}async function C4(){const t="solflare-detect-metamask";function e(){window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:{id:t,jsonrpc:"2.0",method:"wallet_getSnaps"}}},window.location.origin)}function n(r){var o,s;const i=r.data;(i==null?void 0:i.target)==="metamask-inpage"&&((o=i.data)==null?void 0:o.name)==="metamask-provider"&&(((s=i.data.data)==null?void 0:s.id)===t?(window.removeEventListener("message",n),i.data.data.error||R4()):e())}window.addEventListener("message",n),window.setTimeout(()=>window.removeEventListener("message",n),5e3),e()}const O4="Solflare";class B4 extends Xn{constructor(e={}){super(),this.name=O4,this.url="https://solflare.com",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgNTAgNTAiIHdpZHRoPSI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmMxMGIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmYjNmMmUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iYiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2LjQ3ODM1IiB4Mj0iMzQuOTEwNyIgeGxpbms6aHJlZj0iI2EiIHkxPSI3LjkyIiB5Mj0iMzMuNjU5MyIvPjxyYWRpYWxHcmFkaWVudCBpZD0iYyIgY3g9IjAiIGN5PSIwIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDQuOTkyMTg4MzIgMTIuMDYzODc5NjMgLTEyLjE4MTEzNjU1IDUuMDQwNzEwNzQgMjIuNTIwMiAyMC42MTgzKSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHI9IjEiIHhsaW5rOmhyZWY9IiNhIi8+PHBhdGggZD0ibTI1LjE3MDggNDcuOTEwNGMuNTI1IDAgLjk1MDcuNDIxLjk1MDcuOTQwM3MtLjQyNTcuOTQwMi0uOTUwNy45NDAyLS45NTA3LS40MjA5LS45NTA3LS45NDAyLjQyNTctLjk0MDMuOTUwNy0uOTQwM3ptLTEuMDMyOC00NC45MTU2NWMuNDY0Ni4wMzgzNi44Mzk4LjM5MDQuOTAyNy44NDY4MWwxLjEzMDcgOC4yMTU3NGMuMzc5OCAyLjcxNDMgMy42NTM1IDMuODkwNCA1LjY3NDMgMi4wNDU5bDExLjMyOTEtMTAuMzExNThjLjI3MzMtLjI0ODczLjY5ODktLjIzMTQ5Ljk1MDcuMDM4NTEuMjMwOS4yNDc3Mi4yMzc5LjYyNjk3LjAxNjEuODgyNzdsLTkuODc5MSAxMS4zOTU4Yy0xLjgxODcgMi4wOTQyLS40NzY4IDUuMzY0MyAyLjI5NTYgNS41OTc4bDguNzE2OC44NDAzYy40MzQxLjA0MTguNzUxNy40MjM0LjcwOTMuODUyNC0uMDM0OS4zNTM3LS4zMDc0LjYzOTUtLjY2MjguNjk0OWwtOS4xNTk0IDEuNDMwMmMtMi42NTkzLjM2MjUtMy44NjM2IDMuNTExNy0yLjEzMzkgNS41NTc2bDMuMjIgMy43OTYxYy4yNTk0LjMwNTguMjE4OC43NjE1LS4wOTA4IDEuMDE3OC0uMjYyMi4yMTcyLS42NDE5LjIyNTYtLjkxMzguMDIwM2wtMy45Njk0LTIuOTk3OGMtMi4xNDIxLTEuNjEwOS01LjIyOTctLjI0MTctNS40NTYxIDIuNDI0M2wtLjg3NDcgMTAuMzk3NmMtLjAzNjIuNDI5NS0uNDE3OC43NDg3LS44NTI1LjcxMy0uMzY5LS4wMzAzLS42NjcxLS4zMDk3LS43MTcxLS42NzIxbC0xLjM4NzEtMTAuMDQzN2MtLjM3MTctMi43MTQ0LTMuNjQ1NC0zLjg5MDQtNS42NzQzLTIuMDQ1OWwtMTIuMDUxOTUgMTAuOTc0Yy0uMjQ5NDcuMjI3MS0uNjM4MDkuMjExNC0uODY4LS4wMzUtLjIxMDk0LS4yMjYyLS4yMTczNS0uNTcyNC0uMDE0OTMtLjgwNmwxMC41MTgxOC0xMi4xMzg1YzEuODE4Ny0yLjA5NDIuNDg0OS01LjM2NDQtMi4yODc2LTUuNTk3OGwtOC43MTg3Mi0uODQwNWMtLjQzNDEzLS4wNDE4LS43NTE3Mi0uNDIzNS0uNzA5MzYtLjg1MjQuMDM0OTMtLjM1MzcuMzA3MzktLjYzOTQuNjYyNy0uNjk1bDkuMTUzMzgtMS40Mjk5YzIuNjU5NC0uMzYyNSAzLjg3MTgtMy41MTE3IDIuMTQyMS01LjU1NzZsLTIuMTkyLTIuNTg0MWMtLjMyMTctLjM3OTItLjI3MTMtLjk0NDMuMTEyNi0xLjI2MjEuMzI1My0uMjY5NC43OTYzLS4yNzk3IDEuMTMzNC0uMDI0OWwyLjY5MTggMi4wMzQ3YzIuMTQyMSAxLjYxMDkgNS4yMjk3LjI0MTcgNS40NTYxLTIuNDI0M2wuNzI0MS04LjU1OTk4Yy4wNDU3LS41NDA4LjUyNjUtLjk0MjU3IDEuMDczOS0uODk3Mzd6bS0yMy4xODczMyAyMC40Mzk2NWMuNTI1MDQgMCAuOTUwNjcuNDIxLjk1MDY3Ljk0MDNzLS40MjU2My45NDAzLS45NTA2Ny45NDAzYy0uNTI1MDQxIDAtLjk1MDY3LS40MjEtLjk1MDY3LS45NDAzcy40MjU2MjktLjk0MDMuOTUwNjctLjk0MDN6bTQ3LjY3OTczLS45NTQ3Yy41MjUgMCAuOTUwNy40MjEuOTUwNy45NDAzcy0uNDI1Ny45NDAyLS45NTA3Ljk0MDItLjk1MDctLjQyMDktLjk1MDctLjk0MDIuNDI1Ny0uOTQwMy45NTA3LS45NDAzem0tMjQuNjI5Ni0yMi40Nzk3Yy41MjUgMCAuOTUwNi40MjA5NzMuOTUwNi45NDAyNyAwIC41MTkzLS40MjU2Ljk0MDI3LS45NTA2Ljk0MDI3LS41MjUxIDAtLjk1MDctLjQyMDk3LS45NTA3LS45NDAyNyAwLS41MTkyOTcuNDI1Ni0uOTQwMjcuOTUwNy0uOTQwMjd6IiBmaWxsPSJ1cmwoI2IpIi8+PHBhdGggZD0ibTI0LjU3MSAzMi43NzkyYzQuOTU5NiAwIDguOTgwMi0zLjk3NjUgOC45ODAyLTguODgxOSAwLTQuOTA1My00LjAyMDYtOC44ODE5LTguOTgwMi04Ljg4MTlzLTguOTgwMiAzLjk3NjYtOC45ODAyIDguODgxOWMwIDQuOTA1NCA0LjAyMDYgOC44ODE5IDguOTgwMiA4Ljg4MTl6IiBmaWxsPSJ1cmwoI2MpIi8+PC9zdmc+",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._accountChanged=n=>{if(!n)return;const r=this._publicKey;if(r){try{n=new X(n.toBytes())}catch(i){this.emit("error",new Sn(i==null?void 0:i.message,i));return}r.equals(n)||(this._publicKey=n,this.emit("connect",n))}},this._connecting=!1,this._publicKey=null,this._wallet=null,this._config=e,this._readyState!==$.Unsupported&&(cr(()=>{var n;return(n=window.solflare)!=null&&n.isSolflare||window.SolflareApp?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1}),C4())}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async autoConnect(){this.readyState===$.Loadable&&$g()||await this.connect()}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;if(this.readyState===$.Loadable&&$g()){const i=encodeURIComponent(window.location.href),o=encodeURIComponent(window.location.origin);window.location.href=`https://solflare.com/ul/v1/browse/${i}?ref=${o}`;return}let e;try{e=(await Ba(()=>import("./index-eb9ef66c.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._config.network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(this._connecting=!0,!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new lr;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),n.on("accountChanged",this._accountChanged),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;return xi(e)?o!=null&&o.length&&e.sign(o):(e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o)),s.preflightCommitment=s.preflightCommitment||n.commitment,await i.signAndSendTransaction(e,s)}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const F4="Torus";class W4 extends Xn{constructor({params:e={showTorusButton:!1}}={params:{showTorusButton:!1}}){super(),this.name=F4,this.url="https://tor.us",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzMiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMyAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYuNSIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzAzNjRGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTExLjIxODYgOS40OTIxOUMxMC40NTM5IDkuNDkyMTkgOS44MzM5OCAxMC4xMTIxIDkuODMzOTggMTAuODc2OFYxMi40ODk4QzkuODMzOTggMTMuMjU0NSAxMC40NTM5IDEzLjg3NDQgMTEuMjE4NiAxMy44NzQ0SDEzLjY2ODRWMjIuODk3NkMxMy42Njg0IDIzLjY2MjMgMTQuMjg4MyAyNC4yODIyIDE1LjA1MyAyNC4yODIySDE2LjY2NkMxNy40MzA3IDI0LjI4MjIgMTguMDUwNiAyMy42NjIzIDE4LjA1MDYgMjIuODk3NlYxMi41MDE1QzE4LjA1MDYgMTIuNDk3NiAxOC4wNTA2IDEyLjQ5MzcgMTguMDUwNiAxMi40ODk4VjEwLjg3NjhDMTguMDUwNiAxMC4xMTIxIDE3LjQzMDcgOS40OTIxOSAxNi42NjYgOS40OTIxOUgxNS4wNTNIMTEuMjE4NloiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0yMS4zMzc2IDEzLjg3NDRDMjIuNTQ3NyAxMy44NzQ0IDIzLjUyODcgMTIuODkzNCAyMy41Mjg3IDExLjY4MzNDMjMuNTI4NyAxMC40NzMyIDIyLjU0NzcgOS40OTIxOSAyMS4zMzc2IDkuNDkyMTlDMjAuMTI3NSA5LjQ5MjE5IDE5LjE0NjUgMTAuNDczMiAxOS4xNDY1IDExLjY4MzNDMTkuMTQ2NSAxMi44OTM0IDIwLjEyNzUgMTMuODc0NCAyMS4zMzc2IDEzLjg3NDRaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._connecting=!1,this._wallet=null,this._publicKey=null,this._params=e}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isLoggedIn)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./solanaEmbed.esm-47ad5150.js"),["assets/solanaEmbed.esm-47ad5150.js","assets/punycode-06c60053.js"])).default}catch(o){throw new B0(o==null?void 0:o.message,o)}let n;try{n=window.torus||new e}catch(o){throw new Ei(o==null?void 0:o.message,o)}if(!n.isInitialized)try{await n.init(this._params)}catch(o){throw new lr(o==null?void 0:o.message,o)}let r;try{r=await n.login()}catch(o){throw new qt(o==null?void 0:o.message,o)}let i;try{i=new X(r[0])}catch(o){throw new Sn(o==null?void 0:o.message,o)}this._wallet=n,this._publicKey=i,this.emit("connect",i)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{e.isLoggedIn&&await e.cleanUp()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const V4="Trust";class P4 extends Xn{constructor(e={}){super(),this.name=V4,this.url="https://trustwallet.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgdmlld0JveD0iMCAwIDQwMiA0MDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgo8cmVjdCB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgZmlsbD0idXJsKCNwYXR0ZXJuMCkiLz4KPGRlZnM+CjxwYXR0ZXJuIGlkPSJwYXR0ZXJuMCIgcGF0dGVybkNvbnRlbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPgo8dXNlIHhsaW5rOmhyZWY9IiNpbWFnZTBfMTY5NF8xODk2NyIgdHJhbnNmb3JtPSJzY2FsZSgwLjAwMjQ4NzU2KSIvPgo8L3BhdHRlcm4+CjxpbWFnZSBpZD0iaW1hZ2UwXzE2OTRfMTg5NjciIHdpZHRoPSI0MDIiIGhlaWdodD0iNDAyIiB4bGluazpocmVmPSJkYXRhOmltYWdlL2pwZWc7YmFzZTY0LC85ai80QUFRU2taSlJnQUJBUUFBQVFBQkFBRC8yd0JEQUFjRkJRWUZCQWNHQmdZSUJ3Y0lDeElMQ3dvS0N4WVBFQTBTR2hZYkdoa1dHUmdjSUNnaUhCNG1IaGdaSXpBa0ppb3JMUzR0R3lJeU5URXNOU2dzTFN6LzJ3QkRBUWNJQ0FzSkN4VUxDeFVzSFJrZExDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3ovd2dBUkNBR1NBWklEQVNJQUFoRUJBeEVCLzhRQUd3QUJBQUlEQVFFQUFBQUFBQUFBQUFBQUFBRUdCQVVIQXdML3hBQVpBUUVBQXdFQkFBQUFBQUFBQUFBQUFBQUFBUU1FQlFMLzJnQU1Bd0VBQWhBREVBQUFBZWtBQUFFRXhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaElJRWdBQUFBQVFrQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBQUFRa0FBQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBRUVnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQWlZa0FJa0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBUk1FZ2lZa0FBQUFBQUFBQUFQT29XVjduWFZWdXg5TXllWTNYTG8zSXo2QUFBQUFBQUFBRVNENUV6RWdBQUFBQUFCR0xNWmJSNmUydTVWK3BlT25QazR4cXpCTUFicTE4NlVYOVZjNzNlVFRhV3J6NmJmVWVmUUFBQUFBQUdPSmozbUppUUFBQUFOTlVQckE2Zk95Zm53WFZ6Qk1BZ0EyOXFvdXJtNjNyRnI1cGk5U3JlbWlvc2pIMVpnbUFQdjF4MFRrN0RUUFBycUhyWGJGeStpSGoyQUFBQmppWTk1aVlrQUFBQURtMkhuWVBZNVFzTVRYbCt5cUx1YzdMb0UxV1ZiZTVpaTRLN0FBSTArNWV2TksxWFNtaWpsVHArSGJYenhlNlpkVmppMnE0V1d1V1BsZElLclFBQUFNY1RIdk1URWdBQUFBYzYxK3kxdlg1YTMxQzIxMldnY3pvQUFBQUFBQUFPYTlLNW5yeTR3MzRycFlkRHZ1VjB3cXNBQUFBeHhNZTh4TVNBQUFBQnovVmJuVGRibUxWVmJONTlXOGN2b2dBQUFBQUFBT1lkUDVac3lmSTNZNzF1OVB1T1Qwd3JzQUFBQXh4TWU4eE1TQUFBQUJSOUZZcTcxZWFzVmQzaGVSeXVrQUFBQUFBQUI4OHM2ZHpIZGpEWms2RnM4SE80L1ZEejZBQUFBeHhNZTh4TVNBQUFBQlVxdmNLZjArYzIycHo3UEhSaHlPb0FBQUFBQUFCaGMzNkJ6L29ZUTFaK201RVR4dXFFU0FBQUJqaVk5NWlZa0FBQUFEUlVmb1hQZWpnZTNpMDBkVmVYcnhlcUNRQUFBQUFBTkRTTFpVK2x6M3Y0Ykc2cm9nNC9WQUFBQUF4eE1lOHhNU0FBQUFCNDh3NnJ6TGJreHh0eDlDMmRic25KNllWMkFBQUFBQUFValE1bUgxK1czMmh0dmoxYUJ5K2tBQUFBQmppWTk1aVlrQUFBQUJSYjFYYjZhWU9uenQzZXVXZE53YmZZWk5RQUFBQUFERnlxdlpYVWgxdVk2QlErbjQ5WDBNTzBBQUFBREhFeDd6RXhJQUFBQUR3OXlPV2ZOaHIzWDVpeTFvZFZWeXg4cm9oNTlnQUFBRHhRNXZtNnZwWUEwVWIrN1lHZnl1a0ZWb0FBQUFHT0pqM21KaVFBQUFBQU1mbkhUOVhvbzU4Ky9qcFlHOTBUelBUTW5sdG13N0xZOC9UTG9CSUJyYWpkVFphZGpOK01MYWxrd2I3azFmUXdiUUFBQUFBTWNUSHZNVEVnQUFBQUFBYTZqZEs4NzZlWExQV3VoaCtSNzhlOXRwYXF6cXJudTZ4Yk4vVWRMNTZzNGFNNHpZbkNzTzgzR0xYOC9SajFnQUFBQUFBWTRtUGVZbUpBQUFBQUFBQVl1VW1LUm9lcTYzWGw1NDJXdDI1UW55UHBQemtiKzFaZEdoc01zT3NQUHNBQUFBQUFBUWZEMElpWWxJQUFBQUFBQUFBRVZ1eXZmamxuejB2QjJaYWxkczM2elhoVGNBQUFBQUFBQUFpWUpBaVlKQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFSSUFCRW9KQUFBQUFBQUFBQUFBQUFBQUFBQUFBaVlKQUFBQkVvSkFBQUFBQUFBQUFBQUFBQUFBQUFRRWdBQUFBQkNRUUpSSUFBQUFBQUFBQUFBQUFJSlFKaVFBQUFBQUFBQUErUkhpSkFBQUFBQUFBQUFBQWVub1FCSUFBQUFILzhRQUx4QUFBQVVFQWdFQ0JBVUZBQUFBQUFBQUFBRUNBd1FGRVRBeEVFQVNJRFFURkNGQklpUXpOV0FqTWxCd2dQL2FBQWdCQVFBQkJRTEhZV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVc1di9OTi81TGYrbC92L0FDVDcvd0FLazFOcGhTYTE5V0pEY2h2ckhvRjFsdUpiUk1xaW5PV1hsc09SS2kzSTY5d1d1bXBTVUprVmR0QWVrT3lGZW1OVTNXQXhPWWtkVTlsclBld1ZLWVFIS3RIU0hhdzZvT1BPUEhoWm55R1EzV2lDS2xGV0V1dHI2SjdMV09mUCtWSmN5UXMvbVh3YnpwZ3pNOEVXbHVQQitsTXVOdnhuWTZ2V1Mxa1BtSGg4eStJOVRmYVUyNGwxdkdleTFqbktOYzdDeFRYM2hHZ014dVZJU3RNaWpwTU94M1dEdzBaUm5HeG5zdFk1ZnZmU2xLbEczVHBMZ2FveEJtSXd4NnpJbEU5UzQ3Z2NvN3lRdUsrMTY2TCtqalBaYXh6ZmZjVTZFMUpiS2x4U0NZY2RBSWlJc3FtVzNBcW54VkE2VEZNU0VFMUk0bzN0OFo3TFdPZjcvaWkvcGRPWDd6aWplMHhuc3RZNmorNGNVWCszcHlQZGNVZjJXTTlsckhVLzNIaWlkUjM2dmNVbjJPTTlsckhWZmY4QUZGL1Y2YXZxcmlsL3QrTTlsckhWeS9POFVZL3pQU1VkazgwNHJVL0dleTFqckpmbWVLUWRwdlNmTzBmbUVWb09NOWxySFdpL0Z4VER0VU9sTk8wTG1PVm8yTTlsckhXaS9wY1FUOFozU3FSMnAvSkZaT005bHJIVnl2QzRhVjR2ZEtzS3RENFlUNVNNaDdMV09vcDhvSExTdk5ubzFwWDA0cDZmS2ZrUFpheHZKODJPYWN2emdkR3JyOHBuRklUZVprUFpheVNFZkRrOFVaeTdIUmxyK0pNNG9xUHdaRDJXc2xXYjhKdkZLZCtITTZFbDM0TWJtbXQvRGdaRDJXc2xZYThtT0VxTkMyWENlWnoxaC84QUR3MmczSEVwSktjaDdMV1I1c25tRkpOS3VLVEs4RlpublVzTlBPcWZlNHBEUG5KeW5zdFphdEg4SHVZRlNKd3NqcnFHVVRacXBhK1lVZjVhTmxQWmF5dnNwZlplYVV3N3pGcWJqSVprTnlFNFpWVGFZRDhoeVF2bWxSUE5lWTlsck5OaEpsTnJRcHRmS0ZxYlZHcTRRNGgxUHBrem1Zd2sxQjZSNllNRlVwYVVraE9ZOWxyUExoTnlreUl6a1pmb2FmY1lWRnF5SE9YcERjZEVtcU9PK3FIVEZPaEtTUW5PZXkxMEZvUzRpVlNESUtTYUZlaUxPZGpCK3NGNExjVTZ2MFI0ajBrNHRPYWo5STlscnBQeG1wQlNhVTYxaFpZY2ZWR3BLRUFpSWk2VnV0SmdzeVJKZ3V4dlNTVFVjV2tHWVEybHRQVCt3Ky9WTXJsTHBSS0NrcVFvUllUc280ME5xS25ybjJIb3pNZ0pwY1ZKa1JKTHJmZi9BSnd2M2I5Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN3bkwvQVAvRUFDY1JBQUlCQWdVRkFBSURBQUFBQUFBQUFBRUNBd0FSQkJBd01USVNJQ0ZBUVJSd0lsRlMvOW9BQ0FFREFRRS9BZjBhN2hONk03VkhNRzhIMWIyb3lxS2FjbmF0ODFtWmFXZFRRWUhiMEpKQ1RWejJKQ3pVSWxBdFR3RWNhMnp2UVlpa1BVTDZyYjBxbGpZVitPMUREajdTeHF1M1lWQjNvNGRmbEhEbis2ZU1wdmxGd0dxL0kxRHowc1JzTW8rQTFYNUdvZVkwc1I4eWo0alZsNW1vK1kwc1I4eVhpTldiblNjaHBZamxrTlhFY3RPZm5TK1RyWWdiSEtNM1VhTG03RTFFTHVOYVlYWExEdDR0b08zU3Q4c09QTjlkbDZUYWxicE42Vmd3dU8rV1RxOERLSmVsZGVXUHE4akpXSzdVazRQTHNlVlZwNUMrVU1kLzVIMFpJZzlNaFhmSkpDbTFDZFNQTlBNVzJ5QXZ0U1FmVzlNaTlQQi9taUNOODBnSjNwVkM3ZXN5aHQ2T0hQeWtpQ2ZvL3dEL3hBQWtFUUFDQVFNRUFnTUJBUUFBQUFBQUFBQUJBZ01BQkJFUU1ERXlFaUVnUUVFaWNQL2FBQWdCQWdFQlB3SC9BQTFJeS9GQzNURlNRRmZZK3FBVFN3dWFTMkE3VUJqVjRGYW10M0hGRlNPZm9SUmhWckErRHpxdE5NNU9hUzRCN1VEblhBb29wNUZPdmkyTjFlQlRNRUdUUnVWbzNSL0JUU00zSitDc1Y0b1hMRG1oZEQ5RkpLSDQwbTduZFRxS242YlZyeWRKZTUzWStncWZvZHExL2RKTzUzWXVncVhvZHExL2RIN0hkZzZDbjZuYXR1dWgzYlkveHQyNC9pbU9CbmV0VHlOSlJoenN4akNnVk1jSWQ2QnNQcGNyNzh0aU5mSnNhWFRlZ043aWtieUdhZGZNWU5NaFE0UHpoaThCazZTdjV0bmZobDhEZzhhTW9iMGFlM0k2L0JJV2VraVZOSjVjZnlQb3h6RlBWSTRmalI0bGZtbXQyQndLamdDODZFZ2MxSmNmaWZUQnh4U1hQNDFBZyt4ckpjQWVscG5MYy9XVnluc1VMbGNlNmttTC93Q0gvd0QveEFBM0VBQUJBUVFHQndZR0FnTUFBQUFBQUFBQkFnQURFUklRSUNFaVFGRXhRVkpoY1hLQkV5TXdVR0toQkRJemtaS3hRb0tBa1BELzJnQUlBUUVBQmo4Qy93QkMwcVIyaXR6WG5ObTR0TTdNZkw1bHFDUXhRNXVvejFtbWQyWUZwVlhIbVdmbGtWRUFiMmc1RTV6MU5GNHFOYVZmZUkzNld1cmdySStUM255UHUxMlpmQU4zYVFqM2FMeFpWeDhLeGNSa3ExdTlkZFV0OVNYaTExYVZjRGpwVTJ2RDdORXZsOURCdnJQUHlhMTR2N3RhZkFtZTkyajNMQU8rN1VHZzhURGZxUGdXS0k2dDlWZjVOOVo1K1RYMWRvbmV3V2d4QnhMMG5haDRVU096VG1wb3dtWHRHbVZRQkJ6YUxoVXZwTFFlSUtmQ1duSldKZmN4clFTQ2VEZlRsNXJHNzE1MFMxeDJBYzY4Q0lockIyWjlMWEZKWDdOZmRLSFN1ODVzUzk1cVZLZVJzT3B2a2oxYXh5ajdOWUllTmZkcFZ4RGZSSFJ0Q2gxWjRoT2hKaFN2bXhMM2pTOTQ0Ujl6bWxmUGlYdEwzcGhIdk1hVHo0bDUwL1ZMN3BoRjh4cC9zY1NyZ0tYdkRDRTBvNjRrY3RLeDZjR1RVZGY5cnhLRDZhZUtjRzhQcE5SMXk0bHllTktOOGYxZzMzTFVkREpJeExzNzZYWE5nM25UOTFBTXNUSEpWS0ZaS0J3WUdhcVhhYzFERlBmdlVRck1Sd1RwUEUwdWh2amlscHpTUlVkN3JNRkxzcHBKMlU0dDRqSlZLMFpHT0NlcTMwdlY5TVhOdGlOTXVwWWhnVnZNaFVSNnJjV2w1c0drS0drV3NsNG5Rb1lCTGtjVFNsQTBxTUdDUm9GbUxXN1A4Z3hTZElwN0Jac1Y4dmpsNHMyQmxQRmFUU1hoMEkvZU43WWZLdlR4cUIwK01GNmpuNHBXdFVBMlRzYUJVU2orV2s0MVR0V2dzWGE5SXFCTHkrajNEVE8xUjhLVkhlTDltbWVLalU3ZFl1ajVjZms4R2dzVUxFQ0treUZGSjNNRS9FRCt3YVpDZ29icTBDWmxiSWFFWkVaQ3JFMk9ocExCS1JBRHlDMnhlcFRRZUo2MVpuYWlscFgxeFdlcW1aNHFEU3V1N1Q3MWd0OWRSbHJMQktSQUR5S1ZhUW9NVmZEMmpaTFFVQ0R2cXdqTWpaTGR5bThkclUweTFGUnEzRTJablEweHZyelBrMEhpWTcybWRkNG4zOEdWMmtxYVo4WnpscWFBRUI1VEVpQzlvTkVpS05vVllKRVMwM3hGbnBEU29TRWpkNVpBdFA4QUQzVHN0S29RSW91aUNkb3RkRVZiUjh3N3hFZDdSbEo0bG9KRUIvbkovOFFBS2hBQUFRSUVCQVlEQVFFQkFBQUFBQUFBQVFBUklURmhjUkF3UVZFZ1FJR1JvYkZRNGZEQjhkSC8yZ0FJQVFFQUFUOGh5Q1FFNTI3cGp1bUtnRlFDb0JVQXFBVkFLZ0ZRQ29CVUFxQVZBS2dGUUNvQlVBcUFWQUtnRlFDb0JVQXFBVkFLZ0ZRQ1ltcVZHNlpia0NXVVRPQ0FiNEpta24zaG11OHBib0J2aG9pb1U4cncrSmJVSUY4ancrTEkxRTBJOFJpVzcvR21CZnZ3a3NnR0h4d2hEZ203YjQ4K3NTV0NBWWZJQ0RqQXlmSW1Zd0V6ekI4WUdZSmdPcSsvbFFGV28xRitaSk9XTmhEcVZHWElQNk5pSE1ieW1kamNTczVjQUFGSjVRb0hjeVRCT0Zab2ZaUEg3Um9PbkVPRmlLQ3hUUUJFcG5sWmlrMjVBZ0RrZ0NxbDRwR1U3eE5nZVU1Z2Z1WWs4UjFaVE9Eam9FWkFncVA0SzBtV3drTHduQjVHYmRTYlpnQkRBcnhrRzY4UFFlRi9wRk5GYzBSY2h2a05EMngrR1FnV0xBemU2Y2MyQjREa2VGNUFHUStwZjZSQVFKcWlNOUNtbmpjWmsyNmsyek5FUXV5R1RNcHY3a095WmcvWmh0aVp6YkFFOHZuUjdxOFdhSHJsRkJLRjFHWk51cE5zeUg4VWVKMUYyQjFxME4wQk1YNkg5SzZqQkU5K001Q0pNRUozSnV5N0o2SW51VW9MZUlkK01JOUhyTW0zVW0yWURYV01ieTJITXAwZDVyMzJkN1RLRUd3R2Q0b2txYkJ1STlLUVdpdTFQUWZIOTlNeWJkU2JaZ05peWhVK3VVSi8weHhDSlY2R1pOdXBOc3dHdUQwTVRoMS9ybERjbS91eEJxcGVobVRicVRiTUJxdjhNU2lQN1BsRGQ3K3pFV0d1WVRicVRiTUZxM294S0J1SEtGVkRpTFZEN1prMjZrMnpHaWJpZkp4dlova2NuUVFQd05LaFBsbVRicVRiTXZKdms0d0hjSHJrNkhFOGNEUm9PWk51cE5zeThRSHJHMHdlWEp1YXNjRkRWNHpKdDFKdG1PN2N4NCtzWFRRTzhPVHZ4bmhpQTVZS2xCc3liZFNiWmpmc2o3R1A2NkR5ZEJNZURqUWdlYzJiZFNiWmpHMkE3RHdVWi9Ea3V2eWVNYUVlQVBtemJxVGJNL053T0J5Nmg0bHVTYWRnUDdqWDBQOEFNMmJkU2Jac0FHZUFzK01ZNCtkL25KYThnbUJZUXhZM0pBL3V1Yk51cE5zMXgwQi9qK1l0SkdLNjVqa2Q3b1Y5T0NNSnVQcjlObXpicVRiTmFlYkJzY1Rqc2NBYXJWMEZ1UWFMeFAxNHlDUUNsT0lETm0zVW0yYkxRWXNnSXNSaU1RbGFFY2pvZHM5bVFQdlJUd0Y3WXN5Z3d1L0hPbTNVbTJjY1lmU3hTSzBNUVdYM3pRRWg2bFFDL3dEdHppQVNXRVNuRW03dWROdXBOczZRaXoyTzZEWXhlOWVBYTZHaHFzZFJxTGpLY0dOZ0dDNVZqQU5CYmdza1IxTytmTnVwTnM5NUJoZnFLT2hoaUR3QW9CMUprVVJFZnR3aGtvNmx4T25kcjEyVHZHUDJUcndnSXlSY29FT2dFd0EwejV0MUp0eUdnOUkwVUdRYUJJOEwxWlNSVEdJZDUvNGdRUTRMZzROUmpvTlRaUDdubGY4QUZNOEo0TXpoK2pJZEFaZ0JweUUyNmsyNUUrTU13VTRyVWVqMEtMQlhNQXg0UzREOFNHeVp3ZGlKL0RvME9PcDRlcXJDQk05bklDdzVLYmZsQm5zdEpDT3FlYkNKZW1xSUlMR0J5SE96WFlKbm92Si8xQVFBSkFjbkhIZENaNVVTZTZqN1J1aXBIMXdpNWhwQUJ5VXdtWjF1cFF1QWRBNVF6S1FYdHl3Q0FCQjBLZjJOWFNiYkk3TG5nY0pCT2NqN1U0Uk9ZZVdPZ3drNWdaQ01Ta0k2cDBxV0NoOFFVZ0F3SExpSkhFUWg4ZVN3UURERTc3Zkh6TnVHUnA4YWRoTlNIRE5EWS9Ga3NnTy9HUTZCME0vaVNXUUdwbmtrT25hZmY0ZDlCTkFkOHhtbDJUN3crRGRsRTBVczl0aW5PbzdKbS9PczNUN0JNVE05a0EzS0FBSktvVlVLcUZWQ3FoVlFxb1ZVS3FGVkNxaFZRcW9WVUtxRlZDcWhWUXFvVlVLcUZWQ3FoVlFxb1ZVS2luSE4vOW9BREFNQkFBSUFBd0FBQUJEenp6UlR6enp6enp6enp6enp6enp6VHp6enp6eVJ6enp6enp6enp6enp6enp6enp3elR6enlUenp6enp6enp6enp6enp6enp6enp5anp5aHp6enp6enp6enp6enp6enp6enp6enp4end6enp6enp6enp6enp6enp6enp6enp6enl6enp6enp6enp6enp6OVBmenp6enp6enp6enpEenp6enp6enp6UW9NTU9EN0h6enp6enp6ekx6enp6enl1QUFNTTkrNHNNUE9MM3p6enp3THp6enp6eUVJV1kzenp3MjAwd1A4QTg4ODg4Qzg4ODg4OEtRODg4ODg4ODg4NkQwODg4ODhDODg4ODg4cUU4ODg4ODg4ODhyRGQ4ODg4OEM4ODg4ODhxRzg4ODg4ODg4OGdEVzg4ODg4Qzg4ODg4OGpTODg4ODg4ODg4SkdWODg4ODhDODg4ODg4cEEvODg4ODg4ODhDSDg4ODg4OEM4ODg4ODhNRDE4ODg4ODg4OEpIODg4ODg4Qzg4ODg4OG9EYjg4ODg4ODg1REQ4ODg4ODhDODg4ODg4L0NDLzhBUFBQUFB3UjkvUFBQUFBBdlBQUFBQUE9DQWZ0L1BPOEF5dlBQUFBQUEF2UFBQUFBQUERqUTQwcUF4VDNQUFBQUFBQQXZQUFBQUFBQUExmUUF3RGovQUR6enp6enp6elB6enp6enp6enp6eTJLL3dBODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODhFODhVODg4ODg4ODg4ODg4ODg4ODg4ODg4MGM4OHN3ODg4ODg4ODg4ODg4ODg4ODg4OHM4ODg4ODhjODg4ODg4ODg4ODg4ODg4ODhFODg4ODg4ODg4akJCQkJCQkJCQkJCQkIvOEFQUFBQUFAvRUFDWVJBUUFDQVFNRUFnSURBUUFBQUFBQUFBRUFFU0VRTURGQVFXRnhJS0ZSY0lHUnNmRC8yZ0FJQVFNQkFUOFEvUm8xd2xzYW5ZQjZWSEpuZjc5VEdHb3FyZGNRNUp5V0p5UytnYmw0SjV2aGtPQ1k0dVpUSWlLcDFFY01Xc1pTL251OHZ2U1FkeElMbE9BZkF1aGNaeXFkbkExNzZmWVp4ZFRKajdtZjhQVzF4L2xwOUxkRlFkYlE4ajNvYUR3YnBwUlVuazJuZ2VOQlFHNktMNGcwM0JzdlpWcnhCU2VlZ2l4YlB1amZoZjhBak9saS9IWXVORjYzcUNVeGxVY3g4OUNnV3k3MkRTbUhuZnI5d2lWaGlGcVlUQitvSTVOY0x5emx1UHhvNjdIUTVRd3h1aG9sbGlYREJtT3dORVZDVmY0empvZ0ZNRnovQUVqdEN0Y2ppZmNIbzdWYmg5Q1djc1ROY3Y2UC84UUFKaEVCQUFJQUJRUURBQU1CQUFBQUFBQUFBUUFSRUNFd01WRkJZWEdoSUVDeFlIQ0I4UC9hQUFnQkFnRUJQeEQralg2MmN3bEV1ZFpUNnV3RnpvdGVabVN1QUtESE16Sm5LcHM1UG9ER3JXZHI0WkdOc3BScVpabGZVQVdPS201Q2FoZGNkWDFpZE1VSHNNYjB2aTR0YnFiVUdkU1I5TmZ2V0p2L0FPZnVsNldIdmFydndrRi85ZGRJNXJ4Zzc4anF1L0ZEZmkwaGt2R0N0TzdxdS84QWI5aHN1enBITTk4RmF1cmNqaGlXVkVwclJvTHpMbmdmUUNtZDlIdzVyeXF1K1dGWUhYUXI4RkhKMWhWWkJNOVlLeXFEOGdWb25NRGhjamJwcjh3SU41a0hwdVovbVBjUkduSFBOam1iVHZ6Z1o2N3Y5SFAyWkJyZUJPVFBtYmtEbVp2bmNBYlZFdjhBMG0vMGtWcW1NZnJEYkxNZXJqNmpkdTlLOVJxMk95RzVrZXh4L09qV2ZuLy94QUFxRUFFQUFRSUNDUVVCQVFFQUFBQUFBQUFCRVFBaE1hRVFNRUZSWVhHQmtmRWdRTEhCOEZEUjRmL2FBQWdCQVFBQlB4RFVXUmI3akdwY0ljMVNZdm9SVzhsNXJYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4Vlc0STVNVk13NjE2azRoeVdva2hsYm4yQXFNWGNWR0lodVA5b0JZaitDZ2tKSlU4V09EY292Z1N5ZGJMZGZpMUJnUDRxQ1FralVZTTdqYVVJSkdUVXFCS3dGUTNOdHpmei9rcUhBZHB2b0JicWJ0UVhTNE1PUEgrV2srUlNCSjZ1U0g0ZnpjRndmeDlNUzJMWXF3ZnpyeTlsemw2QzVzV0gzL0FEemFURzRvUkJMam9tVXgyYzZnRGQvUXZibTV5MFhCdXY4QTBiRzMyZEZ6OVAzZjNDUERpWWU1dXZ5R2tTUU51ekE1SmZ1VUV2MkVJWGNObnQ4UjJsKzJqYTcxYy9iWTJvM2c1Y1hoUXEzWE5nNGJtZkxEU2tXeWRvTnliU2pIcXRKZTR2cHZ6OXVSTGNJcktudE1KS2lCMWFMZkd3YUw4NU9kVHFSd2VXTEhxa2dDeFlQNHN6MG9NQlByelk5RjlyTEQydFpWN0JxTllxZ281a1RFRHNGNkhFWmg4aEJ5bzVXNFd2dkJrMWNsTWtxSEl3T21xSi94d2k5em9sRkN2YkRaSHpRUkRPNXZXSXpvc3VtSDBqN0hPcXlyV1JXNkRxVGZ3T0hkS1V1eFE2UUsvYi9kRHdMeFgzVW9EdlUrc0ZZTHRQRmJjUkJjQndjWHRRVVlReU9YdDU0MHpPTEY5eFBveDFHelgzeDhWa3JIOTErMys2ZHgwblFtL0VubkpWMll6OVBFYmF6T3F5cldNVEtUd0xHUnFRUUFWYkFWZkNkZ2lPR042d2NhTWhyWVNqd1lmTGpwTGUwU2cxdkhHUlh5eEhXZVpVMkU0SW5rQ3ozMVN0ek80UUpPNVBYV1oxV1Zhd29IZjV2VURXOXBYWXBzUlBhRU9qZktuRmQrRWZqaFJBbE5sUDFYN2VzSW13TWljUnBGZWJWaTVyZG9wM1laRmw2TnM2ZVlWak4yRW5yNWtEV002ckt0WVFUZjU2UmZaQ2hSQTdxL08zNEpTUXlEQk5uV1ZGaVhBUVphNmF1TzFqTXFSbUg4S0tZZXJuM05PUXBKU3dPM1NTZmF3eTZ6T3F5cldRQ0l2ZTRhWnQwWDg2ZTBCWnVzK21MZkEvZlBXWjFXVmF5RzhidTJtYmQzN24rUGFZM1hkK2ZUTU41eWZyV1oxV1ZheTJON3B1YlJlMDdkWkdNN1dtVWJ4OEgxck02ckt0WktONitIMXBqM3Q5bC8zMmwwcGxjOU1vakhaejYxbWRWbFdzL1djSDFwZzN4N1A5dlo3S3ArdzlIR0R1ays5Wm5WWlZySWZISCsybWQ4bVgxN1B4ano5SEZydkwvZXN6cXNxMWtjVDZaWDNwanV4RHVmWHM3cVJQZEVmZm90NUdUSFdaMVdWYXkwKzJlY3RLNjhUK0p6OW54M0Y2L1JPbERDVllDakp3QWREV1oxV1ZhenlnNTltbTlrWERrSDJkeTd3WEFUNk5OaUp0dk1HdHpxc3Exa0tsek9nL0I2TGd6ZnQ4aCsvWlFCY1F1VUQ1ZE5ucGw3ajZhM09xeXJXUitTa2RVZWlWMlVyaElNZzlsRVRaZzRxL0JOTStscGJpcDhGMXVkVmxXdGUzQVRtUmxHa0c3RVRnSStWMzlrWmpJamZZWkJwbkV4NXlGZmhyYzZyS3RiQVJFejJTWGZCNjZUaHJnQ0grQ2RmWWhKUW5yMnpKU3F5M2RMUVVkOUxaTmF6cXNxMXJuWit6dmNPK25oWXJJTWxZSlFKdmJUb3lkUFlIYzFpTmdXSGVYb2FjMVlCWW9HNENOd0VHdHpxc3ExcmhRc3U5c2VqRDBwTGJ6c1JHRTAzOENCYmE5V3pqejE5eTFFYlZzSEZwRDlqVFlZQWNBZzAzVU1lMnlCMkpkdGRuVlpWcnRpMW9iRSt3bm1Pa1VFVVM0bEFaSFlYQVhaOHVldHhlejRpN2cydkNqb0VMbUw5bnhtNkFRS01BWFZvekppNXY0blFnNmE3T3F5clhCMWdBRjlrT0kxWkVwT3diQndmUWFka0ZiWEJjVGc5eW9LTkd3ZmRpR3FscU8yS2Z4WXlwUzVtSFk5dzJmUG9jcnZzTVA0SHp5MStkVmxXdkpZb0hCUGkrTzhwWU9HdWZ0L293UWdzUjJwelloQmM0N1RtZHF3c3VURGs3bmg2aDRaTFhPcGgxWDRVWTJCVFluYytIRDA3cUZybVptOTJVR2RRMEFOZm5WWlY3QzBrV0RTOENiVGgycVRSSGJ1Vy9XUHBCYlNSZEJNSHJTRFJzSE1tL1ZialFNQUpFWkUwVFlEaXZ1R0xVZmxrS052aS9BNzBxaXFyZFgwOEZCUVAweithZ3ppZUFld3pxc3E5amdxamNsU1EzbFlPRzA1TitMVFRsaFFPWStsMnhOMnNjMjFsd3JFZXdWbnVBeFpjNnhwaHZMeTRIRDB4RjRNWm9iWGdTMDRBSzVlT1J6dSt5MzNhcXdHNjNzNENjUUhaaS9UQ3BTSlhnc2NmbzdVaUJCaEVoSFVRd25FRWN4YkZObURmQWJqdHlIQ2piREFZQTRIc3drNTFXanVaOXJaUjFyZlZzSFB1VS9GTkYzMUdLNTkzMHNkdUZrY0FvcGw3aVhmQnlMOFNzRE9FUS82OGZhT0VNWXRRUUJnV3BzWGNqOW43WU1MUWhJbERHdVZHT2UydUdIS2xHWkE0UjBTT1pRYXpnYjNBNnhVTWpVRW5oRzQ0R2Z0cjNlTTl2eG9HSXhMME1rbUQ3Y1dERUJQSkMvU2pjSFpGUFlSUFdqTzNBd09BZTM0QUxIMys0YWJ6dTRjdjU5NEx1QnpxQU5KYkRITVVJZ2x4L25HUHNzT2ZwTUxhdzRPNythM0V1eU45QUFHQjZVQkRoU1IybXgzL3dBdUJoSzRHK29MdDFpK3NCR0c1M1VrNEh5L2toeExnYjZTY1JaYWtCRFV0K2ZsL3dDTzN3VGtLZ3VzcmJySjduaXcvd0NVR1lFdHp0L2hvc2NkMjJveGJOeGpRQWdJTmNna0pKVXpFT0RjcURhOFZXOWh6dDcxRmhFN3FtNHJ6dFc0QnUvMVFZQ1BhS1VBN3dwdmZOWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxVjQrYWdHUjFYb0FJQURXZi9aIi8+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.trustwallet)==null?void 0:n.solana)!=null&&r.isTrust?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.trustwallet.solana;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const Q4="FoxWallet";class Z4 extends Xn{constructor(e={}){super(),this.name=Q4,this.url="https://foxwallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImZveHdhbGxldCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDEyMDAgMTIwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTIwMCAxMjAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6I0ZGRkZGRjt9Cgkuc3Qxe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF8xXyk7fQoJLnN0MntmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfMl8pO30KCS5zdDN7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzNfKTt9Cgkuc3Q0e2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF80Xyk7fQoJLnN0NXtmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfNV8pO30KCS5zdDZ7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojNzIyQjAwO30KCS5zdDd7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzZfKTt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTQ4NS43LDY3Ny40YzIuNSwwLjgsNS4xLDEuNCw3LjcsMS43YzAsMC0xMC45LDQuMS0zMy40LTMuNmMwLDAtMTYuOS02LjktMjkuNS01LjcKCQljLTE0LjcsMS4zLTI0LjgsMjAuNC0yNC44LDIwLjRjMi45LTEuNiw2LTIuOCw5LjItMy42YzEwLTIsNi42LTAuMyw2LjYtMC4zcy0xOS4yLDguMS0yMC41LDE1LjJjLTAuMywxLjgsNS4xLTMuMywxOS4zLTIuOAoJCWMxNy41LDAuNSwzMi43LDEwLjcsMzguOSwxMi40YzEyLjgsMy40LDMxLjEsNC4yLDQ4LTljMCwwLDE1LjUtOS43LDIwLjMtMjcuN2MxLjItNSwyLTEwLjEsMi4yLTE1LjJjMC4xLTQuNS0wLjQtOS0xLjQtMTMuNQoJCUM1MjguMiw2NDUuNiw1MTkuMSw2NjYuNyw0ODUuNyw2NzcuNHoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8xXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MTYuMjE1MSIgeTE9Ijc0Ni4yNjQzIiB4Mj0iNjMzLjU3ODciIHkyPSIzMTUuMzk3OSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojREFEQjQ4Ii8+CgkJPHN0b3AgIG9mZnNldD0iMC42NTYyIiBzdHlsZT0ic3RvcC1jb2xvcjojNjM3NjIxIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTgxNi4xLDg3NC45YzMzLjktNDIuNSw1Mi4zLTk1LjIsNTIuMy0xNDkuNmMwLTU0LjMtMTguNS0xMDcuMS01Mi4zLTE0OS42bDIxNy4xLTIzLjljMCwwLDIyLjYsNjEuOSwyOC41LDk1CgkJYzAuOCw0LjIsMi4xLDEyLjgsMi4xLDEyLjhzLTMzLjcsODEuOC04NS40LDEyNi43QzkwOSw4NDYuNyw4MTYuMSw4NzQuOSw4MTYuMSw4NzQuOXogTTMwMiw4NzEuOWwtODMuMiwxNS40CgkJYy0yNi40LTY2LjktMzYuMS0xMzkuMi0yOC4xLTIxMC42YzcuOS03MS41LDMzLjMtMTM5LjksNzMuNy0xOTkuM2MxLjgtMi42LDUuNC03LjcsNS40LTcuN2w5MS45LDI1OC45TDMwMiw4NzEuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8yXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MjYuMjQ4IiB5MT0iOTcwLjIzNzEiIHgyPSI0MTUuMTU0MyIgeTI9Ijk3MC4yMzcxIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTIwMikiPgoJCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiNFQzZGMDEiLz4KCQk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMjNEIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MiIgZD0iTTYwMy4xLDM0MC45YzAuMy0wLjQsMC41LTAuNSwwLjgtMC45YzIuMi0yLjQsNTMuOS01Ny45LTcuNy0xNTJjLTQ1LjUtNjkuMy0xNjEuMi02Ny40LTIwOC41LTEwMy41CgkJYzMuNSwyNy44LDMwLjcsNTIuOSwyNy44LDkwLjljLTEuMiwxMi42LTMuNSwyNS03LDM3LjFjLTUuNiwyMS43LTEwLjgsNDIuNC0zLDgyLjljNi4xLDMxLjYsMjAuNSw1NC42LDQyLjgsNjguNQoJCWMyNS42LDE1LjgsNjEsMTkuMyw5Ny4zLDkuNUM1NjkuOCwzNjYuOCw1OTEuNCwzNTQuNiw2MDMuMSwzNDAuOUw2MDMuMSwzNDAuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8zXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MDkuMTIyMSIgeTE9IjkzNC43NDkiIHgyPSI1OTYuNjQ0MSIgeTI9IjExMzguNTYzNSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMzNFIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0ZCNkYxQiIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik02ODAuMiwzMDAuM2MxMy4zLTIyLjksMTUuOC00OS42LDcuNi03OS4yYy0xMS40LTQxLjQtMzMtNjguNi01MC41LTkwLjRjLTUuNS02LjktMTAuNi0xMy4zLTE0LjgtMTkuNAoJCWMtMTYuNi0yNC40LTIzLjgtNTQtMjAuMi04My4yYy0yMS4xLDE1LjItNjEuNyw0My44LTg3LjYsNzQuM2MzNy41LDE4LDY2LjgsMzcuNiw4OS45LDcyLjljMzkuNSw2MC4yLDM4LjgsMTA4LjgsMzEuMywxMzkKCQljLTIuMSw4LjMsMTMuOCwxNS43LDEwLjksMjIuMUM2NjAuMywzMjYuOCw2NzEuNiwzMTQuNSw2ODAuMiwzMDAuM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF80XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIyMzEuMDYzMyIgeTE9Ijc0My41NDg2IiB4Mj0iOTczLjUyOTIiIHkyPSI0NTAuMzA1MyIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRkI2RDFBIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjIzRSIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik05NjcuNyw1NTAuM2MtNDQuMS00LjItMTMzLjQtMTUuMS0xMzMuNC0xNS4xYy0yMDAuOS0xMS4yLTMxNC45LDQ5LjEtNDAwLjksMTI4Yy02Ni40LDY2LTEyNS42LDIzNy0xMjUuNiwyMzcKCQlsLTcxLjktMy45YzAsMCwyMi45LTY4LjIsNDkuNC0xMTcuOWMzMC40LTU2LjksMzcuMi01Mi4zLDMwLjMtNjEuN2MtMzIuMS00NC4xLTQ3LjItNzguOC02MC4xLTE1M2MwLDAsMTUuMSwxMS45LDI2LjUsNC42CgkJYzAsMC0yNS45LTQ1LTI5LjktOTMuNmMtNy4xLTg2LjEsMzMuMi0yMDMuNywzNC4yLTIwNi40Yy0wLjQsMS4yLTIuNSwxMS4zLDIxLjEsMjYuNGMxLjctNy4xLDMuNS0xNC4xLDUuNC0yMC45CgkJYzguMy00MC42LDMwLjYtMTI5LjMsNzUuMS0xODkuNGMwLDAsMjQuOSw4Ni45LDg3LjQsMTI2LjNjMTIxLjcsNzYuOCwxOTcuOSw3Ny4yLDE5Ny45LDc3LjJjMTcxLjksMTkuMiwyNDUuMywxMDMuNiwyNDUuMywxMDMuNgoJCUMxMDQxLjksNTI0LjYsMTE1NCw1MjMuNCwxMTU0LDUyMy40QzExMTMuNyw1NjEuOSw5NjcuNyw1NTAuMyw5NjcuNyw1NTAuM3ogTTI4Ni4yLDI2OC4zYzAsMCwwLTAuMSwwLTAuMUwyODYuMiwyNjguM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF81XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIzOTcuNDM0OCIgeTE9IjMxNC44MjYxIiB4Mj0iMTEwMi40NjUyIiB5Mj0iNjI0LjcwNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjYzRiIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGQjcwMUMiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q1IiBkPSJNMTE1Ni4xLDUyMy40YzAsMC0xNy41LDk2LjgtMTA5LjIsMTA4LjFjMCwwLTMzMi42LTIuMS0zNTYuOSwzMDBsLTUuNiw4NC45bC0zOTktMTE2LjMKCQljMCwwLDM3LjYtMTI4LjMsMTE5LjktMjMxLjNjMCwwLDEzOS43LTE5Ny4zLDUzNy43LTE0NS4zYzAsMCw0Ni41LDkuNCwxMTEuNywxNS41QzExMDkuNyw1NDQuMSwxMTU2LjEsNTIzLjQsMTE1Ni4xLDUyMy40eiIvPgoJPHBhdGggY2xhc3M9InN0NiIgZD0iTTkyOS44LDQ3Ny4zYzAsMC04Ni40LTQ0LjktMTkzLjktNDAuN2MwLDAsNTguNS00NS43LDEzNy41LTM0LjVMOTI5LjgsNDc3LjN6Ii8+CgoJCTxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfNl8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMzI0Ljc0IiB5MT0iODYuNzMzMyIgeDI9IjkzNS4xNDM4IiB5Mj0iNDY3LjMyNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0VDNkYwMCIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGNEIzM0UiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q3IiBkPSJNNzExLjMsODkwLjFjMCwwLDI4LjEsMTkuNCw3Mi43LDkuMWMwLDAtNzIuMSw0MS44LTIyNC4xLTE1LjVjMCwwLTE1Ni43LTcwLjEtMjY3LTU0LjEKCQljLTcwLjksMTAuMy0xMzMuNSw2Ni42LTE3MS41LDEwOS40Yy00NS44LDUxLjgtNDAuMSwyNy42LDc1LDEzLjNjMjcuNy0zLjQsMTEuNyw0LjQsMTEuNyw0LjRTNTQuNCwxMDIxLjIsNDQsMTA3OC41CgkJYy0yLjYsMTQuMyw0MC41LTI2LjEsMTU0LjItMjIuNWMxMzkuNiw0LjQsMjYxLDg1LjQsMzEwLjksOTguOGMxMDIuMiwyNy4zLDI0OC44LDMzLjYsMzgzLjMtNzEuOWMwLDAsMTI0LjEtNzcuOSwxNjIuNS0yMjEuOAoJCWMxMC0zOS45LDE1LjktODAuOCwxNy42LTEyMS45YzItNTMuNi0xNC4zLTExMC0xNC4zLTExMFM5NjcuNiw4MzAuMyw3MTEuMyw4OTAuMXoiLz4KPC9nPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.foxwallet)==null?void 0:n.solana)!=null&&r.isFoxWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.foxwallet.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const UM={setVisible(t){console.error(_M("call","setVisible"))},visible:!1};Object.defineProperty(UM,"visible",{get(){return console.error(_M("read","visible")),!1}});function _M(t,e){return`You have tried to ${t} "${e}" on a WalletModalContext without providing one. Make sure to render a WalletModalProvider as an ancestor of the component that uses WalletModalContext`}const RM=oe.createContext(UM);function CM(){return oe.useContext(RM)}const Y4=t=>te.createElement("button",{className:`wallet-adapter-button ${t.className||""}`,disabled:t.disabled,style:t.style,onClick:t.onClick,tabIndex:t.tabIndex||0,type:"button"},t.startIcon&&te.createElement("i",{className:"wallet-adapter-button-start-icon"},t.startIcon),t.children,t.endIcon&&te.createElement("i",{className:"wallet-adapter-button-end-icon"},t.endIcon)),G4=({wallet:t,...e})=>t&&te.createElement("img",{src:t.adapter.icon,alt:`${t.adapter.name} icon`,...e}),py=({id:t,children:e,expanded:n=!1})=>{const r=oe.useRef(null),i=oe.useRef(!0),o="height 250ms ease-out",s=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.scrollHeight+"px"})},a=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.offsetHeight+"px",l.style.overflow="hidden",requestAnimationFrame(()=>{l.style.height="0"})})};return oe.useLayoutEffect(()=>{n?s():a()},[n]),oe.useLayoutEffect(()=>{const l=r.current;if(!l)return;function d(){l&&(l.style.overflow=n?"initial":"hidden",n&&(l.style.height="auto"))}function g(y){l&&y.target===l&&y.propertyName==="height"&&d()}return i.current&&(d(),i.current=!1),l.addEventListener("transitionend",g),()=>l.removeEventListener("transitionend",g)},[n]),te.createElement("div",{className:"wallet-adapter-collapse",id:t,ref:r,role:"region",style:{height:0,transition:i.current?void 0:o}},e)},Td=({handleClick:t,tabIndex:e,wallet:n})=>te.createElement("li",null,te.createElement(Y4,{onClick:t,startIcon:te.createElement(G4,{wallet:n}),tabIndex:e},n.adapter.name,n.readyState===$.Installed&&te.createElement("span",null,"Detected"))),H4=()=>te.createElement("svg",{width:"97",height:"96",viewBox:"0 0 97 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},te.createElement("circle",{cx:"48.5",cy:"48",r:"48",fill:"url(#paint0_linear_880_5115)",fillOpacity:"0.1"}),te.createElement("circle",{cx:"48.5",cy:"48",r:"47",stroke:"url(#paint1_linear_880_5115)",strokeOpacity:"0.4",strokeWidth:"2"}),te.createElement("g",{clipPath:"url(#clip0_880_5115)"},te.createElement("path",{d:"M65.5769 28.1523H31.4231C27.6057 28.1523 24.5 31.258 24.5 35.0754V60.9215C24.5 64.7389 27.6057 67.8446 31.4231 67.8446H65.5769C69.3943 67.8446 72.5 64.7389 72.5 60.9215V35.0754C72.5 31.258 69.3943 28.1523 65.5769 28.1523ZM69.7308 52.1523H59.5769C57.2865 52.1523 55.4231 50.289 55.4231 47.9985C55.4231 45.708 57.2864 43.8446 59.5769 43.8446H69.7308V52.1523ZM69.7308 41.0754H59.5769C55.7595 41.0754 52.6539 44.1811 52.6539 47.9985C52.6539 51.8159 55.7595 54.9215 59.5769 54.9215H69.7308V60.9215C69.7308 63.2119 67.8674 65.0754 65.5769 65.0754H31.4231C29.1327 65.0754 27.2692 63.212 27.2692 60.9215V35.0754C27.2692 32.785 29.1326 30.9215 31.4231 30.9215H65.5769C67.8673 30.9215 69.7308 32.7849 69.7308 35.0754V41.0754Z",fill:"url(#paint2_linear_880_5115)"}),te.createElement("path",{d:"M61.4231 46.6172H59.577C58.8123 46.6172 58.1924 47.2371 58.1924 48.0018C58.1924 48.7665 58.8123 49.3863 59.577 49.3863H61.4231C62.1878 49.3863 62.8077 48.7664 62.8077 48.0018C62.8077 47.2371 62.1878 46.6172 61.4231 46.6172Z",fill:"url(#paint3_linear_880_5115)"})),te.createElement("defs",null,te.createElement("linearGradient",{id:"paint0_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint1_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint2_linear_880_5115",x1:"25.9583",y1:"68.7101",x2:"67.2337",y2:"23.7879",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint3_linear_880_5115",x1:"58.3326",y1:"49.4467",x2:"61.0002",y2:"45.4453",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("clipPath",{id:"clip0_880_5115"},te.createElement("rect",{width:"48",height:"48",fill:"white",transform:"translate(24.5 24)"})))),K4=({className:t="",container:e="body"})=>{const n=oe.useRef(null),{wallets:r,select:i}=kM(),{setVisible:o}=CM(),[s,a]=oe.useState(!1),[l,d]=oe.useState(!1),[g,y]=oe.useState(null),[x,v]=oe.useMemo(()=>{const w=[],j=[],C=[];for(const B of r)B.readyState===$.NotDetected?C.push(B):B.readyState===$.Loadable?j.push(B):B.readyState===$.Installed&&w.push(B);let U=[],O=[];return w.length?(U=w,O=[...j,...C]):(j.length&&(U=j),O=C),[U,O]},[r]),A=oe.useCallback(()=>{d(!1),setTimeout(()=>o(!1),150)},[o]),k=oe.useCallback(w=>{w.preventDefault(),A()},[A]),D=oe.useCallback((w,j)=>{i(j),k(w)},[i,k]),I=oe.useCallback(()=>a(!s),[s]),M=oe.useCallback(w=>{const j=n.current;if(!j)return;const C=j.querySelectorAll("button"),U=C[0],O=C[C.length-1];w.shiftKey?document.activeElement===U&&(O.focus(),w.preventDefault()):document.activeElement===O&&(U.focus(),w.preventDefault())},[n]);return oe.useLayoutEffect(()=>{const w=C=>{C.key==="Escape"?A():C.key==="Tab"&&M(C)},{overflow:j}=window.getComputedStyle(document.body);return setTimeout(()=>d(!0),0),document.body.style.overflow="hidden",window.addEventListener("keydown",w,!1),()=>{document.body.style.overflow=j,window.removeEventListener("keydown",w,!1)}},[A,M]),oe.useLayoutEffect(()=>y(document.querySelector(e)),[e]),g&&Lw.createPortal(te.createElement("div",{"aria-labelledby":"wallet-adapter-modal-title","aria-modal":"true",className:`wallet-adapter-modal ${l&&"wallet-adapter-modal-fade-in"} ${t}`,ref:n,role:"dialog"},te.createElement("div",{className:"wallet-adapter-modal-container"},te.createElement("div",{className:"wallet-adapter-modal-wrapper"},te.createElement("button",{onClick:k,className:"wallet-adapter-modal-button-close"},te.createElement("svg",{width:"14",height:"14"},te.createElement("path",{d:"M14 12.461 8.3 6.772l5.234-5.233L12.006 0 6.772 5.234 1.54 0 0 1.539l5.234 5.233L0 12.006l1.539 1.528L6.772 8.3l5.69 5.7L14 12.461z"}))),x.length?te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"Connect a wallet on Solana to continue"),te.createElement("ul",{className:"wallet-adapter-modal-list"},x.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),wallet:w})),v.length?te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))):null),v.length?te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Less ":"More ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))):null):te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"You'll need a wallet on Solana to continue"),te.createElement("div",{className:"wallet-adapter-modal-middle"},te.createElement(H4,null)),v.length?te.createElement(te.Fragment,null,te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Hide ":"Already have a wallet? View ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.createElement("path",{d:"M0.71418 1.626L5.83323 6.26188C5.91574 6.33657 6.0181 6.39652 6.13327 6.43762C6.24844 6.47872 6.37371 6.5 6.50048 6.5C6.62725 6.5 6.75252 6.47872 6.8677 6.43762C6.98287 6.39652 7.08523 6.33657 7.16774 6.26188L12.2868 1.626C12.7753 1.1835 12.3703 0.5 11.6195 0.5H1.37997C0.629216 0.5 0.224175 1.1835 0.71418 1.626Z"}))),te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},te.createElement("ul",{className:"wallet-adapter-modal-list"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))))):null))),te.createElement("div",{className:"wallet-adapter-modal-overlay",onMouseDown:k})),g)},J4=({children:t,...e})=>{const[n,r]=oe.useState(!1);return te.createElement(RM.Provider,{value:{visible:n,setVisible:r}},t,n&&te.createElement(K4,{...e}))};const V0="-";function X4(t){const e=$4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;function i(s){const a=s.split(V0);return a[0]===""&&a.length!==1&&a.shift(),OM(a,e)||q4(s)}function o(s,a){const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function OM(t,e){var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?OM(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(V0);return(s=e.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId}const gy=/^\[(.+)\]$/;function q4(t){if(gy.test(t)){const e=gy.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function $4(t){const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return t2(Object.entries(t.classGroups),n).forEach(([o,s])=>{ih(s,r,o,e)}),r}function ih(t,e,n,r){t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:yy(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(e2(i)){ih(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{ih(s,yy(e,o),n,r)})})}function yy(t,e){let n=t;return e.split(V0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function e2(t){return t.isThemeGetter}function t2(t,e){return e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[e+s,a])):o);return[n,i]}):t}function n2(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const BM="!";function r2(t){const e=t.separator,n=e.length===1,r=e[0],i=e.length;return function(s){const a=[];let l=0,d=0,g;for(let k=0;kd?g-d:void 0;return{modifiers:a,hasImportantModifier:x,baseClassName:v,maybePostfixModifierPosition:A}}}function i2(t){if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e}function o2(t){return{cache:n2(t.cacheSize),splitModifiers:r2(t),...X4(t)}}const s2=/\s+/;function a2(t,e){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=new Set;return t.trim().split(s2).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:d,maybePostfixModifierPosition:g}=n(s);let y=r(g?d.substring(0,g):d),x=!!g;if(!y){if(!g)return{isTailwindClass:!1,originalClassName:s};if(y=r(d),!y)return{isTailwindClass:!1,originalClassName:s};x=!1}const v=i2(a).join(":");return{isTailwindClass:!0,modifierId:l?v+BM:v,classGroupId:y,originalClassName:s,hasPostfixModifier:x}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:d}=s,g=a+l;return o.has(g)?!1:(o.add(g),i(l,d).forEach(y=>o.add(a+y)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function l2(){let t=0,e,n,r="";for(;ty(g),t());return n=o2(d),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const g=a2(l,n);return i(l,g),g}return function(){return o(l2.apply(null,arguments))}}function it(t){const e=n=>n[t]||[];return e.isThemeGetter=!0,e}const WM=/^\[(?:([a-z-]+):)?(.+)\]$/i,u2=/^\d+\/\d+$/,d2=new Set(["px","full","screen"]),f2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,h2=/\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$/,p2=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,g2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function fr(t){return lo(t)||d2.has(t)||u2.test(t)}function gi(t){return Ds(t,"length",I2)}function lo(t){return!!t&&!Number.isNaN(Number(t))}function hl(t){return Ds(t,"number",lo)}function Vs(t){return!!t&&Number.isInteger(Number(t))}function y2(t){return t.endsWith("%")&&lo(t.slice(0,-1))}function be(t){return WM.test(t)}function yi(t){return f2.test(t)}const m2=new Set(["length","size","percentage"]);function w2(t){return Ds(t,m2,VM)}function M2(t){return Ds(t,"position",VM)}const N2=new Set(["image","url"]);function v2(t){return Ds(t,N2,k2)}function S2(t){return Ds(t,"",b2)}function Ps(){return!0}function Ds(t,e,n){const r=WM.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1}function I2(t){return h2.test(t)}function VM(){return!1}function b2(t){return p2.test(t)}function k2(t){return g2.test(t)}function E2(){const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),i=it("borderColor"),o=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),d=it("grayscale"),g=it("hueRotate"),y=it("invert"),x=it("gap"),v=it("gradientColorStops"),A=it("gradientColorStopPositions"),k=it("inset"),D=it("margin"),I=it("opacity"),M=it("padding"),w=it("saturate"),j=it("scale"),C=it("sepia"),U=it("skew"),O=it("space"),B=it("translate"),Y=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",be,e],ie=()=>[be,e],R=()=>["",fr,gi],c=()=>["auto",lo,be],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],S=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],b=()=>["start","end","center","between","around","evenly","stretch"],N=()=>["","0",be],T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],m=()=>[lo,hl],u=()=>[lo,be];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[fr,gi],blur:["none","",yi,be],brightness:m(),borderColor:[t],borderRadius:["none","","full",yi,be],borderSpacing:ie(),borderWidth:R(),contrast:m(),grayscale:N(),hueRotate:u(),invert:N(),gap:ie(),gradientColorStops:[t],gradientColorStopPositions:[y2,gi],inset:q(),margin:q(),opacity:m(),padding:ie(),saturate:m(),scale:m(),sepia:N(),skew:u(),space:ie(),translate:ie()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[yi]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),be]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Vs,be]}],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",be]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:["first","last","none",Vs,be]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Vs,be]},be]}],"col-start":[{"col-start":c()}],"col-end":[{"col-end":c()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Vs,be]},be]}],"row-start":[{"row-start":c()}],"row-end":[{"row-end":c()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...b()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...b(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...b(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],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":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",be,e]}],"min-w":[{"min-w":["min","max","fit",be,fr]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[yi]},yi,be]}],h:[{h:[be,e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",fr,be]}],"max-h":[{"max-h":[be,e,"min","max","fit"]}],"font-size":[{text:["base",yi,gi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hl]}],"font-family":[{font:[Ps]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",be]}],"line-clamp":[{"line-clamp":["none",lo,hl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fr,be]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...S(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,gi]}],"underline-offset":[{"underline-offset":["auto",fr,be]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:ie()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],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",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),M2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",w2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},v2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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":[I]}],"border-style":[{border:[...S(),"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":[I]}],"divide-style":[{divide:S()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[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:["",...S()]}],"outline-offset":[{"outline-offset":[fr,be]}],"outline-w":[{outline:[fr,gi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[fr,gi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yi,S2]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":z()}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",yi,be]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[y]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",be]}],duration:[{duration:u()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:u()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Vs,be]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",be]}],accent:[{accent:["auto",t]}],appearance:["appearance-none"],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",be]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ie()}],"scroll-mx":[{"scroll-mx":ie()}],"scroll-my":[{"scroll-my":ie()}],"scroll-ms":[{"scroll-ms":ie()}],"scroll-me":[{"scroll-me":ie()}],"scroll-mt":[{"scroll-mt":ie()}],"scroll-mr":[{"scroll-mr":ie()}],"scroll-mb":[{"scroll-mb":ie()}],"scroll-ml":[{"scroll-ml":ie()}],"scroll-p":[{"scroll-p":ie()}],"scroll-px":[{"scroll-px":ie()}],"scroll-py":[{"scroll-py":ie()}],"scroll-ps":[{"scroll-ps":ie()}],"scroll-pe":[{"scroll-pe":ie()}],"scroll-pt":[{"scroll-pt":ie()}],"scroll-pr":[{"scroll-pr":ie()}],"scroll-pb":[{"scroll-pb":ie()}],"scroll-pl":[{"scroll-pl":ie()}],"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",be]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[fr,gi,hl]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"]},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"],"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-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"]}}}const x2=c2(E2),T2=t=>at.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 56 64",...t,children:[at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",d:"m28 4 .015 13.1M52.46 46.01l-11.137-6.555M4.099 46.01l11.137-6.555"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M28.009 32.01 15 24.49l13.009-7.518L41 24.52l-12.991 7.49Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28.02 46.969-13.003-7.463L15 24.49l13.02 7.52V46.97Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28 46.969 13.003-7.43V24.521L28 32.01v14.958Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M52 46.01V18.032L28 4.042 4 18.032V46.01L28 60l24-13.99Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M4.04 18.056 28 32.047l24.04-13.99"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"3",d:"M28 32.046V60"})]}),A2=oe.lazy(()=>Ba(()=>import("./widget-e5024a77.js"),["assets/widget-e5024a77.js","assets/punycode-06c60053.js"])),D2=({rootWrapperClassNames:t,rootWrapperStyles:e,isDark:n,...r})=>{const[i,o]=oe.useState(!1);return at.jsxs("div",{className:x2("bonfida-widget-root sns-bw",t,n&&"dark"),style:e,children:[at.jsx("button",{onClick:()=>o(!i),className:"w-[50px] h-[50px] rounded-full bg-background-primary overflow-hidden text-text-primary p-2 flex items-center justify-center shadow-xl dark:border dark:border-interactive-border",type:"button","aria-label":i?"Close SNS widget":"Open SNS widget","aria-haspopup":"true",tabIndex:0,children:at.jsx(T2,{className:"w-full h-full"})}),i&&at.jsx(oe.Suspense,{children:at.jsx(A2,{...r})})]})};const L2="https://helius-proxy.bonfida.com",z2=({children:t})=>at.jsx(a4,{autoConnect:!0,wallets:[new B4,new W4,new E4,new N4,new h4,new b4,new S4,new c4,new T4,new P4,new D4,new z4,new Z4],children:at.jsx(J4,{children:t})}),j2=()=>{const t=kM(),{visible:e,setVisible:n}=CM(),[r,i]=oe.useState(!1);return at.jsxs("div",{className:"p-10",children:[at.jsx("h1",{className:"text-[40px] text-center text-white font-medium",children:"SNS Widget Demo"}),at.jsx("div",{className:"mt-10",children:at.jsx("button",{className:"p-3 bg-white rounded-[24px] font-medium",onClick:()=>i(!r),children:"Toggle dark"})}),at.jsx(D2,{endpoint:L2,passthroughWallet:{...t,visible:e,setVisible:n},isDark:r})]})};function U2(){return at.jsx(z2,{children:at.jsx(j2,{})})}const _2="/sns-widget/assets/preview-bg-7f26f3aa.png";Ad.createRoot(document.getElementById("root")).render(at.jsx(te.StrictMode,{children:at.jsx("div",{style:{backgroundImage:`url(${_2})`,backgroundSize:"cover",height:"100vh",width:"100vw"},children:at.jsx(U2,{})})}));export{Tf as A,C2 as B,Mx as C,R2 as D,Fx as E,Ue as F,mT as G,x2 as H,Le as I,wT as J,_I as K,Rx as L,qr as M,_f as N,Kt as O,X as P,Uo as Q,te as R,B4 as S,Xe as T,ws as V,a4 as W,Cx as a,ye as b,vr as c,Wt as d,t1 as e,Or as f,my as g,kM as h,V2 as i,at as j,CM as k,J4 as l,st as m,L1 as n,_e as o,de as p,ue as q,oe as r,_c as s,sb as t,Ox as u,cn as v,fg as w,Ms as x,Lr as y,Rf as z}; diff --git a/preview-build/assets/punycode-06c60053.js b/preview-build/assets/punycode-06c60053.js new file mode 100644 index 0000000..ba1790b --- /dev/null +++ b/preview-build/assets/punycode-06c60053.js @@ -0,0 +1,11 @@ +import{c as ie,d as W,b as At,s as pr,f as yr}from"./index-f54a1fc2.js";var Rt={exports:{}},_e=typeof Reflect=="object"?Reflect:null,xt=_e&&typeof _e.apply=="function"?_e.apply:function(t,r,o){return Function.prototype.apply.call(t,r,o)},Me;_e&&typeof _e.ownKeys=="function"?Me=_e.ownKeys:Object.getOwnPropertySymbols?Me=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Me=function(t){return Object.getOwnPropertyNames(t)};function Kr(e){console&&console.warn&&console.warn(e)}var hr=Number.isNaN||function(t){return t!==t};function z(){z.init.call(this)}Rt.exports=z;Rt.exports.once=Zr;z.EventEmitter=z;z.prototype._events=void 0;z.prototype._eventsCount=0;z.prototype._maxListeners=void 0;var $t=10;function We(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(z,"defaultMaxListeners",{enumerable:!0,get:function(){return $t},set:function(e){if(typeof e!="number"||e<0||hr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");$t=e}});z.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};z.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||hr(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function gr(e){return e._maxListeners===void 0?z.defaultMaxListeners:e._maxListeners}z.prototype.getMaxListeners=function(){return gr(this)};z.prototype.emit=function(t){for(var r=[],o=1;o0&&(y=r[0]),y instanceof Error)throw y;var _=new Error("Unhandled error."+(y?" ("+y.message+")":""));throw _.context=y,_}var h=d[t];if(h===void 0)return!1;if(typeof h=="function")xt(h,this,r);else for(var P=h.length,I=_r(h,P),o=0;o0&&y.length>a&&!y.warned){y.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+y.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=y.length,Kr(_)}return e}z.prototype.addListener=function(t,r){return vr(this,t,r,!1)};z.prototype.on=z.prototype.addListener;z.prototype.prependListener=function(t,r){return vr(this,t,r,!0)};function Yr(){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 br(e,t,r){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=Yr.bind(o);return a.listener=r,o.wrapFn=a,a}z.prototype.once=function(t,r){return We(r),this.on(t,br(this,t,r)),this};z.prototype.prependOnceListener=function(t,r){return We(r),this.prependListener(t,br(this,t,r)),this};z.prototype.removeListener=function(t,r){var o,a,d,y,_;if(We(r),a=this._events,a===void 0)return this;if(o=a[t],o===void 0)return this;if(o===r||o.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,o.listener||r));else if(typeof o!="function"){for(d=-1,y=o.length-1;y>=0;y--)if(o[y]===r||o[y].listener===r){_=o[y].listener,d=y;break}if(d<0)return this;d===0?o.shift():Jr(o,d),o.length===1&&(a[t]=o[0]),a.removeListener!==void 0&&this.emit("removeListener",t,_||r)}return this};z.prototype.off=z.prototype.removeListener;z.prototype.removeAllListeners=function(t){var r,o,a;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[t]),this;if(arguments.length===0){var d=Object.keys(o),y;for(a=0;a=0;a--)this.removeListener(t,r[a]);return this};function wr(e,t,r){var o=e._events;if(o===void 0)return[];var a=o[t];return a===void 0?[]:typeof a=="function"?r?[a.listener||a]:[a]:r?Xr(a):_r(a,a.length)}z.prototype.listeners=function(t){return wr(this,t,!0)};z.prototype.rawListeners=function(t){return wr(this,t,!1)};z.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):mr.call(e,t)};z.prototype.listenerCount=mr;function mr(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}z.prototype.eventNames=function(){return this._eventsCount>0?Me(this._events):[]};function _r(e,t){for(var r=new Array(t),o=0;o"u"||!J?$:J(Uint8Array),ce={"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":ve&&J?J([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":we,"%AsyncGenerator%":we,"%AsyncGeneratorFunction%":we,"%AsyncIteratorPrototype%":we,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":Or,"%GeneratorFunction%":we,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ve&&J?J(J([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ve||!J?$:J(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ve||!J?$:J(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ve&&J?J(""[Symbol.iterator]()):$,"%Symbol%":ve?Symbol:$,"%SyntaxError%":Ee,"%ThrowTypeError%":bn,"%TypedArray%":mn,"%TypeError%":Se,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(J)try{null.error}catch(e){var _n=J(J(e));ce["%Error.prototype%"]=_n}var Sn=function e(t){var r;if(t==="%AsyncFunction%")r=Je("async function () {}");else if(t==="%GeneratorFunction%")r=Je("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Je("async function* () {}");else if(t==="%AsyncGenerator%"){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&J&&(r=J(a.prototype))}return ce[t]=r,r},Ht={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Pe=jt,Fe=vn,En=Pe.call(Function.call,Array.prototype.concat),An=Pe.call(Function.apply,Array.prototype.splice),Vt=Pe.call(Function.call,String.prototype.replace),Be=Pe.call(Function.call,String.prototype.slice),Rn=Pe.call(Function.call,RegExp.prototype.exec),On=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tn=/\\(\\)?/g,Pn=function(t){var r=Be(t,0,1),o=Be(t,-1);if(r==="%"&&o!=="%")throw new Ee("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ee("invalid intrinsic syntax, expected opening `%`");var a=[];return Vt(t,On,function(d,y,_,h){a[a.length]=_?Vt(h,Tn,"$1"):y||d}),a},jn=function(t,r){var o=t,a;if(Fe(Ht,o)&&(a=Ht[o],o="%"+a[0]+"%"),Fe(ce,o)){var d=ce[o];if(d===we&&(d=Sn(o)),typeof d>"u"&&!r)throw new Se("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:d}}throw new Ee("intrinsic "+t+" does not exist!")},Ae=function(t,r){if(typeof t!="string"||t.length===0)throw new Se("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Se('"allowMissing" argument must be a boolean');if(Rn(/^%?[^%]*%?$/,t)===null)throw new Ee("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=Pn(t),a=o.length>0?o[0]:"",d=jn("%"+a+"%",r),y=d.name,_=d.value,h=!1,P=d.alias;P&&(a=P[0],An(o,En([0,1],P)));for(var I=1,k=!0;I=o.length){var L=le(_,x);k=!!L,k&&"get"in L&&!("originalValue"in L.get)?_=L.get:_=_[x]}else k=Fe(_,x),_=_[x];k&&!h&&(ce[y]=_)}}return _},Tr={exports:{}},Mn=Ae,ht=Mn("%Object.defineProperty%",!0),gt=function(){if(ht)try{return ht({},"a",{value:1}),!0}catch{return!1}return!1};gt.hasArrayLengthDefineBug=function(){if(!gt())return null;try{return ht([],"length",{value:1}).length!==1}catch{return!0}};var Pr=gt,Ln=Ae,Le=Ln("%Object.getOwnPropertyDescriptor%",!0);if(Le)try{Le([],"length")}catch{Le=null}var Mt=Le,Cn=Pr(),Lt=Ae,Oe=Cn&&Lt("%Object.defineProperty%",!0);if(Oe)try{Oe({},"a",{value:1})}catch{Oe=!1}var In=Lt("%SyntaxError%"),be=Lt("%TypeError%"),zt=Mt,Nn=function(t,r,o){if(!t||typeof t!="object"&&typeof t!="function")throw new be("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new be("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new be("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new be("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new be("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new be("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,_=arguments.length>6?arguments[6]:!1,h=!!zt&&zt(t,r);if(Oe)Oe(t,r,{configurable:y===null&&h?h.configurable:!y,enumerable:a===null&&h?h.enumerable:!a,value:o,writable:d===null&&h?h.writable:!d});else if(_||!a&&!d&&!y)t[r]=o;else throw new In("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},jr=Ae,Kt=Nn,Dn=Pr(),Yt=Mt,Jt=jr("%TypeError%"),Fn=jr("%Math.floor%"),Bn=function(t,r){if(typeof t!="function")throw new Jt("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Fn(r)!==r)throw new Jt("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,d=!0;if("length"in t&&Yt){var y=Yt(t,"length");y&&!y.configurable&&(a=!1),y&&!y.writable&&(d=!1)}return(a||d||!o)&&(Dn?Kt(t,"length",r,!0,!0):Kt(t,"length",r)),t};(function(e){var t=jt,r=Ae,o=Bn,a=r("%TypeError%"),d=r("%Function.prototype.apply%"),y=r("%Function.prototype.call%"),_=r("%Reflect.apply%",!0)||t.call(y,d),h=r("%Object.defineProperty%",!0),P=r("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}e.exports=function(x){if(typeof x!="function")throw new a("a function is required");var H=_(t,y,arguments);return o(H,1+P(0,x.length-(arguments.length-1)),!0)};var I=function(){return _(t,d,arguments)};h?h(e.exports,"apply",{value:I}):e.exports.apply=I})(Tr);var Mr=Tr.exports,Lr=Ae,Cr=Mr,kn=Cr(Lr("String.prototype.indexOf")),Ir=function(t,r){var o=Lr(t,!!r);return typeof o=="function"&&kn(t,".prototype.")>-1?Cr(o):o},Un=Pt(),xn=Ir,vt=xn("Object.prototype.toString"),qe=function(t){return Un&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:vt(t)==="[object Arguments]"},Nr=function(t){return qe(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vt(t)!=="[object Array]"&&vt(t.callee)==="[object Function]"},$n=function(){return qe(arguments)}();qe.isLegacyArguments=Nr;var Wn=$n?qe:Nr,qn=Object.prototype.toString,Gn=Function.prototype.toString,Hn=/^\s*(?:function)?\*/,Dr=Pt(),Ze=Object.getPrototypeOf,Vn=function(){if(!Dr)return!1;try{return Function("return function*() {}")()}catch{}},Qe,zn=function(t){if(typeof t!="function")return!1;if(Hn.test(Gn.call(t)))return!0;if(!Dr){var r=qn.call(t);return r==="[object GeneratorFunction]"}if(!Ze)return!1;if(typeof Qe>"u"){var o=Vn();Qe=o?Ze(o):!1}return Ze(t)===Qe},Fr=Function.prototype.toString,me=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,bt,Ce;if(typeof me=="function"&&typeof Object.defineProperty=="function")try{bt=Object.defineProperty({},"length",{get:function(){throw Ce}}),Ce={},me(function(){throw 42},null,bt)}catch(e){e!==Ce&&(me=null)}else me=null;var Kn=/^\s*class\b/,wt=function(t){try{var r=Fr.call(t);return Kn.test(r)}catch{return!1}},et=function(t){try{return wt(t)?!1:(Fr.call(t),!0)}catch{return!1}},Ie=Object.prototype.toString,Yn="[object Object]",Jn="[object Function]",Xn="[object GeneratorFunction]",Zn="[object HTMLAllCollection]",Qn="[object HTML document.all class]",ei="[object HTMLCollection]",ti=typeof Symbol=="function"&&!!Symbol.toStringTag,ri=!(0 in[,]),mt=function(){return!1};if(typeof document=="object"){var ni=document.all;Ie.call(ni)===Ie.call(document.all)&&(mt=function(t){if((ri||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=Ie.call(t);return(r===Zn||r===Qn||r===ei||r===Yn)&&t("")==null}catch{}return!1})}var ii=me?function(t){if(mt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{me(t,null,bt)}catch(r){if(r!==Ce)return!1}return!wt(t)&&et(t)}:function(t){if(mt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(ti)return et(t);if(wt(t))return!1;var r=Ie.call(t);return r!==Jn&&r!==Xn&&!/^\[object HTML/.test(r)?!1:et(t)},oi=ii,ai=Object.prototype.toString,Br=Object.prototype.hasOwnProperty,fi=function(t,r,o){for(var a=0,d=t.length;a=3&&(a=o),ai.call(t)==="[object Array]"?fi(t,r,a):typeof t=="string"?ui(t,r,a):si(t,r,a)},ci=li,tt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],di=typeof globalThis>"u"?ie:globalThis,pi=function(){for(var t=[],r=0;r"u"?ie:globalThis,_t=yi(),It=Ct("String.prototype.slice"),rt=Object.getPrototypeOf,gi=Ct("Array.prototype.indexOf",!0)||function(t,r){for(var o=0;o-1?r:r!=="Object"?!1:bi(t)}return Ne?vi(t):null},wi=Ur,mi=function(t){return!!wi(t)};(function(e){var t=Wn,r=zn,o=Ur,a=mi;function d(b){return b.call.bind(b)}var y=typeof BigInt<"u",_=typeof Symbol<"u",h=d(Object.prototype.toString),P=d(Number.prototype.valueOf),I=d(String.prototype.valueOf),k=d(Boolean.prototype.valueOf);if(y)var x=d(BigInt.prototype.valueOf);if(_)var H=d(Symbol.prototype.valueOf);function j(b,je){if(typeof b!="object")return!1;try{return je(b),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=a;function L(b){return typeof Promise<"u"&&b instanceof Promise||b!==null&&typeof b=="object"&&typeof b.then=="function"&&typeof b.catch=="function"}e.isPromise=L;function T(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(b):a(b)||c(b)}e.isArrayBufferView=T;function l(b){return o(b)==="Uint8Array"}e.isUint8Array=l;function w(b){return o(b)==="Uint8ClampedArray"}e.isUint8ClampedArray=w;function S(b){return o(b)==="Uint16Array"}e.isUint16Array=S;function R(b){return o(b)==="Uint32Array"}e.isUint32Array=R;function E(b){return o(b)==="Int8Array"}e.isInt8Array=E;function D(b){return o(b)==="Int16Array"}e.isInt16Array=D;function q(b){return o(b)==="Int32Array"}e.isInt32Array=q;function F(b){return o(b)==="Float32Array"}e.isFloat32Array=F;function N(b){return o(b)==="Float64Array"}e.isFloat64Array=N;function K(b){return o(b)==="BigInt64Array"}e.isBigInt64Array=K;function X(b){return o(b)==="BigUint64Array"}e.isBigUint64Array=X;function Z(b){return h(b)==="[object Map]"}Z.working=typeof Map<"u"&&Z(new Map);function oe(b){return typeof Map>"u"?!1:Z.working?Z(b):b instanceof Map}e.isMap=oe;function Q(b){return h(b)==="[object Set]"}Q.working=typeof Set<"u"&&Q(new Set);function te(b){return typeof Set>"u"?!1:Q.working?Q(b):b instanceof Set}e.isSet=te;function re(b){return h(b)==="[object WeakMap]"}re.working=typeof WeakMap<"u"&&re(new WeakMap);function ee(b){return typeof WeakMap>"u"?!1:re.working?re(b):b instanceof WeakMap}e.isWeakMap=ee;function ne(b){return h(b)==="[object WeakSet]"}ne.working=typeof WeakSet<"u"&&ne(new WeakSet);function Y(b){return ne(b)}e.isWeakSet=Y;function M(b){return h(b)==="[object ArrayBuffer]"}M.working=typeof ArrayBuffer<"u"&&M(new ArrayBuffer);function B(b){return typeof ArrayBuffer>"u"?!1:M.working?M(b):b instanceof ArrayBuffer}e.isArrayBuffer=B;function s(b){return h(b)==="[object DataView]"}s.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&s(new DataView(new ArrayBuffer(1),0,1));function c(b){return typeof DataView>"u"?!1:s.working?s(b):b instanceof DataView}e.isDataView=c;var g=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function C(b){return h(b)==="[object SharedArrayBuffer]"}function f(b){return typeof g>"u"?!1:(typeof C.working>"u"&&(C.working=C(new g)),C.working?C(b):b instanceof g)}e.isSharedArrayBuffer=f;function u(b){return h(b)==="[object AsyncFunction]"}e.isAsyncFunction=u;function p(b){return h(b)==="[object Map Iterator]"}e.isMapIterator=p;function m(b){return h(b)==="[object Set Iterator]"}e.isSetIterator=m;function O(b){return h(b)==="[object Generator]"}e.isGeneratorObject=O;function n(b){return h(b)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=n;function i(b){return j(b,P)}e.isNumberObject=i;function v(b){return j(b,I)}e.isStringObject=v;function A(b){return j(b,k)}e.isBooleanObject=A;function G(b){return y&&j(b,x)}e.isBigIntObject=G;function U(b){return _&&j(b,H)}e.isSymbolObject=U;function V(b){return i(b)||v(b)||A(b)||G(b)||U(b)}e.isBoxedPrimitive=V;function se(b){return typeof Uint8Array<"u"&&(B(b)||f(b))}e.isAnyArrayBuffer=se,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(b){Object.defineProperty(e,b,{enumerable:!1,value:function(){throw new Error(b+" is not supported in userland")}})})})(Ar);var _i=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"};(function(e){var t=Object.getOwnPropertyDescriptors||function(c){for(var g=Object.keys(c),C={},f=0;f=f)return m;switch(m){case"%s":return String(C[g++]);case"%d":return Number(C[g++]);case"%j":try{return JSON.stringify(C[g++])}catch{return"[Circular]"}default:return m}}),p=C[g];g"u")return function(){return e.deprecate(s,c).apply(this,arguments)};var g=!1;function C(){if(!g){if(W.process.throwDeprecation)throw new Error(c);W.process.traceDeprecation?console.trace(c):console.error(c),g=!0}return s.apply(this,arguments)}return C};var o={},a=/^$/;if({}.NODE_DEBUG){var d={}.NODE_DEBUG;d=d.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+d+"$","i")}e.debuglog=function(s){if(s=s.toUpperCase(),!o[s])if(a.test(s)){var c=W.process.pid;o[s]=function(){var g=e.format.apply(e,arguments);console.error("%s %d: %s",s,c,g)}}else o[s]=function(){};return o[s]};function y(s,c){var g={seen:[],stylize:h};return arguments.length>=3&&(g.depth=arguments[2]),arguments.length>=4&&(g.colors=arguments[3]),l(c)?g.showHidden=c:c&&e._extend(g,c),q(g.showHidden)&&(g.showHidden=!1),q(g.depth)&&(g.depth=2),q(g.colors)&&(g.colors=!1),q(g.customInspect)&&(g.customInspect=!0),g.colors&&(g.stylize=_),I(g,s,g.depth)}e.inspect=y,y.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},y.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function _(s,c){var g=y.styles[c];return g?"\x1B["+y.colors[g][0]+"m"+s+"\x1B["+y.colors[g][1]+"m":s}function h(s,c){return s}function P(s){var c={};return s.forEach(function(g,C){c[g]=!0}),c}function I(s,c,g){if(s.customInspect&&c&&Z(c.inspect)&&c.inspect!==e.inspect&&!(c.constructor&&c.constructor.prototype===c)){var C=c.inspect(g,s);return E(C)||(C=I(s,C,g)),C}var f=k(s,c);if(f)return f;var u=Object.keys(c),p=P(u);if(s.showHidden&&(u=Object.getOwnPropertyNames(c)),X(c)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return x(c);if(u.length===0){if(Z(c)){var m=c.name?": "+c.name:"";return s.stylize("[Function"+m+"]","special")}if(F(c))return s.stylize(RegExp.prototype.toString.call(c),"regexp");if(K(c))return s.stylize(Date.prototype.toString.call(c),"date");if(X(c))return x(c)}var O="",n=!1,i=["{","}"];if(T(c)&&(n=!0,i=["[","]"]),Z(c)){var v=c.name?": "+c.name:"";O=" [Function"+v+"]"}if(F(c)&&(O=" "+RegExp.prototype.toString.call(c)),K(c)&&(O=" "+Date.prototype.toUTCString.call(c)),X(c)&&(O=" "+x(c)),u.length===0&&(!n||c.length==0))return i[0]+O+i[1];if(g<0)return F(c)?s.stylize(RegExp.prototype.toString.call(c),"regexp"):s.stylize("[Object]","special");s.seen.push(c);var A;return n?A=H(s,c,g,p,u):A=u.map(function(G){return j(s,c,g,p,G,n)}),s.seen.pop(),L(A,O,i)}function k(s,c){if(q(c))return s.stylize("undefined","undefined");if(E(c)){var g="'"+JSON.stringify(c).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return s.stylize(g,"string")}if(R(c))return s.stylize(""+c,"number");if(l(c))return s.stylize(""+c,"boolean");if(w(c))return s.stylize("null","null")}function x(s){return"["+Error.prototype.toString.call(s)+"]"}function H(s,c,g,C,f){for(var u=[],p=0,m=c.length;p-1&&(u?m=m.split(` +`).map(function(n){return" "+n}).join(` +`).slice(2):m=` +`+m.split(` +`).map(function(n){return" "+n}).join(` +`))):m=s.stylize("[Circular]","special")),q(p)){if(u&&f.match(/^\d+$/))return m;p=JSON.stringify(""+f),p.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(p=p.slice(1,-1),p=s.stylize(p,"name")):(p=p.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),p=s.stylize(p,"string"))}return p+": "+m}function L(s,c,g){var C=s.reduce(function(f,u){return u.indexOf(` +`)>=0,f+u.replace(/\u001b\[\d\d?m/g,"").length+1},0);return C>60?g[0]+(c===""?"":c+` + `)+" "+s.join(`, + `)+" "+g[1]:g[0]+c+" "+s.join(", ")+" "+g[1]}e.types=Ar;function T(s){return Array.isArray(s)}e.isArray=T;function l(s){return typeof s=="boolean"}e.isBoolean=l;function w(s){return s===null}e.isNull=w;function S(s){return s==null}e.isNullOrUndefined=S;function R(s){return typeof s=="number"}e.isNumber=R;function E(s){return typeof s=="string"}e.isString=E;function D(s){return typeof s=="symbol"}e.isSymbol=D;function q(s){return s===void 0}e.isUndefined=q;function F(s){return N(s)&&Q(s)==="[object RegExp]"}e.isRegExp=F,e.types.isRegExp=F;function N(s){return typeof s=="object"&&s!==null}e.isObject=N;function K(s){return N(s)&&Q(s)==="[object Date]"}e.isDate=K,e.types.isDate=K;function X(s){return N(s)&&(Q(s)==="[object Error]"||s instanceof Error)}e.isError=X,e.types.isNativeError=X;function Z(s){return typeof s=="function"}e.isFunction=Z;function oe(s){return s===null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||typeof s=="symbol"||typeof s>"u"}e.isPrimitive=oe,e.isBuffer=_i;function Q(s){return Object.prototype.toString.call(s)}function te(s){return s<10?"0"+s.toString(10):s.toString(10)}var re=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ee(){var s=new Date,c=[te(s.getHours()),te(s.getMinutes()),te(s.getSeconds())].join(":");return[s.getDate(),re[s.getMonth()],c].join(" ")}e.log=function(){console.log("%s - %s",ee(),e.format.apply(e,arguments))},e.inherits=pe,e._extend=function(s,c){if(!c||!N(c))return s;for(var g=Object.keys(c),C=g.length;C--;)s[g[C]]=c[g[C]];return s};function ne(s,c){return Object.prototype.hasOwnProperty.call(s,c)}var Y=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(c){if(typeof c!="function")throw new TypeError('The "original" argument must be of type Function');if(Y&&c[Y]){var g=c[Y];if(typeof g!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(g,Y,{value:g,enumerable:!1,writable:!1,configurable:!0}),g}function g(){for(var C,f,u=new Promise(function(O,n){C=O,f=n}),p=[],m=0;m0?this.tail.next=l:this.head=l,this.tail=l,++this.length}},{key:"unshift",value:function(T){var l={data:T,next:this.head};this.length===0&&(this.tail=l),this.head=l,++this.length}},{key:"shift",value:function(){if(this.length!==0){var T=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,T}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(T){if(this.length===0)return"";for(var l=this.head,w=""+l.data;l=l.next;)w+=T+l.data;return w}},{key:"concat",value:function(T){if(this.length===0)return P.alloc(0);for(var l=P.allocUnsafe(T>>>0),w=this.head,S=0;w;)H(w.data,l,S),S+=w.data.length,w=w.next;return l}},{key:"consume",value:function(T,l){var w;return TR.length?R.length:T;if(E===R.length?S+=R:S+=R.slice(0,T),T-=E,T===0){E===R.length?(++w,l.next?this.head=l.next:this.head=this.tail=null):(this.head=l,l.data=R.slice(E));break}++w}return this.length-=w,S}},{key:"_getBuffer",value:function(T){var l=P.allocUnsafe(T),w=this.head,S=1;for(w.data.copy(l),T-=w.data.length;w=w.next;){var R=w.data,E=T>R.length?R.length:T;if(R.copy(l,l.length-T,0,E),T-=E,T===0){E===R.length?(++S,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=R.slice(E));break}++S}return this.length-=S,l}},{key:x,value:function(T,l){return k(this,t(t({},l),{},{depth:0,customInspect:!1}))}}]),j}(),nt}function Ei(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,W.process.nextTick(St,this,e)):W.process.nextTick(St,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(d){!t&&d?r._writableState?r._writableState.errorEmitted?W.process.nextTick(De,r):(r._writableState.errorEmitted=!0,W.process.nextTick(er,r,d)):W.process.nextTick(er,r,d):t?(W.process.nextTick(De,r),t(d)):W.process.nextTick(De,r)}),this)}function er(e,t){St(e,t),De(e)}function De(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Ai(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function St(e,t){e.emit("error",t)}function Ri(e,t){var r=e._readableState,o=e._writableState;r&&r.autoDestroy||o&&o.autoDestroy?e.destroy(t):e.emit("error",t)}var xr={destroy:Ei,undestroy:Ai,errorOrDestroy:Ri},ye={};function Oi(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var $r={};function fe(e,t,r){r||(r=Error);function o(d,y,_){return typeof t=="string"?t:t(d,y,_)}var a=function(d){Oi(y,d);function y(_,h,P){return d.call(this,o(_,h,P))||this}return y}(r);a.prototype.name=r.name,a.prototype.code=e,$r[e]=a}function tr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(o){return String(o)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Ti(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function Pi(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function ji(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}fe("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);fe("ERR_INVALID_ARG_TYPE",function(e,t,r){var o;typeof t=="string"&&Ti(t,"not ")?(o="must not be",t=t.replace(/^not /,"")):o="must be";var a;if(Pi(e," argument"))a="The ".concat(e," ").concat(o," ").concat(tr(t,"type"));else{var d=ji(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(d," ").concat(o," ").concat(tr(t,"type"))}return a+=". Received type ".concat(typeof r),a},TypeError);fe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");fe("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});fe("ERR_STREAM_PREMATURE_CLOSE","Premature close");fe("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});fe("ERR_MULTIPLE_CALLBACK","Callback called multiple times");fe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");fe("ERR_STREAM_WRITE_AFTER_END","write after end");fe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);fe("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);fe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");ye.codes=$r;var Mi=ye.codes.ERR_INVALID_OPT_VALUE;function Li(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function Ci(e,t,r,o){var a=Li(t,o,r);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var d=o?r:"highWaterMark";throw new Mi(d,a)}return Math.floor(a)}return e.objectMode?16:16*1024}var Wr={getHighWaterMark:Ci},Ii=Ni;function Ni(e,t){if(it("noDeprecation"))return e;var r=!1;function o(){if(!r){if(it("throwDeprecation"))throw new Error(t);it("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return o}function it(e){try{if(!ie.localStorage)return!1}catch{return!1}var t=ie.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var ot,rr;function Nt(){if(rr)return ot;rr=1,ot=F;function e(f){var u=this;this.next=null,this.entry=null,this.finish=function(){C(u,f)}}var t;F.WritableState=D;var r={deprecate:Ii},o=Er,a=At.Buffer,d=(typeof ie<"u"?ie:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function y(f){return a.from(f)}function _(f){return a.isBuffer(f)||f instanceof d}var h=xr,P=Wr,I=P.getHighWaterMark,k=ye.codes,x=k.ERR_INVALID_ARG_TYPE,H=k.ERR_METHOD_NOT_IMPLEMENTED,j=k.ERR_MULTIPLE_CALLBACK,L=k.ERR_STREAM_CANNOT_PIPE,T=k.ERR_STREAM_DESTROYED,l=k.ERR_STREAM_NULL_VALUES,w=k.ERR_STREAM_WRITE_AFTER_END,S=k.ERR_UNKNOWN_ENCODING,R=h.errorOrDestroy;pe(F,o);function E(){}function D(f,u,p){t=t||de(),f=f||{},typeof p!="boolean"&&(p=u instanceof t),this.objectMode=!!f.objectMode,p&&(this.objectMode=this.objectMode||!!f.writableObjectMode),this.highWaterMark=I(this,f,"writableHighWaterMark",p),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var m=f.decodeStrings===!1;this.decodeStrings=!m,this.defaultEncoding=f.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(O){re(u,O)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=f.emitClose!==!1,this.autoDestroy=!!f.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}D.prototype.getBuffer=function(){for(var u=this.bufferedRequest,p=[];u;)p.push(u),u=u.next;return p},function(){try{Object.defineProperty(D.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var q;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(q=Function.prototype[Symbol.hasInstance],Object.defineProperty(F,Symbol.hasInstance,{value:function(u){return q.call(this,u)?!0:this!==F?!1:u&&u._writableState instanceof D}})):q=function(u){return u instanceof this};function F(f){t=t||de();var u=this instanceof t;if(!u&&!q.call(F,this))return new F(f);this._writableState=new D(f,this,u),this.writable=!0,f&&(typeof f.write=="function"&&(this._write=f.write),typeof f.writev=="function"&&(this._writev=f.writev),typeof f.destroy=="function"&&(this._destroy=f.destroy),typeof f.final=="function"&&(this._final=f.final)),o.call(this)}F.prototype.pipe=function(){R(this,new L)};function N(f,u){var p=new w;R(f,p),W.process.nextTick(u,p)}function K(f,u,p,m){var O;return p===null?O=new l:typeof p!="string"&&!u.objectMode&&(O=new x("chunk",["string","Buffer"],p)),O?(R(f,O),W.process.nextTick(m,O),!1):!0}F.prototype.write=function(f,u,p){var m=this._writableState,O=!1,n=!m.objectMode&&_(f);return n&&!a.isBuffer(f)&&(f=y(f)),typeof u=="function"&&(p=u,u=null),n?u="buffer":u||(u=m.defaultEncoding),typeof p!="function"&&(p=E),m.ending?N(this,p):(n||K(this,m,f,p))&&(m.pendingcb++,O=Z(this,m,n,f,u,p)),O},F.prototype.cork=function(){this._writableState.corked++},F.prototype.uncork=function(){var f=this._writableState;f.corked&&(f.corked--,!f.writing&&!f.corked&&!f.bufferProcessing&&f.bufferedRequest&&Y(this,f))},F.prototype.setDefaultEncoding=function(u){if(typeof u=="string"&&(u=u.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((u+"").toLowerCase())>-1))throw new S(u);return this._writableState.defaultEncoding=u,this},Object.defineProperty(F.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function X(f,u,p){return!f.objectMode&&f.decodeStrings!==!1&&typeof u=="string"&&(u=a.from(u,p)),u}Object.defineProperty(F.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(f,u,p,m,O,n){if(!p){var i=X(u,m,O);m!==i&&(p=!0,O="buffer",m=i)}var v=u.objectMode?1:m.length;u.length+=v;var A=u.length>5===6?2:l>>4===14?3:l>>3===30?4:l>>6===2?-1:-2}function y(l,w,S){var R=w.length-1;if(R=0?(E>0&&(l.lastNeed=E-1),E):--R=0?(E>0&&(l.lastNeed=E-2),E):--R=0?(E>0&&(E===2?E=0:l.lastNeed=E-3),E):0))}function _(l,w,S){if((w[0]&192)!==128)return l.lastNeed=0,"�";if(l.lastNeed>1&&w.length>1){if((w[1]&192)!==128)return l.lastNeed=1,"�";if(l.lastNeed>2&&w.length>2&&(w[2]&192)!==128)return l.lastNeed=2,"�"}}function h(l){var w=this.lastTotal-this.lastNeed,S=_(this,l);if(S!==void 0)return S;if(this.lastNeed<=l.length)return l.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);l.copy(this.lastChar,w,0,l.length),this.lastNeed-=l.length}function P(l,w){var S=y(this,l,w);if(!this.lastNeed)return l.toString("utf8",w);this.lastTotal=S;var R=l.length-(S-this.lastNeed);return l.copy(this.lastChar,0,R),l.toString("utf8",w,R)}function I(l){var w=l&&l.length?this.write(l):"";return this.lastNeed?w+"�":w}function k(l,w){if((l.length-w)%2===0){var S=l.toString("utf16le",w);if(S){var R=S.charCodeAt(S.length-1);if(R>=55296&&R<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=l[l.length-2],this.lastChar[1]=l[l.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=l[l.length-1],l.toString("utf16le",w,l.length-1)}function x(l){var w=l&&l.length?this.write(l):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,S)}return w}function H(l,w){var S=(l.length-w)%3;return S===0?l.toString("base64",w):(this.lastNeed=3-S,this.lastTotal=3,S===1?this.lastChar[0]=l[l.length-1]:(this.lastChar[0]=l[l.length-2],this.lastChar[1]=l[l.length-1]),l.toString("base64",w,l.length-S))}function j(l){var w=l&&l.length?this.write(l):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function L(l){return l.toString(this.encoding)}function T(l){return l&&l.length?this.write(l):""}return ft}var ar=ye.codes.ERR_STREAM_PREMATURE_CLOSE;function Di(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,o=new Array(r),a=0;a0)if(typeof i!="string"&&!U.objectMode&&Object.getPrototypeOf(i)!==o.prototype&&(i=d(i)),A)U.endEmitted?E(n,new l):X(n,U,i,!0);else if(U.ended)E(n,new L);else{if(U.destroyed)return!1;U.reading=!1,U.decoder&&!v?(i=U.decoder.write(i),U.objectMode||i.length!==0?X(n,U,i,!1):Y(n,U)):X(n,U,i,!1)}else A||(U.reading=!1,Y(n,U))}return!U.ended&&(U.length=oe?n=oe:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function te(n,i){return n<=0||i.length===0&&i.ended?0:i.objectMode?1:n!==n?i.flowing&&i.length?i.buffer.head.data.length:i.length:(n>i.highWaterMark&&(i.highWaterMark=Q(n)),n<=i.length?n:i.ended?i.length:(i.needReadable=!0,0))}N.prototype.read=function(n){h("read",n),n=parseInt(n,10);var i=this._readableState,v=n;if(n!==0&&(i.emittedReadable=!1),n===0&&i.needReadable&&((i.highWaterMark!==0?i.length>=i.highWaterMark:i.length>0)||i.ended))return h("read: emitReadable",i.length,i.ended),i.length===0&&i.ended?p(this):ee(this),null;if(n=te(n,i),n===0&&i.ended)return i.length===0&&p(this),null;var A=i.needReadable;h("need readable",A),(i.length===0||i.length-n0?G=u(n,i):G=null,G===null?(i.needReadable=i.length<=i.highWaterMark,n=0):(i.length-=n,i.awaitDrain=0),i.length===0&&(i.ended||(i.needReadable=!0),v!==n&&i.ended&&p(this)),G!==null&&this.emit("data",G),G};function re(n,i){if(h("onEofChunk"),!i.ended){if(i.decoder){var v=i.decoder.end();v&&v.length&&(i.buffer.push(v),i.length+=i.objectMode?1:v.length)}i.ended=!0,i.sync?ee(n):(i.needReadable=!1,i.emittedReadable||(i.emittedReadable=!0,ne(n)))}}function ee(n){var i=n._readableState;h("emitReadable",i.needReadable,i.emittedReadable),i.needReadable=!1,i.emittedReadable||(h("emitReadable",i.flowing),i.emittedReadable=!0,W.process.nextTick(ne,n))}function ne(n){var i=n._readableState;h("emitReadable_",i.destroyed,i.length,i.ended),!i.destroyed&&(i.length||i.ended)&&(n.emit("readable"),i.emittedReadable=!1),i.needReadable=!i.flowing&&!i.ended&&i.length<=i.highWaterMark,f(n)}function Y(n,i){i.readingMore||(i.readingMore=!0,W.process.nextTick(M,n,i))}function M(n,i){for(;!i.reading&&!i.ended&&(i.length1&&O(A.pipes,n)!==-1)&&!je&&(h("false write response, pause",A.awaitDrain),A.awaitDrain++),v.pause())}function ze(he){h("onerror",he),Re(),n.removeListener("error",ze),t(n,"error")===0&&E(n,he)}q(n,"error",ze);function Ke(){n.removeListener("finish",Ye),Re()}n.once("close",Ke);function Ye(){h("onfinish"),n.removeListener("close",Ke),Re()}n.once("finish",Ye);function Re(){h("unpipe"),v.unpipe(n)}return n.emit("pipe",v),A.flowing||(h("pipe resume"),v.resume()),n};function B(n){return function(){var v=n._readableState;h("pipeOnDrain",v.awaitDrain),v.awaitDrain&&v.awaitDrain--,v.awaitDrain===0&&t(n,"data")&&(v.flowing=!0,f(n))}}N.prototype.unpipe=function(n){var i=this._readableState,v={hasUnpiped:!1};if(i.pipesCount===0)return this;if(i.pipesCount===1)return n&&n!==i.pipes?this:(n||(n=i.pipes),i.pipes=null,i.pipesCount=0,i.flowing=!1,n&&n.emit("unpipe",this,v),this);if(!n){var A=i.pipes,G=i.pipesCount;i.pipes=null,i.pipesCount=0,i.flowing=!1;for(var U=0;U0,A.flowing!==!1&&this.resume()):n==="readable"&&!A.endEmitted&&!A.readableListening&&(A.readableListening=A.needReadable=!0,A.flowing=!1,A.emittedReadable=!1,h("on readable",A.length,A.reading),A.length?ee(this):A.reading||W.process.nextTick(c,this)),v},N.prototype.addListener=N.prototype.on,N.prototype.removeListener=function(n,i){var v=r.prototype.removeListener.call(this,n,i);return n==="readable"&&W.process.nextTick(s,this),v},N.prototype.removeAllListeners=function(n){var i=r.prototype.removeAllListeners.apply(this,arguments);return(n==="readable"||n===void 0)&&W.process.nextTick(s,this),i};function s(n){var i=n._readableState;i.readableListening=n.listenerCount("readable")>0,i.resumeScheduled&&!i.paused?i.flowing=!0:n.listenerCount("data")>0&&n.resume()}function c(n){h("readable nexttick read 0"),n.read(0)}N.prototype.resume=function(){var n=this._readableState;return n.flowing||(h("resume"),n.flowing=!n.readableListening,g(this,n)),n.paused=!1,this};function g(n,i){i.resumeScheduled||(i.resumeScheduled=!0,W.process.nextTick(C,n,i))}function C(n,i){h("resume",i.reading),i.reading||n.read(0),i.resumeScheduled=!1,n.emit("resume"),f(n),i.flowing&&!i.reading&&n.read(0)}N.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function f(n){var i=n._readableState;for(h("flow",i.flowing);i.flowing&&n.read()!==null;);}N.prototype.wrap=function(n){var i=this,v=this._readableState,A=!1;n.on("end",function(){if(h("wrapped end"),v.decoder&&!v.ended){var V=v.decoder.end();V&&V.length&&i.push(V)}i.push(null)}),n.on("data",function(V){if(h("wrapped data"),v.decoder&&(V=v.decoder.write(V)),!(v.objectMode&&V==null)&&!(!v.objectMode&&(!V||!V.length))){var se=i.push(V);se||(A=!0,n.pause())}});for(var G in n)this[G]===void 0&&typeof n[G]=="function"&&(this[G]=function(se){return function(){return n[se].apply(n,arguments)}}(G));for(var U=0;U=i.length?(i.decoder?v=i.buffer.join(""):i.buffer.length===1?v=i.buffer.first():v=i.buffer.concat(i.length),i.buffer.clear()):v=i.buffer.consume(n,i.decoder),v}function p(n){var i=n._readableState;h("endReadable",i.endEmitted),i.endEmitted||(i.ended=!0,W.process.nextTick(m,i,n))}function m(n,i){if(h("endReadableNT",n.endEmitted,n.length),!n.endEmitted&&n.length===0&&(n.endEmitted=!0,i.readable=!1,i.emit("end"),n.autoDestroy)){var v=i._writableState;(!v||v.autoDestroy&&v.finished)&&i.destroy()}}typeof Symbol=="function"&&(N.from=function(n,i){return R===void 0&&(R=Ui()),R(N,n,i)});function O(n,i){for(var v=0,A=n.length;v0;return Ji(y,h,P,function(I){a||(a=I),I&&d.forEach(dr),!h&&(d.forEach(dr),o(a))})});return t.reduce(Xi)}var zr=Qi;(function(e,t){t=e.exports=Dt(),t.Stream=t,t.Readable=t,t.Writable=Nt(),t.Duplex=de(),t.Transform=Ft,t.PassThrough=Gr,t.finished=Ge,t.pipeline=zr})(yt,yt.exports);var uo=yt.exports,so=ae,Bt=Ot.EventEmitter,eo=pe;eo(ae,Bt);ae.Readable=Dt();ae.Writable=Nt();ae.Duplex=de();ae.Transform=Ft;ae.PassThrough=Gr;ae.finished=Ge;ae.pipeline=zr;ae.Stream=ae;function ae(){Bt.call(this)}ae.prototype.pipe=function(e,t){var r=this;function o(I){e.writable&&e.write(I)===!1&&r.pause&&r.pause()}r.on("data",o);function a(){r.readable&&r.resume&&r.resume()}e.on("drain",a),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",y),r.on("close",_));var d=!1;function y(){d||(d=!0,e.end())}function _(){d||(d=!0,typeof e.destroy=="function"&&e.destroy())}function h(I){if(P(),Bt.listenerCount(this,"error")===0)throw I}r.on("error",h),e.on("error",h);function P(){r.removeListener("data",o),e.removeListener("drain",a),r.removeListener("end",y),r.removeListener("close",_),r.removeListener("error",h),e.removeListener("error",h),r.removeListener("end",P),r.removeListener("close",P),e.removeListener("close",P)}return r.on("end",P),r.on("close",P),e.on("close",P),e.emit("pipe",r),e};function lo(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Et={exports:{}},dt=65536,to=4294967295;function ro(){throw new Error(`Secure random number generation is not supported by this browser. +Use Chrome, Firefox or Internet Explorer 11`)}var no=pr.Buffer,xe=ie.crypto||ie.msCrypto;xe&&xe.getRandomValues?Et.exports=io:Et.exports=ro;function io(e,t){if(e>to)throw new RangeError("requested too many random bytes");var r=no.allocUnsafe(e);if(e>0)if(e>dt)for(var o=0;o= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=h-P,E=Math.floor,D=String.fromCharCode,q;function F(M){throw new RangeError(S[M])}function N(M,B){for(var s=M.length,c=[];s--;)c[s]=B(M[s]);return c}function K(M,B){var s=M.split("@"),c="";s.length>1&&(c=s[0]+"@",M=s[1]),M=M.replace(w,".");var g=M.split("."),C=N(g,B).join(".");return c+C}function X(M){for(var B=[],s=0,c=M.length,g,C;s=55296&&g<=56319&&s65535&&(B-=65536,s+=D(B>>>10&1023|55296),B=56320|B&1023),s+=D(B),s}).join("")}function oe(M){return M-48<10?M-22:M-65<26?M-65:M-97<26?M-97:h}function Q(M,B){return M+22+75*(M<26)-((B!=0)<<5)}function te(M,B,s){var c=0;for(M=s?E(M/x):M>>1,M+=E(M/B);M>R*I>>1;c+=h)M=E(M/R);return E(c+(R+1)*M/(M+k))}function re(M){var B=[],s=M.length,c,g=0,C=j,f=H,u,p,m,O,n,i,v,A,G;for(u=M.lastIndexOf(L),u<0&&(u=0),p=0;p=128&&F("not-basic"),B.push(M.charCodeAt(p));for(m=u>0?u+1:0;m=s&&F("invalid-input"),v=oe(M.charCodeAt(m++)),(v>=h||v>E((_-g)/n))&&F("overflow"),g+=v*n,A=i<=f?P:i>=f+I?I:i-f,!(vE(_/G)&&F("overflow"),n*=G;c=B.length+1,f=te(g-O,c,O==0),E(g/c)>_-C&&F("overflow"),C+=E(g/c),g%=c,B.splice(g++,0,C)}return Z(B)}function ee(M){var B,s,c,g,C,f,u,p,m,O,n,i=[],v,A,G,U;for(M=X(M),v=M.length,B=j,s=0,C=H,f=0;f=B&&nE((_-s)/A)&&F("overflow"),s+=(u-B)*A,B=u,f=0;f_&&F("overflow"),n==B){for(p=s,m=h;O=m<=C?P:m>=C+I?I:m-C,!(p"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function A(W){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(G){return G.__proto__||Object.getPrototypeOf(G)},A(W)}var R={},D,ie;function Z(W,F,G){G||(G=Error);function m(w,k,_){return typeof F=="string"?F:F(w,k,_)}var S=function(w){f(_,w);var k=d(_);function _(b,v,T){var B;return a(this,_),B=k.call(this,m(b,v,T)),B.code=W,B}return r(_)}(G);R[W]=S}function J(W,F){if(Array.isArray(W)){var G=W.length;return W=W.map(function(m){return String(m)}),G>2?"one of ".concat(F," ").concat(W.slice(0,G-1).join(", "),", or ")+W[G-1]:G===2?"one of ".concat(F," ").concat(W[0]," or ").concat(W[1]):"of ".concat(F," ").concat(W[0])}else return"of ".concat(F," ").concat(String(W))}function E(W,F,G){return W.substr(!G||G<0?0:+G,F.length)===F}function te(W,F,G){return(G===void 0||G>W.length)&&(G=W.length),W.substring(G-F.length,G)===F}function q(W,F,G){return typeof G!="number"&&(G=0),G+F.length>W.length?!1:W.indexOf(F,G)!==-1}return Z("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),Z("ERR_INVALID_ARG_TYPE",function(W,F,G){D===void 0&&(D=Uu()),D(typeof W=="string","'name' must be a string");var m;typeof F=="string"&&E(F,"not ")?(m="must not be",F=F.replace(/^not /,"")):m="must be";var S;if(te(W," argument"))S="The ".concat(W," ").concat(m," ").concat(J(F,"type"));else{var w=q(W,".")?"property":"argument";S='The "'.concat(W,'" ').concat(w," ").concat(m," ").concat(J(F,"type"))}return S+=". Received type ".concat(e(G)),S},TypeError),Z("ERR_INVALID_ARG_VALUE",function(W,F){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";ie===void 0&&(ie=ao);var m=ie.inspect(F);return m.length>128&&(m="".concat(m.slice(0,128),"...")),"The argument '".concat(W,"' ").concat(G,". Received ").concat(m)},TypeError),Z("ERR_INVALID_RETURN_VALUE",function(W,F,G){var m;return G&&G.constructor&&G.constructor.name?m="instance of ".concat(G.constructor.name):m="type ".concat(e(G)),"Expected ".concat(W,' to be returned from the "').concat(F,'"')+" function but got ".concat(m,".")},TypeError),Z("ERR_MISSING_ARGS",function(){for(var W=arguments.length,F=new Array(W),G=0;G0,"At least one arg needs to be specified");var m="The ",S=F.length;switch(F=F.map(function(w){return'"'.concat(w,'"')}),S){case 1:m+="".concat(F[0]," argument");break;case 2:m+="".concat(F[0]," and ").concat(F[1]," arguments");break;default:m+=F.slice(0,S-1).join(", "),m+=", and ".concat(F[S-1]," arguments");break}return"".concat(m," must be specified")},TypeError),Qc.codes=R,Qc}var el,G0;function pI(){if(G0)return el;G0=1;function e(O,L){var X=Object.keys(O);if(Object.getOwnPropertySymbols){var re=Object.getOwnPropertySymbols(O);L&&(re=re.filter(function(fe){return Object.getOwnPropertyDescriptor(O,fe).enumerable})),X.push.apply(X,re)}return X}function t(O){for(var L=1;L"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ie(O){return Function.toString.call(O).indexOf("[native code]")!==-1}function Z(O,L){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(re,fe){return re.__proto__=fe,re},Z(O,L)}function J(O){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},J(O)}function E(O){"@babel/helpers - typeof";return E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},E(O)}var te=ao,q=te.inspect,W=Ib(),F=W.codes.ERR_INVALID_ARG_TYPE;function G(O,L,X){return(X===void 0||X>O.length)&&(X=O.length),O.substring(X-L.length,X)===L}function m(O,L){if(L=Math.floor(L),O.length==0||L==0)return"";var X=O.length*L;for(L=Math.floor(Math.log(L)/Math.log(2));L;)O+=O,L--;return O+=O.substring(0,X-O.length),O}var S="",w="",k="",_="",b={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},v=10;function T(O){var L=Object.keys(O),X=Object.create(Object.getPrototypeOf(O));return L.forEach(function(re){X[re]=O[re]}),Object.defineProperty(X,"message",{value:O.message}),X}function B(O){return q(O,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function C(O,L,X){var re="",fe="",_e=0,be="",ye=!1,oe=B(O),K=oe.split(` +`),Q=B(L).split(` +`),pe=0,Oe="";if(X==="strictEqual"&&E(O)==="object"&&E(L)==="object"&&O!==null&&L!==null&&(X="strictEqualObject"),K.length===1&&Q.length===1&&K[0]!==Q[0]){var Le=K[0].length+Q[0].length;if(Le<=v){if((E(O)!=="object"||O===null)&&(E(L)!=="object"||L===null)&&(O!==0||L!==0))return"".concat(b[X],` + +`)+"".concat(K[0]," !== ").concat(Q[0],` +`)}else if(X!=="strictEqualObject"){var z=Fe.process.stderr&&Fe.process.stderr.isTTY?Fe.process.stderr.columns:80;if(Le2&&(Oe=` + `.concat(m(" ",pe),"^"),pe=0)}}}for(var V=K[K.length-1],ue=Q[Q.length-1];V===ue&&(pe++<2?be=` + `.concat(V).concat(be):re=V,K.pop(),Q.pop(),!(K.length===0||Q.length===0));)V=K[K.length-1],ue=Q[Q.length-1];var xe=Math.max(K.length,Q.length);if(xe===0){var Te=oe.split(` +`);if(Te.length>30)for(Te[26]="".concat(S,"...").concat(_);Te.length>27;)Te.pop();return"".concat(b.notIdentical,` + +`).concat(Te.join(` +`),` +`)}pe>3&&(be=` +`.concat(S,"...").concat(_).concat(be),ye=!0),re!==""&&(be=` + `.concat(re).concat(be),re="");var Me=0,Ze=b[X]+` +`.concat(w,"+ actual").concat(_," ").concat(k,"- expected").concat(_),Qe=" ".concat(S,"...").concat(_," Lines skipped");for(pe=0;pe1&&pe>2&&(Xe>4?(fe+=` +`.concat(S,"...").concat(_),ye=!0):Xe>3&&(fe+=` + `.concat(Q[pe-2]),Me++),fe+=` + `.concat(Q[pe-1]),Me++),_e=pe,re+=` +`.concat(k,"-").concat(_," ").concat(Q[pe]),Me++;else if(Q.length1&&pe>2&&(Xe>4?(fe+=` +`.concat(S,"...").concat(_),ye=!0):Xe>3&&(fe+=` + `.concat(K[pe-2]),Me++),fe+=` + `.concat(K[pe-1]),Me++),_e=pe,fe+=` +`.concat(w,"+").concat(_," ").concat(K[pe]),Me++;else{var it=Q[pe],et=K[pe],ce=et!==it&&(!G(et,",")||et.slice(0,-1)!==it);ce&&G(it,",")&&it.slice(0,-1)===et&&(ce=!1,et+=","),ce?(Xe>1&&pe>2&&(Xe>4?(fe+=` +`.concat(S,"...").concat(_),ye=!0):Xe>3&&(fe+=` + `.concat(K[pe-2]),Me++),fe+=` + `.concat(K[pe-1]),Me++),_e=pe,fe+=` +`.concat(w,"+").concat(_," ").concat(et),re+=` +`.concat(k,"-").concat(_," ").concat(it),Me+=2):(fe+=re,re="",(Xe===1||pe===0)&&(fe+=` + `.concat(et),Me++))}if(Me>20&&pe30)for(Le[26]="".concat(S,"...").concat(_);Le.length>27;)Le.pop();Le.length===1?_e=X.call(this,"".concat(Oe," ").concat(Le[0])):_e=X.call(this,"".concat(Oe,` + +`).concat(Le.join(` +`),` +`))}else{var z=B(K),V="",ue=b[ye];ye==="notDeepEqual"||ye==="notEqual"?(z="".concat(b[ye],` + +`).concat(z),z.length>1024&&(z="".concat(z.slice(0,1021),"..."))):(V="".concat(B(Q)),z.length>512&&(z="".concat(z.slice(0,509),"...")),V.length>512&&(V="".concat(V.slice(0,509),"...")),ye==="deepEqual"||ye==="equal"?z="".concat(ue,` + +`).concat(z,` + +should equal + +`):V=" ".concat(ye," ").concat(V)),_e=X.call(this,"".concat(z).concat(V))}return Error.stackTraceLimit=pe,_e.generatedMessage=!be,Object.defineProperty(y(_e),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),_e.code="ERR_ASSERTION",_e.actual=K,_e.expected=Q,_e.operator=ye,Error.captureStackTrace&&Error.captureStackTrace(y(_e),oe),_e.stack,_e.name="AssertionError",h(_e)}return a(re,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:L,value:function(_e,be){return q(this,t(t({},be),{},{customInspect:!1,depth:0}))}}]),re}(A(Error),q.custom);return el=x,el}var V0=Object.prototype.toString,Tb=function(t){var r=V0.call(t),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&V0.call(t.callee)==="[object Function]"),i},tl,Z0;function _I(){if(Z0)return tl;Z0=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Tb,s=Object.prototype.propertyIsEnumerable,a=!s.call({toString:null},"toString"),f=s.call(function(){},"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(A){var R=A.constructor;return R&&R.prototype===A},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var A in window)try{if(!l["$"+A]&&t.call(window,A)&&window[A]!==null&&typeof window[A]=="object")try{d(window[A])}catch{return!0}}catch{return!0}return!1}(),y=function(A){if(typeof window>"u"||!h)return d(A);try{return d(A)}catch{return!1}};e=function(R){var D=R!==null&&typeof R=="object",ie=r.call(R)==="[object Function]",Z=i(R),J=D&&r.call(R)==="[object String]",E=[];if(!D&&!ie&&!Z)throw new TypeError("Object.keys called on a non-object");var te=f&&ie;if(J&&R.length>0&&!t.call(R,0))for(var q=0;q0)for(var W=0;W2?arguments[2]:{},A=e(h);t&&(A=i.call(A,Object.getOwnPropertySymbols(h)));for(var R=0;Rce.length)&&(I=ce.length);for(var j=0,we=new Array(I);j10)return!0;for(var I=0;I57)return!0}return ce.length===10&&ce>=Math.pow(2,32)}function x(ce){return Object.keys(ce).filter(C).concat(y(ce).filter(Object.prototype.propertyIsEnumerable.bind(ce)))}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */function O(ce,I){if(ce===I)return 0;for(var j=ce.length,we=I.length,ge=0,Ce=Math.min(j,we);ge1?Q-1:0),Oe=1;Oe1?Q-1:0),Oe=1;Oe1?Q-1:0),Oe=1;Oe1?Q-1:0),Oe=1;Oey?x.c=x.e=null:m.e=10;v/=10,b++);b>y?x.c=x.e=null:(x.e=b,x.c=[m]);return}C=String(m)}else{if(!CI.test(C=String(m)))return i(x,C,T);x.s=C.charCodeAt(0)==45?(C=C.slice(1),-1):1}(b=C.indexOf("."))>-1&&(C=C.replace(".","")),(v=C.search(/e/i))>0?(b<0&&(b=v),b+=+C.slice(v+1),C=C.substring(0,v)):b<0&&(b=C.length)}else{if(Wt(S,2,Z.length,"Base"),S==10&&J)return x=new E(m),F(x,f+x.e+1,c);if(C=String(m),T=typeof m=="number"){if(m*0!=0)return i(x,C,T,S);if(x.s=1/m<0?(C=C.slice(1),-1):1,E.DEBUG&&C.replace(/^0\.0*|\./,"").length>15)throw Error(fp+m)}else x.s=C.charCodeAt(0)===45?(C=C.slice(1),-1):1;for(w=Z.slice(0,S),b=v=0,B=C.length;vb){b=B;continue}}else if(!_&&(C==C.toUpperCase()&&(C=C.toLowerCase())||C==C.toLowerCase()&&(C=C.toUpperCase()))){_=!0,v=-1,b=0;continue}return i(x,String(m),T,S)}T=!1,C=r(C,S,10,x.s),(b=C.indexOf("."))>-1?C=C.replace(".",""):b=C.length}for(v=0;C.charCodeAt(v)===48;v++);for(B=C.length;C.charCodeAt(--B)===48;);if(C=C.slice(v,++B)){if(B-=v,T&&E.DEBUG&&B>15&&(m>dl||m!==nn(m)))throw Error(fp+x.s*m);if((b=b-v-1)>y)x.c=x.e=null;else if(b=-sr&&_<=sr&&_===nn(_)){if(k[0]===0){if(_===0&&k.length===1)return!0;break e}if(S=(_+1)%ut,S<1&&(S+=ut),String(k[0]).length==S){for(S=0;S=yn||w!==nn(w))break e;if(w!==0)return!0}}}else if(k===null&&_===null&&(b===null||b===1||b===-1))return!0;throw Error(Cr+"Invalid BigNumber: "+m)},E.maximum=E.max=function(){return q(arguments,-1)},E.minimum=E.min=function(){return q(arguments,1)},E.random=function(){var m=9007199254740992,S=Math.random()*m&2097151?function(){return nn(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(w){var k,_,b,v,T,B=0,C=[],x=new E(a);if(w==null?w=f:Wt(w,0,sr),v=ll(w/ut),A)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array(v*=2));B>>11),T>=9e15?(_=crypto.getRandomValues(new Uint32Array(2)),k[B]=_[0],k[B+1]=_[1]):(C.push(T%1e14),B+=2);B=v/2}else if(crypto.randomBytes){for(k=crypto.randomBytes(v*=7);B=9e15?crypto.randomBytes(7).copy(k,B):(C.push(T%1e14),B+=7);B=v/7}else throw A=!1,Error(Cr+"crypto unavailable");if(!A)for(;B=10;T/=10,B++);B_-1&&(T[v+1]==null&&(T[v+1]=0),T[v+1]+=T[v]/_|0,T[v]%=_)}return T.reverse()}return function(w,k,_,b,v){var T,B,C,x,O,L,X,re,fe=w.indexOf("."),_e=f,be=c;for(fe>=0&&(x=D,D=0,w=w.replace(".",""),re=new E(k),L=re.pow(w.length-fe),D=x,re.c=S(ni(Qr(L.c),L.e,"0"),10,_,m),re.e=re.c.length),X=S(w,k,_,v?(T=Z,m):(T=m,Z)),C=x=X.length;X[--x]==0;X.pop());if(!X[0])return T.charAt(0);if(fe<0?--C:(L.c=X,L.e=C,L.s=b,L=t(L,re,_e,be,_),X=L.c,O=L.r,C=L.e),B=C+_e+1,fe=X[B],x=_/2,O=O||B<0||X[B+1]!=null,O=be<4?(fe!=null||O)&&(be==0||be==(L.s<0?3:2)):fe>x||fe==x&&(be==4||O||be==6&&X[B-1]&1||be==(L.s<0?8:7)),B<1||!X[0])w=O?ni(T.charAt(1),-_e,T.charAt(0)):T.charAt(0);else{if(X.length=B,O)for(--_;++X[--B]>_;)X[B]=0,B||(++C,X=[1].concat(X));for(x=X.length;!X[--x];);for(fe=0,w="";fe<=x;w+=T.charAt(X[fe++]));w=ni(w,C,T.charAt(0))}return w}}(),t=function(){function m(k,_,b){var v,T,B,C,x=0,O=k.length,L=_%Ai,X=_/Ai|0;for(k=k.slice();O--;)B=k[O]%Ai,C=k[O]/Ai|0,v=X*B+C*L,T=L*B+v%Ai*Ai+x,x=(T/b|0)+(v/Ai|0)+X*C,k[O]=T%b;return x&&(k=[x].concat(k)),k}function S(k,_,b,v){var T,B;if(b!=v)B=b>v?1:-1;else for(T=B=0;T_[T]?1:-1;break}return B}function w(k,_,b,v){for(var T=0;b--;)k[b]-=T,T=k[b]<_[b]?1:0,k[b]=T*v+k[b]-_[b];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,_,b,v,T){var B,C,x,O,L,X,re,fe,_e,be,ye,oe,K,Q,pe,Oe,Le,z=k.s==_.s?1:-1,V=k.c,ue=_.c;if(!V||!V[0]||!ue||!ue[0])return new E(!k.s||!_.s||(V?ue&&V[0]==ue[0]:!ue)?NaN:V&&V[0]==0||!ue?z*0:z/0);for(fe=new E(z),_e=fe.c=[],C=k.e-_.e,z=b+C+1,T||(T=yn,C=on(k.e/ut)-on(_.e/ut),z=z/ut|0),x=0;ue[x]==(V[x]||0);x++);if(ue[x]>(V[x]||0)&&C--,z<0)_e.push(1),O=!0;else{for(Q=V.length,Oe=ue.length,x=0,z+=2,L=nn(T/(ue[0]+1)),L>1&&(ue=m(ue,L,T),V=m(V,L,T),Oe=ue.length,Q=V.length),K=Oe,be=V.slice(0,Oe),ye=be.length;ye=T/2&&pe++;do{if(L=0,B=S(ue,be,Oe,ye),B<0){if(oe=be[0],Oe!=ye&&(oe=oe*T+(be[1]||0)),L=nn(oe/pe),L>1)for(L>=T&&(L=T-1),X=m(ue,L,T),re=X.length,ye=be.length;S(X,be,re,ye)==1;)L--,w(X,Oe=10;z/=10,x++);F(fe,b+(fe.e=x+C*ut-1)+1,v,O)}else fe.e=C,fe.r=+O;return fe}}();function te(m,S,w,k){var _,b,v,T,B;if(w==null?w=c:Wt(w,0,8),!m.c)return m.toString();if(_=m.c[0],v=m.e,S==null)B=Qr(m.c),B=k==1||k==2&&(v<=d||v>=l)?vu(B,v):ni(B,v,"0");else if(m=F(new E(m),S,w),b=m.e,B=Qr(m.c),T=B.length,k==1||k==2&&(S<=b||b<=d)){for(;TT){if(--S>0)for(B+=".";S--;B+="0");}else if(S+=b-T,S>0)for(b+1==T&&(B+=".");S--;B+="0");return m.s<0&&_?"-"+B:B}function q(m,S){for(var w,k,_=1,b=new E(m[0]);_=10;_/=10,k++);return(w=k+w*ut-1)>y?m.c=m.e=null:w=10;T/=10,_++);if(b=S-_,b<0)b+=ut,v=S,B=O[C=0],x=nn(B/L[_-v-1]%10);else if(C=ll((b+1)/ut),C>=O.length)if(k){for(;O.length<=C;O.push(0));B=x=0,_=1,b%=ut,v=b-ut+1}else break e;else{for(B=T=O[C],_=1;T>=10;T/=10,_++);b%=ut,v=b-ut+_,x=v<0?0:nn(B/L[_-v-1]%10)}if(k=k||S<0||O[C+1]!=null||(v<0?B:B%L[_-v-1]),k=w<4?(x||k)&&(w==0||w==(m.s<0?3:2)):x>5||x==5&&(w==4||k||w==6&&(b>0?v>0?B/L[_-v]:0:O[C-1])%10&1||w==(m.s<0?8:7)),S<1||!O[0])return O.length=0,k?(S-=m.e+1,O[0]=L[(ut-S%ut)%ut],m.e=-S||0):O[0]=m.e=0,m;if(b==0?(O.length=C,T=1,C--):(O.length=C+1,T=L[ut-b],O[C]=v>0?nn(B/L[_-v]%L[v])*T:0),k)for(;;)if(C==0){for(b=1,v=O[0];v>=10;v/=10,b++);for(v=O[0]+=T,T=1;v>=10;v/=10,T++);b!=T&&(m.e++,O[0]==yn&&(O[0]=1));break}else{if(O[C]+=T,O[C]!=yn)break;O[C--]=0,T=1}for(b=O.length;O[--b]===0;O.pop());}m.e>y?m.c=m.e=null:m.e=l?vu(S,w):ni(S,w,"0"),m.s<0?"-"+S:S)}return s.absoluteValue=s.abs=function(){var m=new E(this);return m.s<0&&(m.s=1),m},s.comparedTo=function(m,S){return Qi(this,new E(m,S))},s.decimalPlaces=s.dp=function(m,S){var w,k,_,b=this;if(m!=null)return Wt(m,0,sr),S==null?S=c:Wt(S,0,8),F(new E(b),m+b.e+1,S);if(!(w=b.c))return null;if(k=((_=w.length-1)-on(this.e/ut))*ut,_=w[_])for(;_%10==0;_/=10,k--);return k<0&&(k=0),k},s.dividedBy=s.div=function(m,S){return t(this,new E(m,S),f,c)},s.dividedToIntegerBy=s.idiv=function(m,S){return t(this,new E(m,S),0,1)},s.exponentiatedBy=s.pow=function(m,S){var w,k,_,b,v,T,B,C,x,O=this;if(m=new E(m),m.c&&!m.isInteger())throw Error(Cr+"Exponent not an integer: "+G(m));if(S!=null&&(S=new E(S)),T=m.e>14,!O.c||!O.c[0]||O.c[0]==1&&!O.e&&O.c.length==1||!m.c||!m.c[0])return x=new E(Math.pow(+G(O),T?m.s*(2-mu(m)):+G(m))),S?x.mod(S):x;if(B=m.s<0,S){if(S.c?!S.c[0]:!S.s)return new E(NaN);k=!B&&O.isInteger()&&S.isInteger(),k&&(O=O.mod(S))}else{if(m.e>9&&(O.e>0||O.e<-1||(O.e==0?O.c[0]>1||T&&O.c[1]>=24e7:O.c[0]<8e13||T&&O.c[0]<=9999975e7)))return b=O.s<0&&mu(m)?-0:0,O.e>-1&&(b=1/b),new E(B?1/b:b);D&&(b=ll(D/ut+2))}for(T?(w=new E(.5),B&&(m.s=1),C=mu(m)):(_=Math.abs(+G(m)),C=_%2),x=new E(a);;){if(C){if(x=x.times(O),!x.c)break;b?x.c.length>b&&(x.c.length=b):k&&(x=x.mod(S))}if(_){if(_=nn(_/2),_===0)break;C=_%2}else if(m=m.times(w),F(m,m.e+1,1),m.e>14)C=mu(m);else{if(_=+G(m),_===0)break;C=_%2}O=O.times(O),b?O.c&&O.c.length>b&&(O.c.length=b):k&&(O=O.mod(S))}return k?x:(B&&(x=a.div(x)),S?x.mod(S):b?F(x,D,c,v):x)},s.integerValue=function(m){var S=new E(this);return m==null?m=c:Wt(m,0,8),F(S,S.e+1,m)},s.isEqualTo=s.eq=function(m,S){return Qi(this,new E(m,S))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(m,S){return Qi(this,new E(m,S))>0},s.isGreaterThanOrEqualTo=s.gte=function(m,S){return(S=Qi(this,new E(m,S)))===1||S===0},s.isInteger=function(){return!!this.c&&on(this.e/ut)>this.c.length-2},s.isLessThan=s.lt=function(m,S){return Qi(this,new E(m,S))<0},s.isLessThanOrEqualTo=s.lte=function(m,S){return(S=Qi(this,new E(m,S)))===-1||S===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(m,S){var w,k,_,b,v=this,T=v.s;if(m=new E(m,S),S=m.s,!T||!S)return new E(NaN);if(T!=S)return m.s=-S,v.plus(m);var B=v.e/ut,C=m.e/ut,x=v.c,O=m.c;if(!B||!C){if(!x||!O)return x?(m.s=-S,m):new E(O?v:NaN);if(!x[0]||!O[0])return O[0]?(m.s=-S,m):new E(x[0]?v:c==3?-0:0)}if(B=on(B),C=on(C),x=x.slice(),T=B-C){for((b=T<0)?(T=-T,_=x):(C=B,_=O),_.reverse(),S=T;S--;_.push(0));_.reverse()}else for(k=(b=(T=x.length)<(S=O.length))?T:S,T=S=0;S0)for(;S--;x[w++]=0);for(S=yn-1;k>T;){if(x[--k]=0;){for(w=0,L=oe[_]%_e,X=oe[_]/_e|0,v=B,b=_+v;b>_;)C=ye[--v]%_e,x=ye[v]/_e|0,T=X*C+x*L,C=L*C+T%_e*_e+re[b]+w,w=(C/fe|0)+(T/_e|0)+X*x,re[b--]=C%fe;re[b]=w}return w?++k:re.splice(0,1),W(m,re,k)},s.negated=function(){var m=new E(this);return m.s=-m.s||null,m},s.plus=function(m,S){var w,k=this,_=k.s;if(m=new E(m,S),S=m.s,!_||!S)return new E(NaN);if(_!=S)return m.s=-S,k.minus(m);var b=k.e/ut,v=m.e/ut,T=k.c,B=m.c;if(!b||!v){if(!T||!B)return new E(_/0);if(!T[0]||!B[0])return B[0]?m:new E(T[0]?k:_*0)}if(b=on(b),v=on(v),T=T.slice(),_=b-v){for(_>0?(v=b,w=B):(_=-_,w=T),w.reverse();_--;w.push(0));w.reverse()}for(_=T.length,S=B.length,_-S<0&&(w=B,B=T,T=w,S=_),_=0;S;)_=(T[--S]=T[S]+B[S]+_)/yn|0,T[S]=yn===T[S]?0:T[S]%yn;return _&&(T=[_].concat(T),++v),W(m,T,v)},s.precision=s.sd=function(m,S){var w,k,_,b=this;if(m!=null&&m!==!!m)return Wt(m,1,sr),S==null?S=c:Wt(S,0,8),F(new E(b),m,S);if(!(w=b.c))return null;if(_=w.length-1,k=_*ut+1,_=w[_]){for(;_%10==0;_/=10,k--);for(_=w[0];_>=10;_/=10,k++);}return m&&b.e+1>k&&(k=b.e+1),k},s.shiftedBy=function(m){return Wt(m,-dl,dl),this.times("1e"+m)},s.squareRoot=s.sqrt=function(){var m,S,w,k,_,b=this,v=b.c,T=b.s,B=b.e,C=f+4,x=new E("0.5");if(T!==1||!v||!v[0])return new E(!T||T<0&&(!v||v[0])?NaN:v?b:1/0);if(T=Math.sqrt(+G(b)),T==0||T==1/0?(S=Qr(v),(S.length+B)%2==0&&(S+="0"),T=Math.sqrt(+S),B=on((B+1)/2)-(B<0||B%2),T==1/0?S="5e"+B:(S=T.toExponential(),S=S.slice(0,S.indexOf("e")+1)+B),w=new E(S)):w=new E(T+""),w.c[0]){for(B=w.e,T=B+C,T<3&&(T=0);;)if(_=w,w=x.times(_.plus(t(b,_,C,1))),Qr(_.c).slice(0,T)===(S=Qr(w.c)).slice(0,T))if(w.e0&&re>0){for(b=re%T||T,x=X.substr(0,b);b0&&(x+=C+X.slice(b)),L&&(x="-"+x)}k=O?x+(w.decimalSeparator||"")+((B=+w.fractionGroupSize)?O.replace(new RegExp("\\d{"+B+"}\\B","g"),"$&"+(w.fractionGroupSeparator||"")):O):x}return(w.prefix||"")+k+(w.suffix||"")},s.toFraction=function(m){var S,w,k,_,b,v,T,B,C,x,O,L,X=this,re=X.c;if(m!=null&&(T=new E(m),!T.isInteger()&&(T.c||T.s!==1)||T.lt(a)))throw Error(Cr+"Argument "+(T.isInteger()?"out of range: ":"not an integer: ")+G(T));if(!re)return new E(X);for(S=new E(a),C=w=new E(a),k=B=new E(a),L=Qr(re),b=S.e=L.length-X.e-1,S.c[0]=hl[(v=b%ut)<0?ut+v:v],m=!m||T.comparedTo(S)>0?b>0?S:C:T,v=y,y=1/0,T=new E(L),B.c[0]=0;x=t(T,S,0,1),_=w.plus(x.times(k)),_.comparedTo(m)!=1;)w=k,k=_,C=B.plus(x.times(_=C)),B=_,S=T.minus(x.times(_=S)),T=_;return _=t(m.minus(w),k,0,1),B=B.plus(_.times(C)),w=w.plus(_.times(k)),B.s=C.s=X.s,b=b*2,O=t(C,k,b,c).minus(X).abs().comparedTo(t(B,w,b,c).minus(X).abs())<1?[C,k]:[B,w],y=v,O},s.toNumber=function(){return+G(this)},s.toPrecision=function(m,S){return m!=null&&Wt(m,1,sr),te(this,m,S,2)},s.toString=function(m){var S,w=this,k=w.s,_=w.e;return _===null?k?(S="Infinity",k<0&&(S="-"+S)):S="NaN":(m==null?S=_<=d||_>=l?vu(Qr(w.c),_):ni(Qr(w.c),_,"0"):m===10&&J?(w=F(new E(w),f+_+1,c),S=ni(Qr(w.c),w.e,"0")):(Wt(m,2,Z.length,"Base"),S=r(ni(Qr(w.c),_,"0"),10,m,k,!0)),k<0&&w.c[0]&&(S="-"+S)),S},s.valueOf=s.toJSON=function(){return G(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,e!=null&&E.set(e),E}function on(e){var t=e|0;return e>0||e===t?t:t-1}function Qr(e){for(var t,r,i=1,s=e.length,a=e[0]+"";il^r?1:-1;for(c=(d=s.length)<(l=a.length)?d:l,f=0;fa[f]^r?1:-1;return d==l?0:d>l^r?1:-1}function Wt(e,t,r,i){if(er||e!==nn(e))throw Error(Cr+(i||"Argument")+(typeof e=="number"?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function mu(e){var t=e.c.length-1;return on(e.e/ut)==t&&e.c[t]%2!=0}function vu(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ni(e,t,r){var i,s;if(t<0){for(s=r+".";++t;s+=r);e=s+e}else if(i=e.length,++t>i){for(s=r,t-=i;--t;s+=r);e+=s}else tconsole.error("SEMVER",...e):()=>{};var ef=UI;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:s}=Qu,a=ef;t=e.exports={};const f=t.re=[],c=t.safeRe=[],d=t.src=[],l=t.t={};let h=0;const y="[a-zA-Z0-9-]",A=[["\\s",1],["\\d",s],[y,i]],R=ie=>{for(const[Z,J]of A)ie=ie.split(`${Z}*`).join(`${Z}{0,${J}}`).split(`${Z}+`).join(`${Z}{1,${J}}`);return ie},D=(ie,Z,J)=>{const E=R(Z),te=h++;a(ie,te,Z),l[ie]=te,d[te]=Z,f[te]=new RegExp(Z,J?"g":void 0),c[te]=new RegExp(E,J?"g":void 0)};D("NUMERICIDENTIFIER","0|[1-9]\\d*"),D("NUMERICIDENTIFIERLOOSE","\\d+"),D("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y}*`),D("MAINVERSION",`(${d[l.NUMERICIDENTIFIER]})\\.(${d[l.NUMERICIDENTIFIER]})\\.(${d[l.NUMERICIDENTIFIER]})`),D("MAINVERSIONLOOSE",`(${d[l.NUMERICIDENTIFIERLOOSE]})\\.(${d[l.NUMERICIDENTIFIERLOOSE]})\\.(${d[l.NUMERICIDENTIFIERLOOSE]})`),D("PRERELEASEIDENTIFIER",`(?:${d[l.NUMERICIDENTIFIER]}|${d[l.NONNUMERICIDENTIFIER]})`),D("PRERELEASEIDENTIFIERLOOSE",`(?:${d[l.NUMERICIDENTIFIERLOOSE]}|${d[l.NONNUMERICIDENTIFIER]})`),D("PRERELEASE",`(?:-(${d[l.PRERELEASEIDENTIFIER]}(?:\\.${d[l.PRERELEASEIDENTIFIER]})*))`),D("PRERELEASELOOSE",`(?:-?(${d[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[l.PRERELEASEIDENTIFIERLOOSE]})*))`),D("BUILDIDENTIFIER",`${y}+`),D("BUILD",`(?:\\+(${d[l.BUILDIDENTIFIER]}(?:\\.${d[l.BUILDIDENTIFIER]})*))`),D("FULLPLAIN",`v?${d[l.MAINVERSION]}${d[l.PRERELEASE]}?${d[l.BUILD]}?`),D("FULL",`^${d[l.FULLPLAIN]}$`),D("LOOSEPLAIN",`[v=\\s]*${d[l.MAINVERSIONLOOSE]}${d[l.PRERELEASELOOSE]}?${d[l.BUILD]}?`),D("LOOSE",`^${d[l.LOOSEPLAIN]}$`),D("GTLT","((?:<|>)?=?)"),D("XRANGEIDENTIFIERLOOSE",`${d[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),D("XRANGEIDENTIFIER",`${d[l.NUMERICIDENTIFIER]}|x|X|\\*`),D("XRANGEPLAIN",`[v=\\s]*(${d[l.XRANGEIDENTIFIER]})(?:\\.(${d[l.XRANGEIDENTIFIER]})(?:\\.(${d[l.XRANGEIDENTIFIER]})(?:${d[l.PRERELEASE]})?${d[l.BUILD]}?)?)?`),D("XRANGEPLAINLOOSE",`[v=\\s]*(${d[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[l.XRANGEIDENTIFIERLOOSE]})(?:${d[l.PRERELEASELOOSE]})?${d[l.BUILD]}?)?)?`),D("XRANGE",`^${d[l.GTLT]}\\s*${d[l.XRANGEPLAIN]}$`),D("XRANGELOOSE",`^${d[l.GTLT]}\\s*${d[l.XRANGEPLAINLOOSE]}$`),D("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),D("COERCERTL",d[l.COERCE],!0),D("LONETILDE","(?:~>?)"),D("TILDETRIM",`(\\s*)${d[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",D("TILDE",`^${d[l.LONETILDE]}${d[l.XRANGEPLAIN]}$`),D("TILDELOOSE",`^${d[l.LONETILDE]}${d[l.XRANGEPLAINLOOSE]}$`),D("LONECARET","(?:\\^)"),D("CARETTRIM",`(\\s*)${d[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",D("CARET",`^${d[l.LONECARET]}${d[l.XRANGEPLAIN]}$`),D("CARETLOOSE",`^${d[l.LONECARET]}${d[l.XRANGEPLAINLOOSE]}$`),D("COMPARATORLOOSE",`^${d[l.GTLT]}\\s*(${d[l.LOOSEPLAIN]})$|^$`),D("COMPARATOR",`^${d[l.GTLT]}\\s*(${d[l.FULLPLAIN]})$|^$`),D("COMPARATORTRIM",`(\\s*)${d[l.GTLT]}\\s*(${d[l.LOOSEPLAIN]}|${d[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",D("HYPHENRANGE",`^\\s*(${d[l.XRANGEPLAIN]})\\s+-\\s+(${d[l.XRANGEPLAIN]})\\s*$`),D("HYPHENRANGELOOSE",`^\\s*(${d[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[l.XRANGEPLAINLOOSE]})\\s*$`),D("STAR","(<|>)?=?\\s*\\*"),D("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),D("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(dd,dd.exports);var ua=dd.exports;const kI=Object.freeze({loose:!0}),FI=Object.freeze({}),jI=e=>e?typeof e!="object"?kI:e:FI;var qd=jI;const cp=/^[0-9]+$/,Db=(e,t)=>{const r=cp.test(e),i=cp.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:eDb(t,e);var Mb={compareIdentifiers:Db,rcompareIdentifiers:qI};const Eu=ef,{MAX_LENGTH:lp,MAX_SAFE_INTEGER:Su}=Qu,{safeRe:dp,t:hp}=ua,HI=qd,{compareIdentifiers:qo}=Mb;let zI=class Bn{constructor(t,r){if(r=HI(r),t instanceof Bn){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>lp)throw new TypeError(`version is longer than ${lp} characters`);Eu("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?dp[hp.LOOSE]:dp[hp.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>Su||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Su||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Su||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const a=+s;if(a>=0&&a=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(r===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let a=[r,s];i===!1&&(a=[r]),qo(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Ir=zI;const gp=Ir,WI=(e,t,r=!1)=>{if(e instanceof gp)return e;try{return new gp(e,t)}catch(i){if(!r)return null;throw i}};var as=WI;const GI=as,VI=(e,t)=>{const r=GI(e,t);return r?r.version:null};var ZI=VI;const KI=as,JI=(e,t)=>{const r=KI(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var XI=JI;const pp=Ir,YI=(e,t,r,i,s)=>{typeof r=="string"&&(s=i,i=r,r=void 0);try{return new pp(e instanceof pp?e.version:e,r).inc(t,i,s).version}catch{return null}};var QI=YI;const _p=as,e2=(e,t)=>{const r=_p(e,null,!0),i=_p(t,null,!0),s=r.compare(i);if(s===0)return null;const a=s>0,f=a?r:i,c=a?i:r,d=!!f.prerelease.length;if(!!c.prerelease.length&&!d)return!c.patch&&!c.minor?"major":f.patch?"patch":f.minor?"minor":"major";const h=d?"pre":"";return r.major!==i.major?h+"major":r.minor!==i.minor?h+"minor":r.patch!==i.patch?h+"patch":"prerelease"};var t2=e2;const r2=Ir,n2=(e,t)=>new r2(e,t).major;var i2=n2;const o2=Ir,s2=(e,t)=>new o2(e,t).minor;var a2=s2;const u2=Ir,f2=(e,t)=>new u2(e,t).patch;var c2=f2;const l2=as,d2=(e,t)=>{const r=l2(e,t);return r&&r.prerelease.length?r.prerelease:null};var h2=d2;const bp=Ir,g2=(e,t,r)=>new bp(e,r).compare(new bp(t,r));var An=g2;const p2=An,_2=(e,t,r)=>p2(t,e,r);var b2=_2;const y2=An,w2=(e,t)=>y2(e,t,!0);var m2=w2;const yp=Ir,v2=(e,t,r)=>{const i=new yp(e,r),s=new yp(t,r);return i.compare(s)||i.compareBuild(s)};var Hd=v2;const E2=Hd,S2=(e,t)=>e.sort((r,i)=>E2(r,i,t));var R2=S2;const A2=Hd,I2=(e,t)=>e.sort((r,i)=>A2(i,r,t));var T2=I2;const O2=An,N2=(e,t,r)=>O2(e,t,r)>0;var tf=N2;const L2=An,P2=(e,t,r)=>L2(e,t,r)<0;var zd=P2;const C2=An,B2=(e,t,r)=>C2(e,t,r)===0;var Ub=B2;const x2=An,$2=(e,t,r)=>x2(e,t,r)!==0;var kb=$2;const D2=An,M2=(e,t,r)=>D2(e,t,r)>=0;var Wd=M2;const U2=An,k2=(e,t,r)=>U2(e,t,r)<=0;var Gd=k2;const F2=Ub,j2=kb,q2=tf,H2=Wd,z2=zd,W2=Gd,G2=(e,t,r,i)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return F2(e,r,i);case"!=":return j2(e,r,i);case">":return q2(e,r,i);case">=":return H2(e,r,i);case"<":return z2(e,r,i);case"<=":return W2(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};var Fb=G2;const V2=Ir,Z2=as,{safeRe:Ru,t:Au}=ua,K2=(e,t)=>{if(e instanceof V2)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(Ru[Au.COERCE]);else{let i;for(;(i=Ru[Au.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||i.index+i[0].length!==r.index+r[0].length)&&(r=i),Ru[Au.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;Ru[Au.COERCERTL].lastIndex=-1}return r===null?null:Z2(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};var J2=K2,gl,wp;function X2(){return wp||(wp=1,gl=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),gl}var Y2=At;At.Node=uo;At.create=At;function At(e){var t=this;if(t instanceof At||(t=new At),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(s){t.push(s)});else if(arguments.length>0)for(var r=0,i=arguments.length;r1)r=t;else if(this.head)i=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;i!==null;s++)r=e(r,i.value,s),i=i.next;return r};At.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else if(this.tail)i=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;i!==null;s--)r=e(r,i.value,s),i=i.prev;return r};At.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};At.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};At.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new At;if(tthis.length&&(t=this.length);for(var i=0,s=this.head;s!==null&&ithis.length&&(t=this.length);for(var i=this.length,s=this.tail;s!==null&&i>t;i--)s=s.prev;for(;s!==null&&i>e;i--,s=s.prev)r.push(s.value);return r};At.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,s=this.head;s!==null&&i1;class nT{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");this[no]=t.max||1/0;const r=t.length||pl;if(this[Ho]=typeof r!="function"?pl:r,this[Ks]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[io]=t.maxAge||0,this[ii]=t.dispose,this[mp]=t.noDisposeOnSet||!1,this[jb]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[no]=t||1/0,Ds(this)}get max(){return this[no]}set allowStale(t){this[Ks]=!!t}get allowStale(){return this[Ks]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[io]=t,Ds(this)}get maxAge(){return this[io]}set lengthCalculator(t){typeof t!="function"&&(t=pl),t!==this[Ho]&&(this[Ho]=t,this[ai]=0,this[ar].forEach(r=>{r.length=this[Ho](r.value,r.key),this[ai]+=r.length})),Ds(this)}get lengthCalculator(){return this[Ho]}get length(){return this[ai]}get itemCount(){return this[ar].length}rforEach(t,r){r=r||this;for(let i=this[ar].tail;i!==null;){const s=i.prev;vp(this,t,i,r),i=s}}forEach(t,r){r=r||this;for(let i=this[ar].head;i!==null;){const s=i.next;vp(this,t,i,r),i=s}}keys(){return this[ar].toArray().map(t=>t.key)}values(){return this[ar].toArray().map(t=>t.value)}reset(){this[ii]&&this[ar]&&this[ar].length&&this[ar].forEach(t=>this[ii](t.key,t.value)),this[vn]=new Map,this[ar]=new rT,this[ai]=0}dump(){return this[ar].map(t=>ku(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[ar]}set(t,r,i){if(i=i||this[io],i&&typeof i!="number")throw new TypeError("maxAge must be a number");const s=i?Date.now():0,a=this[Ho](r,t);if(this[vn].has(t)){if(a>this[no])return Vo(this,this[vn].get(t)),!1;const d=this[vn].get(t).value;return this[ii]&&(this[mp]||this[ii](t,d.value)),d.now=s,d.maxAge=i,d.value=r,this[ai]+=a-d.length,d.length=a,this.get(t),Ds(this),!0}const f=new iT(t,r,a,s,i);return f.length>this[no]?(this[ii]&&this[ii](t,r),!1):(this[ai]+=f.length,this[ar].unshift(f),this[vn].set(t,this[ar].head),Ds(this),!0)}has(t){if(!this[vn].has(t))return!1;const r=this[vn].get(t).value;return!ku(this,r)}get(t){return _l(this,t,!0)}peek(t){return _l(this,t,!1)}pop(){const t=this[ar].tail;return t?(Vo(this,t),t.value):null}del(t){Vo(this,this[vn].get(t))}load(t){this.reset();const r=Date.now();for(let i=t.length-1;i>=0;i--){const s=t[i],a=s.e||0;if(a===0)this.set(s.k,s.v);else{const f=a-r;f>0&&this.set(s.k,s.v,f)}}}prune(){this[vn].forEach((t,r)=>_l(this,r,!1))}}const _l=(e,t,r)=>{const i=e[vn].get(t);if(i){const s=i.value;if(ku(e,s)){if(Vo(e,i),!e[Ks])return}else r&&(e[jb]&&(i.value.now=Date.now()),e[ar].unshiftNode(i));return s.value}},ku=(e,t)=>{if(!t||!t.maxAge&&!e[io])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[io]&&r>e[io]},Ds=e=>{if(e[ai]>e[no])for(let t=e[ar].tail;e[ai]>e[no]&&t!==null;){const r=t.prev;Vo(e,t),t=r}},Vo=(e,t)=>{if(t){const r=t.value;e[ii]&&e[ii](r.key,r.value),e[ai]-=r.length,e[vn].delete(r.key),e[ar].removeNode(t)}};class iT{constructor(t,r,i,s,a){this.key=t,this.value=r,this.length=i,this.now=s,this.maxAge=a||0}}const vp=(e,t,r,i)=>{let s=r.value;ku(e,s)&&(Vo(e,r),e[Ks]||(s=void 0)),s&&t.call(i,s.value,s.key,e)};var oT=nT,bl,Ep;function In(){if(Ep)return bl;Ep=1;class e{constructor(v,T){if(T=i(T),v instanceof e)return v.loose===!!T.loose&&v.includePrerelease===!!T.includePrerelease?v:new e(v.raw,T);if(v instanceof s)return this.raw=v.value,this.set=[[v]],this.format(),this;if(this.options=T,this.loose=!!T.loose,this.includePrerelease=!!T.includePrerelease,this.raw=v.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(B=>this.parseRange(B.trim())).filter(B=>B.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const B=this.set[0];if(this.set=this.set.filter(C=>!D(C[0])),this.set.length===0)this.set=[B];else if(this.set.length>1){for(const C of this.set)if(C.length===1&&ie(C[0])){this.set=[C];break}}}this.format()}format(){return this.range=this.set.map(v=>v.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(v){const B=((this.options.includePrerelease&&A)|(this.options.loose&&R))+":"+v,C=r.get(B);if(C)return C;const x=this.options.loose,O=x?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];v=v.replace(O,k(this.options.includePrerelease)),a("hyphen replace",v),v=v.replace(c[d.COMPARATORTRIM],l),a("comparator trim",v),v=v.replace(c[d.TILDETRIM],h),a("tilde trim",v),v=v.replace(c[d.CARETTRIM],y),a("caret trim",v);let L=v.split(" ").map(_e=>J(_e,this.options)).join(" ").split(/\s+/).map(_e=>w(_e,this.options));x&&(L=L.filter(_e=>(a("loose invalid filter",_e,this.options),!!_e.match(c[d.COMPARATORLOOSE])))),a("range list",L);const X=new Map,re=L.map(_e=>new s(_e,this.options));for(const _e of re){if(D(_e))return[_e];X.set(_e.value,_e)}X.size>1&&X.has("")&&X.delete("");const fe=[...X.values()];return r.set(B,fe),fe}intersects(v,T){if(!(v instanceof e))throw new TypeError("a Range is required");return this.set.some(B=>Z(B,T)&&v.set.some(C=>Z(C,T)&&B.every(x=>C.every(O=>x.intersects(O,T)))))}test(v){if(!v)return!1;if(typeof v=="string")try{v=new f(v,this.options)}catch{return!1}for(let T=0;Tb.value==="<0.0.0-0",ie=b=>b.value==="",Z=(b,v)=>{let T=!0;const B=b.slice();let C=B.pop();for(;T&&B.length;)T=B.every(x=>C.intersects(x,v)),C=B.pop();return T},J=(b,v)=>(a("comp",b,v),b=W(b,v),a("caret",b),b=te(b,v),a("tildes",b),b=G(b,v),a("xrange",b),b=S(b,v),a("stars",b),b),E=b=>!b||b.toLowerCase()==="x"||b==="*",te=(b,v)=>b.trim().split(/\s+/).map(T=>q(T,v)).join(" "),q=(b,v)=>{const T=v.loose?c[d.TILDELOOSE]:c[d.TILDE];return b.replace(T,(B,C,x,O,L)=>{a("tilde",b,B,C,x,O,L);let X;return E(C)?X="":E(x)?X=`>=${C}.0.0 <${+C+1}.0.0-0`:E(O)?X=`>=${C}.${x}.0 <${C}.${+x+1}.0-0`:L?(a("replaceTilde pr",L),X=`>=${C}.${x}.${O}-${L} <${C}.${+x+1}.0-0`):X=`>=${C}.${x}.${O} <${C}.${+x+1}.0-0`,a("tilde return",X),X})},W=(b,v)=>b.trim().split(/\s+/).map(T=>F(T,v)).join(" "),F=(b,v)=>{a("caret",b,v);const T=v.loose?c[d.CARETLOOSE]:c[d.CARET],B=v.includePrerelease?"-0":"";return b.replace(T,(C,x,O,L,X)=>{a("caret",b,C,x,O,L,X);let re;return E(x)?re="":E(O)?re=`>=${x}.0.0${B} <${+x+1}.0.0-0`:E(L)?x==="0"?re=`>=${x}.${O}.0${B} <${x}.${+O+1}.0-0`:re=`>=${x}.${O}.0${B} <${+x+1}.0.0-0`:X?(a("replaceCaret pr",X),x==="0"?O==="0"?re=`>=${x}.${O}.${L}-${X} <${x}.${O}.${+L+1}-0`:re=`>=${x}.${O}.${L}-${X} <${x}.${+O+1}.0-0`:re=`>=${x}.${O}.${L}-${X} <${+x+1}.0.0-0`):(a("no pr"),x==="0"?O==="0"?re=`>=${x}.${O}.${L}${B} <${x}.${O}.${+L+1}-0`:re=`>=${x}.${O}.${L}${B} <${x}.${+O+1}.0-0`:re=`>=${x}.${O}.${L} <${+x+1}.0.0-0`),a("caret return",re),re})},G=(b,v)=>(a("replaceXRanges",b,v),b.split(/\s+/).map(T=>m(T,v)).join(" ")),m=(b,v)=>{b=b.trim();const T=v.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return b.replace(T,(B,C,x,O,L,X)=>{a("xRange",b,B,C,x,O,L,X);const re=E(x),fe=re||E(O),_e=fe||E(L),be=_e;return C==="="&&be&&(C=""),X=v.includePrerelease?"-0":"",re?C===">"||C==="<"?B="<0.0.0-0":B="*":C&&be?(fe&&(O=0),L=0,C===">"?(C=">=",fe?(x=+x+1,O=0,L=0):(O=+O+1,L=0)):C==="<="&&(C="<",fe?x=+x+1:O=+O+1),C==="<"&&(X="-0"),B=`${C+x}.${O}.${L}${X}`):fe?B=`>=${x}.0.0${X} <${+x+1}.0.0-0`:_e&&(B=`>=${x}.${O}.0${X} <${x}.${+O+1}.0-0`),a("xRange return",B),B})},S=(b,v)=>(a("replaceStars",b,v),b.trim().replace(c[d.STAR],"")),w=(b,v)=>(a("replaceGTE0",b,v),b.trim().replace(c[v.includePrerelease?d.GTE0PRE:d.GTE0],"")),k=b=>(v,T,B,C,x,O,L,X,re,fe,_e,be,ye)=>(E(B)?T="":E(C)?T=`>=${B}.0.0${b?"-0":""}`:E(x)?T=`>=${B}.${C}.0${b?"-0":""}`:O?T=`>=${T}`:T=`>=${T}${b?"-0":""}`,E(re)?X="":E(fe)?X=`<${+re+1}.0.0-0`:E(_e)?X=`<${re}.${+fe+1}.0-0`:be?X=`<=${re}.${fe}.${_e}-${be}`:b?X=`<${re}.${fe}.${+_e+1}-0`:X=`<=${X}`,`${T} ${X}`.trim()),_=(b,v,T)=>{for(let B=0;B0){const C=b[B].semver;if(C.major===v.major&&C.minor===v.minor&&C.patch===v.patch)return!0}return!1}return!0};return bl}var yl,Sp;function rf(){if(Sp)return yl;Sp=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(h,y){if(y=r(y),h instanceof t){if(h.loose===!!y.loose)return h;h=h.value}h=h.trim().split(/\s+/).join(" "),f("comparator",h,y),this.options=y,this.loose=!!y.loose,this.parse(h),this.semver===e?this.value="":this.value=this.operator+this.semver.version,f("comp",this)}parse(h){const y=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],A=h.match(y);if(!A)throw new TypeError(`Invalid comparator: ${h}`);this.operator=A[1]!==void 0?A[1]:"",this.operator==="="&&(this.operator=""),A[2]?this.semver=new c(A[2],this.options.loose):this.semver=e}toString(){return this.value}test(h){if(f("Comparator.test",h,this.options.loose),this.semver===e||h===e)return!0;if(typeof h=="string")try{h=new c(h,this.options)}catch{return!1}return a(h,this.operator,this.semver,this.options)}intersects(h,y){if(!(h instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(h.value,y).test(this.value):h.operator===""?h.value===""?!0:new d(this.value,y).test(h.semver):(y=r(y),y.includePrerelease&&(this.value==="<0.0.0-0"||h.value==="<0.0.0-0")||!y.includePrerelease&&(this.value.startsWith("<0.0.0")||h.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&h.operator.startsWith(">")||this.operator.startsWith("<")&&h.operator.startsWith("<")||this.semver.version===h.semver.version&&this.operator.includes("=")&&h.operator.includes("=")||a(this.semver,"<",h.semver,y)&&this.operator.startsWith(">")&&h.operator.startsWith("<")||a(this.semver,">",h.semver,y)&&this.operator.startsWith("<")&&h.operator.startsWith(">")))}}yl=t;const r=qd,{safeRe:i,t:s}=ua,a=Fb,f=ef,c=Ir,d=In();return yl}const sT=In(),aT=(e,t,r)=>{try{t=new sT(t,r)}catch{return!1}return t.test(e)};var nf=aT;const uT=In(),fT=(e,t)=>new uT(e,t).set.map(r=>r.map(i=>i.value).join(" ").trim().split(" "));var cT=fT;const lT=Ir,dT=In(),hT=(e,t,r)=>{let i=null,s=null,a=null;try{a=new dT(t,r)}catch{return null}return e.forEach(f=>{a.test(f)&&(!i||s.compare(f)===-1)&&(i=f,s=new lT(i,r))}),i};var gT=hT;const pT=Ir,_T=In(),bT=(e,t,r)=>{let i=null,s=null,a=null;try{a=new _T(t,r)}catch{return null}return e.forEach(f=>{a.test(f)&&(!i||s.compare(f)===1)&&(i=f,s=new pT(i,r))}),i};var yT=bT;const wl=Ir,wT=In(),Rp=tf,mT=(e,t)=>{e=new wT(e,t);let r=new wl("0.0.0");if(e.test(r)||(r=new wl("0.0.0-0"),e.test(r)))return r;r=null;for(let i=0;i{const c=new wl(f.semver.version);switch(f.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!a||Rp(c,a))&&(a=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${f.operator}`)}}),a&&(!r||Rp(r,a))&&(r=a)}return r&&e.test(r)?r:null};var vT=mT;const ET=In(),ST=(e,t)=>{try{return new ET(e,t).range||"*"}catch{return null}};var RT=ST;const AT=Ir,qb=rf(),{ANY:IT}=qb,TT=In(),OT=nf,Ap=tf,Ip=zd,NT=Gd,LT=Wd,PT=(e,t,r,i)=>{e=new AT(e,i),t=new TT(t,i);let s,a,f,c,d;switch(r){case">":s=Ap,a=NT,f=Ip,c=">",d=">=";break;case"<":s=Ip,a=LT,f=Ap,c="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(OT(e,t,i))return!1;for(let l=0;l{R.semver===IT&&(R=new qb(">=0.0.0")),y=y||R,A=A||R,s(R.semver,y.semver,i)?y=R:f(R.semver,A.semver,i)&&(A=R)}),y.operator===c||y.operator===d||(!A.operator||A.operator===c)&&a(e,A.semver))return!1;if(A.operator===d&&f(e,A.semver))return!1}return!0};var Vd=PT;const CT=Vd,BT=(e,t,r)=>CT(e,t,">",r);var xT=BT;const $T=Vd,DT=(e,t,r)=>$T(e,t,"<",r);var MT=DT;const Tp=In(),UT=(e,t,r)=>(e=new Tp(e,r),t=new Tp(t,r),e.intersects(t,r));var kT=UT;const FT=nf,jT=An;var qT=(e,t,r)=>{const i=[];let s=null,a=null;const f=e.sort((h,y)=>jT(h,y,r));for(const h of f)FT(h,t,r)?(a=h,s||(s=h)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const c=[];for(const[h,y]of i)h===y?c.push(h):!y&&h===f[0]?c.push("*"):y?h===f[0]?c.push(`<=${y}`):c.push(`${h} - ${y}`):c.push(`>=${h}`);const d=c.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return d.length{if(e===t)return!0;e=new Op(e,r),t=new Op(t,r);let i=!1;e:for(const s of e.set){for(const a of t.set){const f=WT(s,a,r);if(i=i||f!==null,f)continue e}if(i)return!1}return!0},zT=[new Zd(">=0.0.0-0")],Np=[new Zd(">=0.0.0")],WT=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===ml){if(t.length===1&&t[0].semver===ml)return!0;r.includePrerelease?e=zT:e=Np}if(t.length===1&&t[0].semver===ml){if(r.includePrerelease)return!0;t=Np}const i=new Set;let s,a;for(const R of e)R.operator===">"||R.operator===">="?s=Lp(s,R,r):R.operator==="<"||R.operator==="<="?a=Pp(a,R,r):i.add(R.semver);if(i.size>1)return null;let f;if(s&&a){if(f=Kd(s.semver,a.semver,r),f>0)return null;if(f===0&&(s.operator!==">="||a.operator!=="<="))return null}for(const R of i){if(s&&!Ms(R,String(s),r)||a&&!Ms(R,String(a),r))return null;for(const D of t)if(!Ms(R,String(D),r))return!1;return!0}let c,d,l,h,y=a&&!r.includePrerelease&&a.semver.prerelease.length?a.semver:!1,A=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;y&&y.prerelease.length===1&&a.operator==="<"&&y.prerelease[0]===0&&(y=!1);for(const R of t){if(h=h||R.operator===">"||R.operator===">=",l=l||R.operator==="<"||R.operator==="<=",s){if(A&&R.semver.prerelease&&R.semver.prerelease.length&&R.semver.major===A.major&&R.semver.minor===A.minor&&R.semver.patch===A.patch&&(A=!1),R.operator===">"||R.operator===">="){if(c=Lp(s,R,r),c===R&&c!==s)return!1}else if(s.operator===">="&&!Ms(s.semver,String(R),r))return!1}if(a){if(y&&R.semver.prerelease&&R.semver.prerelease.length&&R.semver.major===y.major&&R.semver.minor===y.minor&&R.semver.patch===y.patch&&(y=!1),R.operator==="<"||R.operator==="<="){if(d=Pp(a,R,r),d===R&&d!==a)return!1}else if(a.operator==="<="&&!Ms(a.semver,String(R),r))return!1}if(!R.operator&&(a||s)&&f!==0)return!1}return!(s&&l&&!a&&f!==0||a&&h&&!s&&f!==0||A||y)},Lp=(e,t,r)=>{if(!e)return t;const i=Kd(e.semver,t.semver,r);return i>0?e:i<0||t.operator===">"&&e.operator===">="?t:e},Pp=(e,t,r)=>{if(!e)return t;const i=Kd(e.semver,t.semver,r);return i<0?e:i>0||t.operator==="<"&&e.operator==="<="?t:e};var GT=HT;const vl=ua,Cp=Qu,VT=Ir,Bp=Mb,ZT=as,KT=ZI,JT=XI,XT=QI,YT=t2,QT=i2,eO=a2,tO=c2,rO=h2,nO=An,iO=b2,oO=m2,sO=Hd,aO=R2,uO=T2,fO=tf,cO=zd,lO=Ub,dO=kb,hO=Wd,gO=Gd,pO=Fb,_O=J2,bO=rf(),yO=In(),wO=nf,mO=cT,vO=gT,EO=yT,SO=vT,RO=RT,AO=Vd,IO=xT,TO=MT,OO=kT,NO=qT,LO=GT;var PO={parse:ZT,valid:KT,clean:JT,inc:XT,diff:YT,major:QT,minor:eO,patch:tO,prerelease:rO,compare:nO,rcompare:iO,compareLoose:oO,compareBuild:sO,sort:aO,rsort:uO,gt:fO,lt:cO,eq:lO,neq:dO,gte:hO,lte:gO,cmp:pO,coerce:_O,Comparator:bO,Range:yO,satisfies:wO,toComparators:mO,maxSatisfying:vO,minSatisfying:EO,minVersion:SO,validRange:RO,outside:AO,gtr:IO,ltr:TO,intersects:OO,simplifyRange:NO,subset:LO,SemVer:VT,re:vl.re,src:vl.src,tokens:vl.t,SEMVER_SPEC_VERSION:Cp.SEMVER_SPEC_VERSION,RELEASE_TYPES:Cp.RELEASE_TYPES,compareIdentifiers:Bp.compareIdentifiers,rcompareIdentifiers:Bp.rcompareIdentifiers};function ea(e){"@babel/helpers - typeof";return ea=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ea(e)}function CO(e,t){if(ea(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(ea(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function BO(e){var t=CO(e,"string");return ea(t)==="symbol"?t:String(t)}function Ye(e,t,r){return t=BO(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xO={exports:{}},El={exports:{}},nr={ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,r){return e.slice(t,r)},Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,r){return e.then(t,r)},PromiseReject(e){return Promise.reject(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,r){return e.slice(t,r)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(e,t,r){return e.set(t,r)},Uint8Array},Hb={exports:{}};(function(e){const t=qn,r=Object.getPrototypeOf(async function(){}).constructor,i=globalThis.Blob||t.Blob,s=typeof i<"u"?function(c){return c instanceof i}:function(c){return!1};class a extends Error{constructor(c){if(!Array.isArray(c))throw new TypeError(`Expected input to be an Array, got ${typeof c}`);let d="";for(let l=0;l{f=l,c=h}),resolve:f,reject:c}},promisify(f){return new Promise((c,d)=>{f((l,...h)=>l?d(l):c(...h))})},debuglog(){return function(){}},format(f,...c){return f.replace(/%([sdifj])/g,function(...[d,l]){const h=c.shift();return l==="f"?h.toFixed(6):l==="j"?JSON.stringify(h):l==="s"&&typeof h=="object"?`${h.constructor!==Object?h.constructor.name:""} {}`.trim():h.toString()})},inspect(f){switch(typeof f){case"string":if(f.includes("'"))if(f.includes('"')){if(!f.includes("`")&&!f.includes("${"))return`\`${f}\``}else return`"${f}"`;return`'${f}'`;case"number":return isNaN(f)?"NaN":Object.is(f,-0)?String(f):f;case"bigint":return`${String(f)}n`;case"boolean":case"undefined":return String(f);case"object":return"{}"}},types:{isAsyncFunction(f){return f instanceof r},isArrayBufferView(f){return ArrayBuffer.isView(f)}},isBlob:s},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(Hb);var di=Hb.exports,Jd={},Us={exports:{}},xp;function Xd(){if(xp)return Us.exports;xp=1;const{AbortController:e,AbortSignal:t}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Us.exports=e,Us.exports.AbortSignal=t,Us.exports.default=e,Us.exports}const{format:$O,inspect:Fu,AggregateError:DO}=di,MO=globalThis.AggregateError||DO,UO=Symbol("kIsNodeError"),kO=["string","function","number","object","Function","Object","boolean","bigint","symbol"],FO=/^([A-Z][a-z0-9]*)+$/,jO="__node_internal_",of={};function so(e,t){if(!e)throw new of.ERR_INTERNAL_ASSERTION(t)}function $p(e){let t="",r=e.length;const i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function qO(e,t,r){if(typeof t=="function")return so(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return so(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:$O(t,...r)}function pr(e,t,r){r||(r=Error);class i extends r{constructor(...a){super(qO(e,t,a))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[UO]=!0,of[e]=i}function Dp(e){const t=jO+e.name;return Object.defineProperty(e,"name",{value:t}),e}function HO(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new MO([t,e],t.message);return r.code=t.code,r}return e||t}let zO=class extends Error{constructor(t="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new of.ERR_INVALID_ARG_TYPE("options","Object",r);super(t,r),this.code="ABORT_ERR",this.name="AbortError"}};pr("ERR_ASSERTION","%s",Error);pr("ERR_INVALID_ARG_TYPE",(e,t,r)=>{so(typeof e=="string","'name' must be a string"),Array.isArray(t)||(t=[t]);let i="The ";e.endsWith(" argument")?i+=`${e} `:i+=`"${e}" ${e.includes(".")?"property":"argument"} `,i+="must be ";const s=[],a=[],f=[];for(const d of t)so(typeof d=="string","All expected entries have to be of type string"),kO.includes(d)?s.push(d.toLowerCase()):FO.test(d)?a.push(d):(so(d!=="object",'The value "object" should be written as "Object"'),f.push(d));if(a.length>0){const d=s.indexOf("object");d!==-1&&(s.splice(s,d,1),a.push("Object"))}if(s.length>0){switch(s.length){case 1:i+=`of type ${s[0]}`;break;case 2:i+=`one of type ${s[0]} or ${s[1]}`;break;default:{const d=s.pop();i+=`one of type ${s.join(", ")}, or ${d}`}}(a.length>0||f.length>0)&&(i+=" or ")}if(a.length>0){switch(a.length){case 1:i+=`an instance of ${a[0]}`;break;case 2:i+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const d=a.pop();i+=`an instance of ${a.join(", ")}, or ${d}`}}f.length>0&&(i+=" or ")}switch(f.length){case 0:break;case 1:f[0].toLowerCase()!==f[0]&&(i+="an "),i+=`${f[0]}`;break;case 2:i+=`one of ${f[0]} or ${f[1]}`;break;default:{const d=f.pop();i+=`one of ${f.join(", ")}, or ${d}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var c;if((c=r.constructor)!==null&&c!==void 0&&c.name)i+=`. Received an instance of ${r.constructor.name}`;else{const d=Fu(r,{depth:-1});i+=`. Received ${d}`}}else{let d=Fu(r,{colors:!1});d.length>25&&(d=`${d.slice(0,25)}...`),i+=`. Received type ${typeof r} (${d})`}return i},TypeError);pr("ERR_INVALID_ARG_VALUE",(e,t,r="is invalid")=>{let i=Fu(t);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${i}`},TypeError);pr("ERR_INVALID_RETURN_VALUE",(e,t,r)=>{var i;const s=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${e} to be returned from the "${t}" function but got ${s}.`},TypeError);pr("ERR_MISSING_ARGS",(...e)=>{so(e.length>0,"At least one arg needs to be specified");let t;const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map(i=>`"${i}"`).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const i=e.pop();t+=`The ${e.join(", ")}, and ${i} arguments`}break}return`${t} must be specified`},TypeError);pr("ERR_OUT_OF_RANGE",(e,t,r)=>{so(t,'Missing "range" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=$p(String(r)):typeof r=="bigint"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=$p(i)),i+="n"):i=Fu(r),`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError);pr("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);pr("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);pr("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);pr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);pr("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);pr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);pr("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);pr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);pr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);pr("ERR_STREAM_WRITE_AFTER_END","write after end",Error);pr("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var xr={AbortError:zO,aggregateTwoErrors:Dp(HO),hideStackFrames:Dp,codes:of};const{ArrayIsArray:Yd,ArrayPrototypeIncludes:zb,ArrayPrototypeJoin:Wb,ArrayPrototypeMap:WO,NumberIsInteger:Qd,NumberIsNaN:GO,NumberMAX_SAFE_INTEGER:VO,NumberMIN_SAFE_INTEGER:ZO,NumberParseInt:KO,ObjectPrototypeHasOwnProperty:JO,RegExpPrototypeExec:Gb,String:XO,StringPrototypeToUpperCase:YO,StringPrototypeTrim:QO}=nr,{hideStackFrames:dn,codes:{ERR_SOCKET_BAD_PORT:eN,ERR_INVALID_ARG_TYPE:Tr,ERR_INVALID_ARG_VALUE:us,ERR_OUT_OF_RANGE:fo,ERR_UNKNOWN_SIGNAL:Mp}}=xr,{normalizeEncoding:tN}=di,{isAsyncFunction:rN,isArrayBufferView:nN}=di.types,Up={};function iN(e){return e===(e|0)}function oN(e){return e===e>>>0}const sN=/^[0-7]+$/,aN="must be a 32-bit unsigned integer or an octal string";function uN(e,t,r){if(typeof e>"u"&&(e=r),typeof e=="string"){if(Gb(sN,e)===null)throw new us(t,e,aN);e=KO(e,8)}return Vb(e,t),e}const fN=dn((e,t,r=ZO,i=VO)=>{if(typeof e!="number")throw new Tr(t,"number",e);if(!Qd(e))throw new fo(t,"an integer",e);if(ei)throw new fo(t,`>= ${r} && <= ${i}`,e)}),cN=dn((e,t,r=-2147483648,i=2147483647)=>{if(typeof e!="number")throw new Tr(t,"number",e);if(!Qd(e))throw new fo(t,"an integer",e);if(ei)throw new fo(t,`>= ${r} && <= ${i}`,e)}),Vb=dn((e,t,r=!1)=>{if(typeof e!="number")throw new Tr(t,"number",e);if(!Qd(e))throw new fo(t,"an integer",e);const i=r?1:0,s=4294967295;if(es)throw new fo(t,`>= ${i} && <= ${s}`,e)});function eh(e,t){if(typeof e!="string")throw new Tr(t,"string",e)}function lN(e,t,r=void 0,i){if(typeof e!="number")throw new Tr(t,"number",e);if(r!=null&&ei||(r!=null||i!=null)&&GO(e))throw new fo(t,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,e)}const dN=dn((e,t,r)=>{if(!zb(r,e)){const s="must be one of: "+Wb(WO(r,a=>typeof a=="string"?`'${a}'`:XO(a)),", ");throw new us(t,e,s)}});function Zb(e,t){if(typeof e!="boolean")throw new Tr(t,"boolean",e)}function Sl(e,t,r){return e==null||!JO(e,t)?r:e[t]}const hN=dn((e,t,r=null)=>{const i=Sl(r,"allowArray",!1),s=Sl(r,"allowFunction",!1);if(!Sl(r,"nullable",!1)&&e===null||!i&&Yd(e)||typeof e!="object"&&(!s||typeof e!="function"))throw new Tr(t,"Object",e)}),gN=dn((e,t)=>{if(e!=null&&typeof e!="object"&&typeof e!="function")throw new Tr(t,"a dictionary",e)}),th=dn((e,t,r=0)=>{if(!Yd(e))throw new Tr(t,"Array",e);if(e.length{if(!nN(e))throw new Tr(t,["Buffer","TypedArray","DataView"],e)});function wN(e,t){const r=tN(t),i=e.length;if(r==="hex"&&i%2!==0)throw new us("encoding",t,`is invalid for data of length ${i}`)}function mN(e,t="Port",r=!0){if(typeof e!="number"&&typeof e!="string"||typeof e=="string"&&QO(e).length===0||+e!==+e>>>0||e>65535||e===0&&!r)throw new eN(t,e,r);return e|0}const vN=dn((e,t)=>{if(e!==void 0&&(e===null||typeof e!="object"||!("aborted"in e)))throw new Tr(t,"AbortSignal",e)}),EN=dn((e,t)=>{if(typeof e!="function")throw new Tr(t,"Function",e)}),SN=dn((e,t)=>{if(typeof e!="function"||rN(e))throw new Tr(t,"Function",e)}),RN=dn((e,t)=>{if(e!==void 0)throw new Tr(t,"undefined",e)});function AN(e,t,r){if(!zb(r,e))throw new Tr(t,`('${Wb(r,"|")}')`,e)}const IN=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function kp(e,t){if(typeof e>"u"||!Gb(IN,e))throw new us(t,e,'must be an array or string of format "; rel=preload; as=style"')}function TN(e){if(typeof e=="string")return kp(e,"hints"),e;if(Yd(e)){const t=e.length;let r="";if(t===0)return r;for(let i=0;i; rel=preload; as=style"')}var sf={isInt32:iN,isUint32:oN,parseFileMode:uN,validateArray:th,validateStringArray:pN,validateBooleanArray:_N,validateBoolean:Zb,validateBuffer:yN,validateDictionary:gN,validateEncoding:wN,validateFunction:EN,validateInt32:cN,validateInteger:fN,validateNumber:lN,validateObject:hN,validateOneOf:dN,validatePlainFunction:SN,validatePort:mN,validateSignalName:bN,validateString:eh,validateUint32:Vb,validateUndefined:RN,validateUnion:AN,validateAbortSignal:vN,validateLinkHeaderValue:TN},rh={exports:{}};const{Symbol:af,SymbolAsyncIterator:Fp,SymbolIterator:jp,SymbolFor:Kb}=nr,Jb=af("kDestroyed"),Xb=af("kIsErrored"),hd=af("kIsReadable"),Yb=af("kIsDisturbed"),ON=Kb("nodejs.webstream.isClosedPromise"),NN=Kb("nodejs.webstream.controllerErrorFunction");function uf(e,t=!1){var r;return!!(e&&typeof e.pipe=="function"&&typeof e.on=="function"&&(!t||typeof e.pause=="function"&&typeof e.resume=="function")&&(!e._writableState||((r=e._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!e._writableState||e._readableState))}function ff(e){var t;return!!(e&&typeof e.write=="function"&&typeof e.on=="function"&&(!e._readableState||((t=e._writableState)===null||t===void 0?void 0:t.writable)!==!1))}function LN(e){return!!(e&&typeof e.pipe=="function"&&e._readableState&&typeof e.on=="function"&&typeof e.write=="function")}function zn(e){return e&&(e._readableState||e._writableState||typeof e.write=="function"&&typeof e.on=="function"||typeof e.pipe=="function"&&typeof e.on=="function")}function Qb(e){return!!(e&&!zn(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"&&typeof e.cancel=="function")}function ey(e){return!!(e&&!zn(e)&&typeof e.getWriter=="function"&&typeof e.abort=="function")}function ty(e){return!!(e&&!zn(e)&&typeof e.readable=="object"&&typeof e.writable=="object")}function PN(e){return Qb(e)||ey(e)||ty(e)}function CN(e,t){return e==null?!1:t===!0?typeof e[Fp]=="function":t===!1?typeof e[jp]=="function":typeof e[Fp]=="function"||typeof e[jp]=="function"}function cf(e){if(!zn(e))return null;const t=e._writableState,r=e._readableState,i=t||r;return!!(e.destroyed||e[Jb]||i!=null&&i.destroyed)}function ry(e){if(!ff(e))return null;if(e.writableEnded===!0)return!0;const t=e._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.ended)!="boolean"?null:t.ended}function BN(e,t){if(!ff(e))return null;if(e.writableFinished===!0)return!0;const r=e._writableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.finished)!="boolean"?null:!!(r.finished||t===!1&&r.ended===!0&&r.length===0)}function xN(e){if(!uf(e))return null;if(e.readableEnded===!0)return!0;const t=e._readableState;return!t||t.errored?!1:typeof(t==null?void 0:t.ended)!="boolean"?null:t.ended}function ny(e,t){if(!uf(e))return null;const r=e._readableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.endEmitted)!="boolean"?null:!!(r.endEmitted||t===!1&&r.ended===!0&&r.length===0)}function iy(e){return e&&e[hd]!=null?e[hd]:typeof(e==null?void 0:e.readable)!="boolean"?null:cf(e)?!1:uf(e)&&e.readable&&!ny(e)}function oy(e){return typeof(e==null?void 0:e.writable)!="boolean"?null:cf(e)?!1:ff(e)&&e.writable&&!ry(e)}function $N(e,t){return zn(e)?cf(e)?!0:!((t==null?void 0:t.readable)!==!1&&iy(e)||(t==null?void 0:t.writable)!==!1&&oy(e)):null}function DN(e){var t,r;return zn(e)?e.writableErrored?e.writableErrored:(t=(r=e._writableState)===null||r===void 0?void 0:r.errored)!==null&&t!==void 0?t:null:null}function MN(e){var t,r;return zn(e)?e.readableErrored?e.readableErrored:(t=(r=e._readableState)===null||r===void 0?void 0:r.errored)!==null&&t!==void 0?t:null:null}function UN(e){if(!zn(e))return null;if(typeof e.closed=="boolean")return e.closed;const t=e._writableState,r=e._readableState;return typeof(t==null?void 0:t.closed)=="boolean"||typeof(r==null?void 0:r.closed)=="boolean"?(t==null?void 0:t.closed)||(r==null?void 0:r.closed):typeof e._closed=="boolean"&&sy(e)?e._closed:null}function sy(e){return typeof e._closed=="boolean"&&typeof e._defaultKeepAlive=="boolean"&&typeof e._removedConnection=="boolean"&&typeof e._removedContLen=="boolean"}function ay(e){return typeof e._sent100=="boolean"&&sy(e)}function kN(e){var t;return typeof e._consuming=="boolean"&&typeof e._dumped=="boolean"&&((t=e.req)===null||t===void 0?void 0:t.upgradeOrConnect)===void 0}function FN(e){if(!zn(e))return null;const t=e._writableState,r=e._readableState,i=t||r;return!i&&ay(e)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function jN(e){var t;return!!(e&&((t=e[Yb])!==null&&t!==void 0?t:e.readableDidRead||e.readableAborted))}function qN(e){var t,r,i,s,a,f,c,d,l,h;return!!(e&&((t=(r=(i=(s=(a=(f=e[Xb])!==null&&f!==void 0?f:e.readableErrored)!==null&&a!==void 0?a:e.writableErrored)!==null&&s!==void 0?s:(c=e._readableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&i!==void 0?i:(d=e._writableState)===null||d===void 0?void 0:d.errorEmitted)!==null&&r!==void 0?r:(l=e._readableState)===null||l===void 0?void 0:l.errored)!==null&&t!==void 0?t:!((h=e._writableState)===null||h===void 0)&&h.errored))}var hi={kDestroyed:Jb,isDisturbed:jN,kIsDisturbed:Yb,isErrored:qN,kIsErrored:Xb,isReadable:iy,kIsReadable:hd,kIsClosedPromise:ON,kControllerErrorFunction:NN,isClosed:UN,isDestroyed:cf,isDuplexNodeStream:LN,isFinished:$N,isIterable:CN,isReadableNodeStream:uf,isReadableStream:Qb,isReadableEnded:xN,isReadableFinished:ny,isReadableErrored:MN,isNodeStream:zn,isWebStream:PN,isWritable:oy,isWritableNodeStream:ff,isWritableStream:ey,isWritableEnded:ry,isWritableFinished:BN,isWritableErrored:DN,isServerRequest:kN,isServerResponse:ay,willEmitClose:FN,isTransformStream:ty};const Oi=go,{AbortError:uy,codes:HN}=xr,{ERR_INVALID_ARG_TYPE:zN,ERR_STREAM_PREMATURE_CLOSE:qp}=HN,{kEmptyObject:gd,once:pd}=di,{validateAbortSignal:WN,validateFunction:GN,validateObject:VN,validateBoolean:ZN}=sf,{Promise:KN,PromisePrototypeThen:JN}=nr,{isClosed:XN,isReadable:Hp,isReadableNodeStream:Rl,isReadableStream:YN,isReadableFinished:zp,isReadableErrored:Wp,isWritable:Gp,isWritableNodeStream:Vp,isWritableStream:QN,isWritableFinished:Zp,isWritableErrored:Kp,isNodeStream:eL,willEmitClose:tL,kIsClosedPromise:rL}=hi;function nL(e){return e.setHeader&&typeof e.abort=="function"}const _d=()=>{};function fy(e,t,r){var i,s;if(arguments.length===2?(r=t,t=gd):t==null?t=gd:VN(t,"options"),GN(r,"callback"),WN(t.signal,"options.signal"),r=pd(r),YN(e)||QN(e))return iL(e,t,r);if(!eL(e))throw new zN("stream",["ReadableStream","WritableStream","Stream"],e);const a=(i=t.readable)!==null&&i!==void 0?i:Rl(e),f=(s=t.writable)!==null&&s!==void 0?s:Vp(e),c=e._writableState,d=e._readableState,l=()=>{e.writable||A()};let h=tL(e)&&Rl(e)===a&&Vp(e)===f,y=Zp(e,!1);const A=()=>{y=!0,e.destroyed&&(h=!1),!(h&&(!e.readable||a))&&(!a||R)&&r.call(e)};let R=zp(e,!1);const D=()=>{R=!0,e.destroyed&&(h=!1),!(h&&(!e.writable||f))&&(!f||y)&&r.call(e)},ie=W=>{r.call(e,W)};let Z=XN(e);const J=()=>{Z=!0;const W=Kp(e)||Wp(e);if(W&&typeof W!="boolean")return r.call(e,W);if(a&&!R&&Rl(e,!0)&&!zp(e,!1))return r.call(e,new qp);if(f&&!y&&!Zp(e,!1))return r.call(e,new qp);r.call(e)},E=()=>{Z=!0;const W=Kp(e)||Wp(e);if(W&&typeof W!="boolean")return r.call(e,W);r.call(e)},te=()=>{e.req.on("finish",A)};nL(e)?(e.on("complete",A),h||e.on("abort",J),e.req?te():e.on("request",te)):f&&!c&&(e.on("end",l),e.on("close",l)),!h&&typeof e.aborted=="boolean"&&e.on("aborted",J),e.on("end",D),e.on("finish",A),t.error!==!1&&e.on("error",ie),e.on("close",J),Z?Oi.nextTick(J):c!=null&&c.errorEmitted||d!=null&&d.errorEmitted?h||Oi.nextTick(E):(!a&&(!h||Hp(e))&&(y||Gp(e)===!1)||!f&&(!h||Gp(e))&&(R||Hp(e)===!1)||d&&e.req&&e.aborted)&&Oi.nextTick(E);const q=()=>{r=_d,e.removeListener("aborted",J),e.removeListener("complete",A),e.removeListener("abort",J),e.removeListener("request",te),e.req&&e.req.removeListener("finish",A),e.removeListener("end",l),e.removeListener("close",l),e.removeListener("finish",A),e.removeListener("end",D),e.removeListener("error",ie),e.removeListener("close",J)};if(t.signal&&!Z){const W=()=>{const F=r;q(),F.call(e,new uy(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)Oi.nextTick(W);else{const F=r;r=pd((...G)=>{t.signal.removeEventListener("abort",W),F.apply(e,G)}),t.signal.addEventListener("abort",W)}}return q}function iL(e,t,r){let i=!1,s=_d;if(t.signal)if(s=()=>{i=!0,r.call(e,new uy(void 0,{cause:t.signal.reason}))},t.signal.aborted)Oi.nextTick(s);else{const f=r;r=pd((...c)=>{t.signal.removeEventListener("abort",s),f.apply(e,c)}),t.signal.addEventListener("abort",s)}const a=(...f)=>{i||Oi.nextTick(()=>r.apply(e,f))};return JN(e[rL].promise,a,a),_d}function oL(e,t){var r;let i=!1;return t===null&&(t=gd),(r=t)!==null&&r!==void 0&&r.cleanup&&(ZN(t.cleanup,"cleanup"),i=t.cleanup),new KN((s,a)=>{const f=fy(e,t,c=>{i&&f(),c?a(c):s()})})}rh.exports=fy;rh.exports.finished=oL;var $i=rh.exports;const Fn=go,{aggregateTwoErrors:sL,codes:{ERR_MULTIPLE_CALLBACK:aL},AbortError:uL}=xr,{Symbol:cy}=nr,{kDestroyed:fL,isDestroyed:cL,isFinished:lL,isServerRequest:dL}=hi,ly=cy("kDestroy"),bd=cy("kConstruct");function dy(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function hL(e,t){const r=this._readableState,i=this._writableState,s=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof t=="function"&&t(),this):(dy(e,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),s.constructed?Jp(this,e,t):this.once(ly,function(a){Jp(this,sL(a,e),t)}),this)}function Jp(e,t,r){let i=!1;function s(a){if(i)return;i=!0;const f=e._readableState,c=e._writableState;dy(a,c,f),c&&(c.closed=!0),f&&(f.closed=!0),typeof r=="function"&&r(a),a?Fn.nextTick(gL,e,a):Fn.nextTick(hy,e)}try{e._destroy(t||null,s)}catch(a){s(a)}}function gL(e,t){yd(e,t),hy(e)}function hy(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(r!=null&&r.emitClose||t!=null&&t.emitClose)&&e.emit("close")}function yd(e,t){const r=e._readableState,i=e._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function pL(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function wd(e,t,r){const i=e._readableState,s=e._writableState;if(s!=null&&s.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||s!=null&&s.autoDestroy?e.destroy(t):t&&(t.stack,s&&!s.errored&&(s.errored=t),i&&!i.errored&&(i.errored=t),r?Fn.nextTick(yd,e,t):yd(e,t))}function _L(e,t){if(typeof e._construct!="function")return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(bd,t),!(e.listenerCount(bd)>1)&&Fn.nextTick(bL,e)}function bL(e){let t=!1;function r(i){if(t){wd(e,i??new aL);return}t=!0;const s=e._readableState,a=e._writableState,f=a||s;s&&(s.constructed=!0),a&&(a.constructed=!0),f.destroyed?e.emit(ly,i):i?wd(e,i,!0):Fn.nextTick(yL,e)}try{e._construct(i=>{Fn.nextTick(r,i)})}catch(i){Fn.nextTick(r,i)}}function yL(e){e.emit(bd)}function Xp(e){return(e==null?void 0:e.setHeader)&&typeof e.abort=="function"}function gy(e){e.emit("close")}function wL(e,t){e.emit("error",t),Fn.nextTick(gy,e)}function mL(e,t){!e||cL(e)||(!t&&!lL(e)&&(t=new uL),dL(e)?(e.socket=null,e.destroy(t)):Xp(e)?e.abort():Xp(e.req)?e.req.abort():typeof e.destroy=="function"?e.destroy(t):typeof e.close=="function"?e.close():t?Fn.nextTick(wL,e,t):Fn.nextTick(gy,e),e.destroyed||(e[fL]=!0))}var fs={construct:_L,destroyer:mL,destroy:hL,undestroy:pL,errorOrDestroy:wd};const{ArrayIsArray:vL,ObjectSetPrototypeOf:py}=nr,{EventEmitter:lf}=aa;function df(e){lf.call(this,e)}py(df.prototype,lf.prototype);py(df,lf);df.prototype.pipe=function(e,t){const r=this;function i(h){e.writable&&e.write(h)===!1&&r.pause&&r.pause()}r.on("data",i);function s(){r.readable&&r.resume&&r.resume()}e.on("drain",s),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",f),r.on("close",c));let a=!1;function f(){a||(a=!0,e.end())}function c(){a||(a=!0,typeof e.destroy=="function"&&e.destroy())}function d(h){l(),lf.listenerCount(this,"error")===0&&this.emit("error",h)}md(r,"error",d),md(e,"error",d);function l(){r.removeListener("data",i),e.removeListener("drain",s),r.removeListener("end",f),r.removeListener("close",c),r.removeListener("error",d),e.removeListener("error",d),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e};function md(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):vL(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}var nh={Stream:df,prependListener:md},_y={exports:{}};(function(e){const{AbortError:t,codes:r}=xr,{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=hi,f=$i,{ERR_INVALID_ARG_TYPE:c}=r,d=(l,h)=>{if(typeof l!="object"||!("aborted"in l))throw new c(h,"AbortSignal",l)};e.exports.addAbortSignal=function(h,y){if(d(h,"signal"),!i(y)&&!s(y))throw new c("stream",["ReadableStream","WritableStream","Stream"],y);return e.exports.addAbortSignalNoValidate(h,y)},e.exports.addAbortSignalNoValidate=function(l,h){if(typeof l!="object"||!("aborted"in l))return h;const y=i(h)?()=>{h.destroy(new t(void 0,{cause:l.reason}))}:()=>{h[a](new t(void 0,{cause:l.reason}))};return l.aborted?y():(l.addEventListener("abort",y),f(h,()=>l.removeEventListener("abort",y))),h}})(_y);var hf=_y.exports;const{StringPrototypeSlice:Yp,SymbolIterator:EL,TypedArrayPrototypeSet:Iu,Uint8Array:SL}=nr,{Buffer:Al}=qn,{inspect:RL}=di;var AL=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){const r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(t){const r={data:t,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;const t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=t+r.data;return i}concat(t){if(this.length===0)return Al.alloc(0);const r=Al.allocUnsafe(t>>>0);let i=this.head,s=0;for(;i;)Iu(r,i.data,s),s+=i.data.length,i=i.next;return r}consume(t,r){const i=this.head.data;if(ta.length)r+=a,t-=a.length;else{t===a.length?(r+=a,++s,i.next?this.head=i.next:this.head=this.tail=null):(r+=Yp(a,0,t),this.head=i,i.data=Yp(a,t));break}++s}while((i=i.next)!==null);return this.length-=s,r}_getBuffer(t){const r=Al.allocUnsafe(t),i=t;let s=this.head,a=0;do{const f=s.data;if(t>f.length)Iu(r,f,i-t),t-=f.length;else{t===f.length?(Iu(r,f,i-t),++a,s.next?this.head=s.next:this.head=this.tail=null):(Iu(r,new SL(f.buffer,f.byteOffset,t),i-t),this.head=s,s.data=f.slice(t));break}++a}while((s=s.next)!==null);return this.length-=a,r}[Symbol.for("nodejs.util.inspect.custom")](t,r){return RL(this,{...r,depth:0,customInspect:!1})}};const{MathFloor:IL,NumberIsInteger:TL}=nr,{ERR_INVALID_ARG_VALUE:OL}=xr.codes;function NL(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function by(e){return e?16:16*1024}function LL(e,t,r,i){const s=NL(t,i,r);if(s!=null){if(!TL(s)||s<0){const a=i?`options.${r}`:"options.highWaterMark";throw new OL(a,s)}return IL(s)}return by(e.objectMode)}var ih={getHighWaterMark:LL,getDefaultHighWaterMark:by};const Qp=go,{PromisePrototypeThen:PL,SymbolAsyncIterator:e_,SymbolIterator:t_}=nr,{Buffer:CL}=qn,{ERR_INVALID_ARG_TYPE:BL,ERR_STREAM_NULL_VALUES:xL}=xr.codes;function $L(e,t,r){let i;if(typeof t=="string"||t instanceof CL)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});let s;if(t&&t[e_])s=!0,i=t[e_]();else if(t&&t[t_])s=!1,i=t[t_]();else throw new BL("iterable",["Iterable"],t);const a=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;a._read=function(){f||(f=!0,d())},a._destroy=function(l,h){PL(c(l),()=>Qp.nextTick(h,l),y=>Qp.nextTick(h,y||l))};async function c(l){const h=l!=null,y=typeof i.throw=="function";if(h&&y){const{value:A,done:R}=await i.throw(l);if(await A,R)return}if(typeof i.return=="function"){const{value:A}=await i.return();await A}}async function d(){for(;;){try{const{value:l,done:h}=s?await i.next():i.next();if(h)a.push(null);else{const y=l&&typeof l.then=="function"?await l:l;if(y===null)throw f=!1,new xL;if(a.push(y))continue;f=!1}}catch(l){a.destroy(l)}break}}return a}var yy=$L,Il,r_;function gf(){if(r_)return Il;r_=1;const e=go,{ArrayPrototypeIndexOf:t,NumberIsInteger:r,NumberIsNaN:i,NumberParseInt:s,ObjectDefineProperties:a,ObjectKeys:f,ObjectSetPrototypeOf:c,Promise:d,SafeSet:l,SymbolAsyncIterator:h,Symbol:y}=nr;Il=L,L.ReadableState=O;const{EventEmitter:A}=aa,{Stream:R,prependListener:D}=nh,{Buffer:ie}=qn,{addAbortSignal:Z}=hf,J=$i;let E=di.debuglog("stream",I=>{E=I});const te=AL,q=fs,{getHighWaterMark:W,getDefaultHighWaterMark:F}=ih,{aggregateTwoErrors:G,codes:{ERR_INVALID_ARG_TYPE:m,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_OUT_OF_RANGE:w,ERR_STREAM_PUSH_AFTER_EOF:k,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:_}}=xr,{validateObject:b}=sf,v=y("kPaused"),{StringDecoder:T}=lI(),B=yy;c(L.prototype,R.prototype),c(L,R);const C=()=>{},{errorOrDestroy:x}=q;function O(I,j,we){typeof we!="boolean"&&(we=j instanceof fi()),this.objectMode=!!(I&&I.objectMode),we&&(this.objectMode=this.objectMode||!!(I&&I.readableObjectMode)),this.highWaterMark=I?W(this,I,"readableHighWaterMark",we):F(!1),this.buffer=new te,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[v]=null,this.errorEmitted=!1,this.emitClose=!I||I.emitClose!==!1,this.autoDestroy=!I||I.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=I&&I.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,I&&I.encoding&&(this.decoder=new T(I.encoding),this.encoding=I.encoding)}function L(I){if(!(this instanceof L))return new L(I);const j=this instanceof fi();this._readableState=new O(I,this,j),I&&(typeof I.read=="function"&&(this._read=I.read),typeof I.destroy=="function"&&(this._destroy=I.destroy),typeof I.construct=="function"&&(this._construct=I.construct),I.signal&&!j&&Z(I.signal,this)),R.call(this,I),q.construct(this,()=>{this._readableState.needReadable&&Q(this,this._readableState)})}L.prototype.destroy=q.destroy,L.prototype._undestroy=q.undestroy,L.prototype._destroy=function(I,j){j(I)},L.prototype[A.captureRejectionSymbol]=function(I){this.destroy(I)},L.prototype.push=function(I,j){return X(this,I,j,!1)},L.prototype.unshift=function(I,j){return X(this,I,j,!0)};function X(I,j,we,ge){E("readableAddChunk",j);const Ce=I._readableState;let je;if(Ce.objectMode||(typeof j=="string"?(we=we||Ce.defaultEncoding,Ce.encoding!==we&&(ge&&Ce.encoding?j=ie.from(j,we).toString(Ce.encoding):(j=ie.from(j,we),we=""))):j instanceof ie?we="":R._isUint8Array(j)?(j=R._uint8ArrayToBuffer(j),we=""):j!=null&&(je=new m("chunk",["string","Buffer","Uint8Array"],j))),je)x(I,je);else if(j===null)Ce.reading=!1,ye(I,Ce);else if(Ce.objectMode||j&&j.length>0)if(ge)if(Ce.endEmitted)x(I,new _);else{if(Ce.destroyed||Ce.errored)return!1;re(I,Ce,j,!0)}else if(Ce.ended)x(I,new k);else{if(Ce.destroyed||Ce.errored)return!1;Ce.reading=!1,Ce.decoder&&!we?(j=Ce.decoder.write(j),Ce.objectMode||j.length!==0?re(I,Ce,j,!1):Q(I,Ce)):re(I,Ce,j,!1)}else ge||(Ce.reading=!1,Q(I,Ce));return!Ce.ended&&(Ce.length0?(j.multiAwaitDrain?j.awaitDrainWriters.clear():j.awaitDrainWriters=null,j.dataEmitted=!0,I.emit("data",we)):(j.length+=j.objectMode?1:we.length,ge?j.buffer.unshift(we):j.buffer.push(we),j.needReadable&&oe(I)),Q(I,j)}L.prototype.isPaused=function(){const I=this._readableState;return I[v]===!0||I.flowing===!1},L.prototype.setEncoding=function(I){const j=new T(I);this._readableState.decoder=j,this._readableState.encoding=this._readableState.decoder.encoding;const we=this._readableState.buffer;let ge="";for(const Ce of we)ge+=j.write(Ce);return we.clear(),ge!==""&&we.push(ge),this._readableState.length=ge.length,this};const fe=1073741824;function _e(I){if(I>fe)throw new w("size","<= 1GiB",I);return I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++,I}function be(I,j){return I<=0||j.length===0&&j.ended?0:j.objectMode?1:i(I)?j.flowing&&j.length?j.buffer.first().length:j.length:I<=j.length?I:j.ended?j.length:0}L.prototype.read=function(I){E("read",I),I===void 0?I=NaN:r(I)||(I=s(I,10));const j=this._readableState,we=I;if(I>j.highWaterMark&&(j.highWaterMark=_e(I)),I!==0&&(j.emittedReadable=!1),I===0&&j.needReadable&&((j.highWaterMark!==0?j.length>=j.highWaterMark:j.length>0)||j.ended))return E("read: emitReadable",j.length,j.ended),j.length===0&&j.ended?Qe(this):oe(this),null;if(I=be(I,j),I===0&&j.ended)return j.length===0&&Qe(this),null;let ge=j.needReadable;if(E("need readable",ge),(j.length===0||j.length-I0?Ce=Ze(I,j):Ce=null,Ce===null?(j.needReadable=j.length<=j.highWaterMark,I=0):(j.length-=I,j.multiAwaitDrain?j.awaitDrainWriters.clear():j.awaitDrainWriters=null),j.length===0&&(j.ended||(j.needReadable=!0),we!==I&&j.ended&&Qe(this)),Ce!==null&&!j.errorEmitted&&!j.closeEmitted&&(j.dataEmitted=!0,this.emit("data",Ce)),Ce};function ye(I,j){if(E("onEofChunk"),!j.ended){if(j.decoder){const we=j.decoder.end();we&&we.length&&(j.buffer.push(we),j.length+=j.objectMode?1:we.length)}j.ended=!0,j.sync?oe(I):(j.needReadable=!1,j.emittedReadable=!0,K(I))}}function oe(I){const j=I._readableState;E("emitReadable",j.needReadable,j.emittedReadable),j.needReadable=!1,j.emittedReadable||(E("emitReadable",j.flowing),j.emittedReadable=!0,e.nextTick(K,I))}function K(I){const j=I._readableState;E("emitReadable_",j.destroyed,j.length,j.ended),!j.destroyed&&!j.errored&&(j.length||j.ended)&&(I.emit("readable"),j.emittedReadable=!1),j.needReadable=!j.flowing&&!j.ended&&j.length<=j.highWaterMark,xe(I)}function Q(I,j){!j.readingMore&&j.constructed&&(j.readingMore=!0,e.nextTick(pe,I,j))}function pe(I,j){for(;!j.reading&&!j.ended&&(j.length1&&ge.pipes.includes(I)&&(E("false write response, pause",ge.awaitDrainWriters.size),ge.awaitDrainWriters.add(I)),we.pause()),Ne||(Ne=Oe(we,I),I.on("drain",Ne))}we.on("data",P);function P(Ee){E("ondata");const M=I.write(Ee);E("dest.write",M),M===!1&&Re()}function Be(Ee){if(E("onerror",Ee),me(),I.removeListener("error",Be),I.listenerCount("error")===0){const M=I._writableState||I._readableState;M&&!M.errorEmitted?x(I,Ee):I.emit("error",Ee)}}D(I,"error",Be);function We(){I.removeListener("finish",g),me()}I.once("close",We);function g(){E("onfinish"),I.removeListener("close",We),me()}I.once("finish",g);function me(){E("unpipe"),we.unpipe(I)}return I.emit("pipe",we),I.writableNeedDrain===!0?ge.flowing&&Re():ge.flowing||(E("pipe resume"),we.resume()),I};function Oe(I,j){return function(){const ge=I._readableState;ge.awaitDrainWriters===j?(E("pipeOnDrain",1),ge.awaitDrainWriters=null):ge.multiAwaitDrain&&(E("pipeOnDrain",ge.awaitDrainWriters.size),ge.awaitDrainWriters.delete(j)),(!ge.awaitDrainWriters||ge.awaitDrainWriters.size===0)&&I.listenerCount("data")&&I.resume()}}L.prototype.unpipe=function(I){const j=this._readableState,we={hasUnpiped:!1};if(j.pipes.length===0)return this;if(!I){const Ce=j.pipes;j.pipes=[],this.pause();for(let je=0;je0,ge.flowing!==!1&&this.resume()):I==="readable"&&!ge.endEmitted&&!ge.readableListening&&(ge.readableListening=ge.needReadable=!0,ge.flowing=!1,ge.emittedReadable=!1,E("on readable",ge.length,ge.reading),ge.length?oe(this):ge.reading||e.nextTick(z,this)),we},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(I,j){const we=R.prototype.removeListener.call(this,I,j);return I==="readable"&&e.nextTick(Le,this),we},L.prototype.off=L.prototype.removeListener,L.prototype.removeAllListeners=function(I){const j=R.prototype.removeAllListeners.apply(this,arguments);return(I==="readable"||I===void 0)&&e.nextTick(Le,this),j};function Le(I){const j=I._readableState;j.readableListening=I.listenerCount("readable")>0,j.resumeScheduled&&j[v]===!1?j.flowing=!0:I.listenerCount("data")>0?I.resume():j.readableListening||(j.flowing=null)}function z(I){E("readable nexttick read 0"),I.read(0)}L.prototype.resume=function(){const I=this._readableState;return I.flowing||(E("resume"),I.flowing=!I.readableListening,V(this,I)),I[v]=!1,this};function V(I,j){j.resumeScheduled||(j.resumeScheduled=!0,e.nextTick(ue,I,j))}function ue(I,j){E("resume",j.reading),j.reading||I.read(0),j.resumeScheduled=!1,I.emit("resume"),xe(I),j.flowing&&!j.reading&&I.read(0)}L.prototype.pause=function(){return E("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(E("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[v]=!0,this};function xe(I){const j=I._readableState;for(E("flow",j.flowing);j.flowing&&I.read()!==null;);}L.prototype.wrap=function(I){let j=!1;I.on("data",ge=>{!this.push(ge)&&I.pause&&(j=!0,I.pause())}),I.on("end",()=>{this.push(null)}),I.on("error",ge=>{x(this,ge)}),I.on("close",()=>{this.destroy()}),I.on("destroy",()=>{this.destroy()}),this._read=()=>{j&&I.resume&&(j=!1,I.resume())};const we=f(I);for(let ge=1;ge{Ce=$?G(Ce,$):null,we(),we=C});try{for(;;){const $=I.destroyed?null:I.read();if($!==null)yield $;else{if(Ce)throw Ce;if(Ce===null)return;await new d(ge)}}}catch($){throw Ce=G(Ce,$),Ce}finally{(Ce||(j==null?void 0:j.destroyOnReturn)!==!1)&&(Ce===void 0||I._readableState.autoDestroy)?q.destroyer(I,null):(I.off("readable",ge),je())}}a(L.prototype,{readable:{__proto__:null,get(){const I=this._readableState;return!!I&&I.readable!==!1&&!I.destroyed&&!I.errorEmitted&&!I.endEmitted},set(I){this._readableState&&(this._readableState.readable=!!I)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(I){this._readableState&&(this._readableState.flowing=I)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(I){this._readableState&&(this._readableState.destroyed=I)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),a(O.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[v]!==!1},set(I){this[v]=!!I}}}),L._fromList=Ze;function Ze(I,j){if(j.length===0)return null;let we;return j.objectMode?we=j.buffer.shift():!I||I>=j.length?(j.decoder?we=j.buffer.join(""):j.buffer.length===1?we=j.buffer.first():we=j.buffer.concat(j.length),j.buffer.clear()):we=j.buffer.consume(I,j.decoder),we}function Qe(I){const j=I._readableState;E("endReadable",j.endEmitted),j.endEmitted||(j.ended=!0,e.nextTick(Xe,j,I))}function Xe(I,j){if(E("endReadableNT",I.endEmitted,I.length),!I.errored&&!I.closeEmitted&&!I.endEmitted&&I.length===0){if(I.endEmitted=!0,j.emit("end"),j.writable&&j.allowHalfOpen===!1)e.nextTick(it,j);else if(I.autoDestroy){const we=j._writableState;(!we||we.autoDestroy&&(we.finished||we.writable===!1))&&j.destroy()}}}function it(I){I.writable&&!I.writableEnded&&!I.destroyed&&I.end()}L.from=function(I,j){return B(L,I,j)};let et;function ce(){return et===void 0&&(et={}),et}return L.fromWeb=function(I,j){return ce().newStreamReadableFromReadableStream(I,j)},L.toWeb=function(I,j){return ce().newReadableStreamFromStreamReadable(I,j)},L.wrap=function(I,j){var we,ge;return new L({objectMode:(we=(ge=I.readableObjectMode)!==null&&ge!==void 0?ge:I.objectMode)!==null&&we!==void 0?we:!0,...j,destroy(Ce,je){q.destroyer(I,Ce),je(Ce)}}).wrap(I)},Il}var Tl,n_;function wy(){if(n_)return Tl;n_=1;const e=go,{ArrayPrototypeSlice:t,Error:r,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:s,ObjectDefineProperties:a,ObjectSetPrototypeOf:f,StringPrototypeToLowerCase:c,Symbol:d,SymbolHasInstance:l}=nr;Tl=T,T.WritableState=b;const{EventEmitter:h}=aa,y=nh.Stream,{Buffer:A}=qn,R=fs,{addAbortSignal:D}=hf,{getHighWaterMark:ie,getDefaultHighWaterMark:Z}=ih,{ERR_INVALID_ARG_TYPE:J,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_MULTIPLE_CALLBACK:te,ERR_STREAM_CANNOT_PIPE:q,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:F,ERR_STREAM_NULL_VALUES:G,ERR_STREAM_WRITE_AFTER_END:m,ERR_UNKNOWN_ENCODING:S}=xr.codes,{errorOrDestroy:w}=R;f(T.prototype,y.prototype),f(T,y);function k(){}const _=d("kOnFinished");function b(z,V,ue){typeof ue!="boolean"&&(ue=V instanceof fi()),this.objectMode=!!(z&&z.objectMode),ue&&(this.objectMode=this.objectMode||!!(z&&z.writableObjectMode)),this.highWaterMark=z?ie(this,z,"writableHighWaterMark",ue):Z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const xe=!!(z&&z.decodeStrings===!1);this.decodeStrings=!xe,this.defaultEncoding=z&&z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=L.bind(void 0,V),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,v(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!z||z.emitClose!==!1,this.autoDestroy=!z||z.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[_]=[]}function v(z){z.buffered=[],z.bufferedIndex=0,z.allBuffers=!0,z.allNoop=!0}b.prototype.getBuffer=function(){return t(this.buffered,this.bufferedIndex)},s(b.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function T(z){const V=this instanceof fi();if(!V&&!i(T,this))return new T(z);this._writableState=new b(z,this,V),z&&(typeof z.write=="function"&&(this._write=z.write),typeof z.writev=="function"&&(this._writev=z.writev),typeof z.destroy=="function"&&(this._destroy=z.destroy),typeof z.final=="function"&&(this._final=z.final),typeof z.construct=="function"&&(this._construct=z.construct),z.signal&&D(z.signal,this)),y.call(this,z),R.construct(this,()=>{const ue=this._writableState;ue.writing||_e(this,ue),K(this,ue)})}s(T,l,{__proto__:null,value:function(z){return i(this,z)?!0:this!==T?!1:z&&z._writableState instanceof b}}),T.prototype.pipe=function(){w(this,new q)};function B(z,V,ue,xe){const Te=z._writableState;if(typeof ue=="function")xe=ue,ue=Te.defaultEncoding;else{if(!ue)ue=Te.defaultEncoding;else if(ue!=="buffer"&&!A.isEncoding(ue))throw new S(ue);typeof xe!="function"&&(xe=k)}if(V===null)throw new G;if(!Te.objectMode)if(typeof V=="string")Te.decodeStrings!==!1&&(V=A.from(V,ue),ue="buffer");else if(V instanceof A)ue="buffer";else if(y._isUint8Array(V))V=y._uint8ArrayToBuffer(V),ue="buffer";else throw new J("chunk",["string","Buffer","Uint8Array"],V);let Me;return Te.ending?Me=new m:Te.destroyed&&(Me=new W("write")),Me?(e.nextTick(xe,Me),w(z,Me,!0),Me):(Te.pendingcb++,C(z,Te,V,ue,xe))}T.prototype.write=function(z,V,ue){return B(this,z,V,ue)===!0},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){const z=this._writableState;z.corked&&(z.corked--,z.writing||_e(this,z))},T.prototype.setDefaultEncoding=function(V){if(typeof V=="string"&&(V=c(V)),!A.isEncoding(V))throw new S(V);return this._writableState.defaultEncoding=V,this};function C(z,V,ue,xe,Te){const Me=V.objectMode?1:ue.length;V.length+=Me;const Ze=V.lengthue.bufferedIndex&&_e(z,ue),xe?ue.afterWriteTickInfo!==null&&ue.afterWriteTickInfo.cb===Te?ue.afterWriteTickInfo.count++:(ue.afterWriteTickInfo={count:1,cb:Te,stream:z,state:ue},e.nextTick(X,ue.afterWriteTickInfo)):re(z,ue,1,Te))}function X({stream:z,state:V,count:ue,cb:xe}){return V.afterWriteTickInfo=null,re(z,V,ue,xe)}function re(z,V,ue,xe){for(!V.ending&&!z.destroyed&&V.length===0&&V.needDrain&&(V.needDrain=!1,z.emit("drain"));ue-- >0;)V.pendingcb--,xe();V.destroyed&&fe(V),K(z,V)}function fe(z){if(z.writing)return;for(let Te=z.bufferedIndex;Te1&&z._writev){V.pendingcb-=Me-1;const Qe=V.allNoop?k:it=>{for(let et=Ze;et256?(ue.splice(0,Ze),V.bufferedIndex=0):V.bufferedIndex=Ze}V.bufferProcessing=!1}T.prototype._write=function(z,V,ue){if(this._writev)this._writev([{chunk:z,encoding:V}],ue);else throw new E("_write()")},T.prototype._writev=null,T.prototype.end=function(z,V,ue){const xe=this._writableState;typeof z=="function"?(ue=z,z=null,V=null):typeof V=="function"&&(ue=V,V=null);let Te;if(z!=null){const Me=B(this,z,V);Me instanceof r&&(Te=Me)}return xe.corked&&(xe.corked=1,this.uncork()),Te||(!xe.errored&&!xe.ending?(xe.ending=!0,K(this,xe,!0),xe.ended=!0):xe.finished?Te=new F("end"):xe.destroyed&&(Te=new W("end"))),typeof ue=="function"&&(Te||xe.finished?e.nextTick(ue,Te):xe[_].push(ue)),this};function be(z){return z.ending&&!z.destroyed&&z.constructed&&z.length===0&&!z.errored&&z.buffered.length===0&&!z.finished&&!z.writing&&!z.errorEmitted&&!z.closeEmitted}function ye(z,V){let ue=!1;function xe(Te){if(ue){w(z,Te??te());return}if(ue=!0,V.pendingcb--,Te){const Me=V[_].splice(0);for(let Ze=0;Ze{be(Te)?Q(xe,Te):Te.pendingcb--},z,V)):be(V)&&(V.pendingcb++,Q(z,V))))}function Q(z,V){V.pendingcb--,V.finished=!0;const ue=V[_].splice(0);for(let xe=0;xe{if(L!=null)throw new A("nully","body",L)},L=>{R(x,L)});return x=new F({objectMode:!0,readable:!1,write:v,final(L){T(async()=>{try{await O,e.nextTick(L,null)}catch(X){e.nextTick(L,X)}})},destroy:B})}throw new A("Iterable, AsyncIterable or AsyncFunction",k,b)}if(te(w))return S(w.arrayBuffer());if(s(w))return J(F,w,{objectMode:!0,writable:!1});if(typeof(w==null?void 0:w.writable)=="object"||typeof(w==null?void 0:w.readable)=="object"){const b=w!=null&&w.readable?f(w==null?void 0:w.readable)?w==null?void 0:w.readable:S(w.readable):void 0,v=w!=null&&w.writable?c(w==null?void 0:w.writable)?w==null?void 0:w.writable:S(w.writable):void 0;return m({readable:b,writable:v})}const _=w==null?void 0:w.then;if(typeof _=="function"){let b;return W(_,w,v=>{v!=null&&b.push(v),b.push(null)},v=>{R(b,v)}),b=new F({objectMode:!0,writable:!1,read(){}})}throw new y(k,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],w)};function G(S){let{promise:w,resolve:k}=Z();const _=new q,b=_.signal;return{value:S(async function*(){for(;;){const T=w;w=null;const{chunk:B,done:C,cb:x}=await T;if(e.nextTick(x),C)return;if(b.aborted)throw new h(void 0,{cause:b.reason});({promise:w,resolve:k}=Z()),yield B}}(),{signal:b}),write(T,B,C){const x=k;k=null,x({chunk:T,done:!1,cb:C})},final(T){const B=k;k=null,B({done:!0,cb:T})},destroy(T,B){_.abort(),B(T)}}}function m(S){const w=S.readable&&typeof S.readable.read!="function"?ie.wrap(S.readable):S.readable,k=S.writable;let _=!!r(w),b=!!i(k),v,T,B,C,x;function O(L){const X=C;C=null,X?X(L):L&&x.destroy(L)}return x=new F({readableObjectMode:!!(w!=null&&w.readableObjectMode),writableObjectMode:!!(k!=null&&k.writableObjectMode),readable:_,writable:b}),b&&(l(k,L=>{b=!1,L&&R(w,L),O(L)}),x._write=function(L,X,re){k.write(L,X)?re():v=re},x._final=function(L){k.end(),T=L},k.on("drain",function(){if(v){const L=v;v=null,L()}}),k.on("finish",function(){if(T){const L=T;T=null,L()}})),_&&(l(w,L=>{_=!1,L&&R(w,L),O(L)}),w.on("readable",function(){if(B){const L=B;B=null,L()}}),w.on("end",function(){x.push(null)}),x._read=function(){for(;;){const L=w.read();if(L===null){B=x._read;return}if(!x.push(L))return}}),x._destroy=function(L,X){!L&&C!==null&&(L=new h),B=null,v=null,T=null,C===null?X(L):(C=X,R(k,L),R(w,L))},x}return Ol}var Nl,o_;function fi(){if(o_)return Nl;o_=1;const{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:t,ObjectKeys:r,ObjectSetPrototypeOf:i}=nr;Nl=f;const s=gf(),a=wy();i(f.prototype,s.prototype),i(f,s);{const h=r(a.prototype);for(let y=0;y{if(t){e?e(t):this.destroy(t);return}r!=null&&this.push(r),this.push(null),e&&e()}):(this.push(null),e&&e())}function FL(){this._final!==vd&&vd.call(this)}ci.prototype._final=vd;ci.prototype._transform=function(e,t,r){throw new UL("_transform()")};ci.prototype._write=function(e,t,r){const i=this._readableState,s=this._writableState,a=i.length;this._transform(e,t,(f,c)=>{if(f){r(f);return}c!=null&&this.push(c),s.ended||a===i.length||i.length{i=!0});const s=ju(e,{readable:t,writable:r},a=>{i=!a});return{destroy:a=>{i||(i=!0,WL.destroyer(e,a||new ZL("pipe")))},cleanup:s}}function rP(e){return XL(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function $l(e){if(ro(e))return e;if(Du(e))return nP(e);throw new Ed("val",["Readable","Iterable","AsyncIterable"],e)}async function*nP(e){xl||(xl=gf()),yield*xl.prototype[HL].call(e)}async function Tu(e,t,r,{end:i}){let s,a=null;const f=l=>{if(l&&(s=l),a){const h=a;a=null,h()}},c=()=>new qL((l,h)=>{s?h(s):a=()=>{s?h(s):l()}});t.on("drain",f);const d=ju(t,{readable:!1},f);try{t.writableNeedDrain&&await c();for await(const l of e)t.write(l)||await c();i&&t.end(),await c(),r()}catch(l){r(s!==l?GL(s,l):l)}finally{d(),t.off("drain",f)}}async function Dl(e,t,r,{end:i}){Go(t)&&(t=t.writable);const s=t.getWriter();try{for await(const a of e)await s.ready,s.write(a).catch(()=>{});await s.ready,i&&await s.close(),r()}catch(a){try{await s.abort(a),r(a)}catch(f){r(f)}}}function iP(...e){return Ry(e,zL(rP(e)))}function Ry(e,t,r){if(e.length===1&&jL(e[0])&&(e=e[0]),e.length<2)throw new VL("streams");const i=new tP,s=i.signal,a=r==null?void 0:r.signal,f=[];YL(a,"options.signal");function c(){R(new JL)}a==null||a.addEventListener("abort",c);let d,l;const h=[];let y=0;function A(J){R(J,--y===0)}function R(J,E){if(J&&(!d||d.code==="ERR_STREAM_PREMATURE_CLOSE")&&(d=J),!(!d&&!E)){for(;h.length;)h.shift()(d);a==null||a.removeEventListener("abort",c),i.abort(),E&&(d||f.forEach(te=>te()),Vs.nextTick(t,d,l))}}let D;for(let J=0;J0,W=te||(r==null?void 0:r.end)!==!1,F=J===e.length-1;if(a_(E)){let G=function(m){m&&m.name!=="AbortError"&&m.code!=="ERR_STREAM_PREMATURE_CLOSE"&&A(m)};if(W){const{destroy:m,cleanup:S}=u_(E,te,q);h.push(m),Pl(E)&&F&&f.push(S)}E.on("error",G),Pl(E)&&F&&f.push(()=>{E.removeListener("error",G)})}if(J===0)if(typeof E=="function"){if(D=E({signal:s}),!ro(D))throw new Ll("Iterable, AsyncIterable or Stream","source",D)}else ro(E)||Du(E)||Go(E)?D=E:D=s_.from(E);else if(typeof E=="function"){if(Go(D)){var ie;D=$l((ie=D)===null||ie===void 0?void 0:ie.readable)}else D=$l(D);if(D=E(D,{signal:s}),te){if(!ro(D,!0))throw new Ll("AsyncIterable",`transform[${J-1}]`,D)}else{var Z;Bl||(Bl=Sy);const G=new Bl({objectMode:!0}),m=(Z=D)===null||Z===void 0?void 0:Z.then;if(typeof m=="function")y++,m.call(D,k=>{l=k,k!=null&&G.write(k),W&&G.end(),Vs.nextTick(A)},k=>{G.destroy(k),Vs.nextTick(A,k)});else if(ro(D,!0))y++,Tu(D,G,A,{end:W});else if(Cl(D)||Go(D)){const k=D.readable||D;y++,Tu(k,G,A,{end:W})}else throw new Ll("AsyncIterable or Promise","destination",D);D=G;const{destroy:S,cleanup:w}=u_(D,!1,!0);h.push(S),F&&f.push(w)}}else if(a_(E)){if(Du(D)){y+=2;const G=oP(D,E,A,{end:W});Pl(E)&&F&&f.push(G)}else if(Go(D)||Cl(D)){const G=D.readable||D;y++,Tu(G,E,A,{end:W})}else if(ro(D))y++,Tu(D,E,A,{end:W});else throw new Ed("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],D);D=E}else if(QL(E)){if(Du(D))y++,Dl($l(D),E,A,{end:W});else if(Cl(D)||ro(D))y++,Dl(D,E,A,{end:W});else if(Go(D))y++,Dl(D.readable,E,A,{end:W});else throw new Ed("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],D);D=E}else D=s_.from(E)}return(s!=null&&s.aborted||a!=null&&a.aborted)&&Vs.nextTick(c),D}function oP(e,t,r,{end:i}){let s=!1;if(t.on("close",()=>{s||r(new KL)}),e.pipe(t,{end:!1}),i){let a=function(){s=!0,t.end()};eP(e)?Vs.nextTick(a):e.once("end",a)}else r();return ju(e,{readable:!0,writable:!1},a=>{const f=e._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&f&&f.ended&&!f.errored&&!f.errorEmitted?e.once("end",r).once("error",r):r(a)}),ju(t,{readable:!1,writable:!0},r)}var ah={pipelineImpl:Ry,pipeline:iP};const{pipeline:sP}=ah,Ou=fi(),{destroyer:aP}=fs,{isNodeStream:Nu,isReadable:f_,isWritable:c_,isWebStream:Ml,isTransformStream:eo,isWritableStream:l_,isReadableStream:d_}=hi,{AbortError:uP,codes:{ERR_INVALID_ARG_VALUE:h_,ERR_MISSING_ARGS:fP}}=xr,cP=$i;var Ay=function(...t){if(t.length===0)throw new fP("streams");if(t.length===1)return Ou.from(t[0]);const r=[...t];if(typeof t[0]=="function"&&(t[0]=Ou.from(t[0])),typeof t[t.length-1]=="function"){const R=t.length-1;t[R]=Ou.from(t[R])}for(let R=0;R0&&!(c_(t[R])||l_(t[R])||eo(t[R])))throw new h_(`streams[${R}]`,r[R],"must be writable")}let i,s,a,f,c;function d(R){const D=f;f=null,D?D(R):R?c.destroy(R):!A&&!y&&c.destroy()}const l=t[0],h=sP(t,d),y=!!(c_(l)||l_(l)||eo(l)),A=!!(f_(h)||d_(h)||eo(h));if(c=new Ou({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(h!=null&&h.writableObjectMode),writable:y,readable:A}),y){if(Nu(l))c._write=function(D,ie,Z){l.write(D,ie)?Z():i=Z},c._final=function(D){l.end(),s=D},l.on("drain",function(){if(i){const D=i;i=null,D()}});else if(Ml(l)){const ie=(eo(l)?l.writable:l).getWriter();c._write=async function(Z,J,E){try{await ie.ready,ie.write(Z).catch(()=>{}),E()}catch(te){E(te)}},c._final=async function(Z){try{await ie.ready,ie.close().catch(()=>{}),s=Z}catch(J){Z(J)}}}const R=eo(h)?h.readable:h;cP(R,()=>{if(s){const D=s;s=null,D()}})}if(A){if(Nu(h))h.on("readable",function(){if(a){const R=a;a=null,R()}}),h.on("end",function(){c.push(null)}),c._read=function(){for(;;){const R=h.read();if(R===null){a=c._read;return}if(!c.push(R))return}};else if(Ml(h)){const D=(eo(h)?h.readable:h).getReader();c._read=async function(){for(;;)try{const{value:ie,done:Z}=await D.read();if(!c.push(ie))return;if(Z){c.push(null);return}}catch{return}}}}return c._destroy=function(R,D){!R&&f!==null&&(R=new uP),a=null,i=null,s=null,f===null?D(R):(f=D,Nu(h)&&aP(h,R))},c};const Iy=globalThis.AbortController||Xd().AbortController,{codes:{ERR_INVALID_ARG_VALUE:lP,ERR_INVALID_ARG_TYPE:fa,ERR_MISSING_ARGS:dP,ERR_OUT_OF_RANGE:hP},AbortError:Hn}=xr,{validateAbortSignal:_o,validateInteger:gP,validateObject:bo}=sf,pP=nr.Symbol("kWeak"),{finished:_P}=$i,bP=Ay,{addAbortSignalNoValidate:yP}=hf,{isWritable:wP,isNodeStream:mP}=hi,{ArrayPrototypePush:vP,MathFloor:EP,Number:SP,NumberIsNaN:RP,Promise:g_,PromiseReject:p_,PromisePrototypeThen:AP,Symbol:Ty}=nr,qu=Ty("kEmpty"),__=Ty("kEof");function IP(e,t){if(t!=null&&bo(t,"options"),(t==null?void 0:t.signal)!=null&&_o(t.signal,"options.signal"),mP(e)&&!wP(e))throw new lP("stream",e,"must be writable");const r=bP(this,e);return t!=null&&t.signal&&yP(t.signal,r),r}function pf(e,t){if(typeof e!="function")throw new fa("fn",["Function","AsyncFunction"],e);t!=null&&bo(t,"options"),(t==null?void 0:t.signal)!=null&&_o(t.signal,"options.signal");let r=1;return(t==null?void 0:t.concurrency)!=null&&(r=EP(t.concurrency)),gP(r,"concurrency",1),(async function*(){var s,a;const f=new Iy,c=this,d=[],l=f.signal,h={signal:l},y=()=>f.abort();t!=null&&(s=t.signal)!==null&&s!==void 0&&s.aborted&&y(),t==null||(a=t.signal)===null||a===void 0||a.addEventListener("abort",y);let A,R,D=!1;function ie(){D=!0}async function Z(){try{for await(let te of c){var J;if(D)return;if(l.aborted)throw new Hn;try{te=e(te,h)}catch(q){te=p_(q)}te!==qu&&(typeof((J=te)===null||J===void 0?void 0:J.catch)=="function"&&te.catch(ie),d.push(te),A&&(A(),A=null),!D&&d.length&&d.length>=r&&await new g_(q=>{R=q}))}d.push(__)}catch(te){const q=p_(te);AP(q,void 0,ie),d.push(q)}finally{var E;D=!0,A&&(A(),A=null),t==null||(E=t.signal)===null||E===void 0||E.removeEventListener("abort",y)}}Z();try{for(;;){for(;d.length>0;){const J=await d[0];if(J===__)return;if(l.aborted)throw new Hn;J!==qu&&(yield J),d.shift(),R&&(R(),R=null)}await new g_(J=>{A=J})}}finally{f.abort(),D=!0,R&&(R(),R=null)}}).call(this)}function TP(e=void 0){return e!=null&&bo(e,"options"),(e==null?void 0:e.signal)!=null&&_o(e.signal,"options.signal"),(async function*(){let r=0;for await(const s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Hn({cause:e.signal.reason});yield[r++,s]}}).call(this)}async function Oy(e,t=void 0){for await(const r of uh.call(this,e,t))return!0;return!1}async function OP(e,t=void 0){if(typeof e!="function")throw new fa("fn",["Function","AsyncFunction"],e);return!await Oy.call(this,async(...r)=>!await e(...r),t)}async function NP(e,t){for await(const r of uh.call(this,e,t))return r}async function LP(e,t){if(typeof e!="function")throw new fa("fn",["Function","AsyncFunction"],e);async function r(i,s){return await e(i,s),qu}for await(const i of pf.call(this,r,t));}function uh(e,t){if(typeof e!="function")throw new fa("fn",["Function","AsyncFunction"],e);async function r(i,s){return await e(i,s)?i:qu}return pf.call(this,r,t)}class PP extends dP{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function CP(e,t,r){var i;if(typeof e!="function")throw new fa("reducer",["Function","AsyncFunction"],e);r!=null&&bo(r,"options"),(r==null?void 0:r.signal)!=null&&_o(r.signal,"options.signal");let s=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){const l=new Hn(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await _P(this.destroy(l)),l}const a=new Iy,f=a.signal;if(r!=null&&r.signal){const l={once:!0,[pP]:this};r.signal.addEventListener("abort",()=>a.abort(),l)}let c=!1;try{for await(const l of this){var d;if(c=!0,r!=null&&(d=r.signal)!==null&&d!==void 0&&d.aborted)throw new Hn;s?t=await e(t,l,{signal:f}):(t=l,s=!0)}if(!c&&!s)throw new PP}finally{a.abort()}return t}async function BP(e){e!=null&&bo(e,"options"),(e==null?void 0:e.signal)!=null&&_o(e.signal,"options.signal");const t=[];for await(const i of this){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Hn(void 0,{cause:e.signal.reason});vP(t,i)}return t}function xP(e,t){const r=pf.call(this,e,t);return(async function*(){for await(const s of r)yield*s}).call(this)}function Ny(e){if(e=SP(e),RP(e))return 0;if(e<0)throw new hP("number",">= 0",e);return e}function $P(e,t=void 0){return t!=null&&bo(t,"options"),(t==null?void 0:t.signal)!=null&&_o(t.signal,"options.signal"),e=Ny(e),(async function*(){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Hn;for await(const a of this){var s;if(t!=null&&(s=t.signal)!==null&&s!==void 0&&s.aborted)throw new Hn;e--<=0&&(yield a)}}).call(this)}function DP(e,t=void 0){return t!=null&&bo(t,"options"),(t==null?void 0:t.signal)!=null&&_o(t.signal,"options.signal"),e=Ny(e),(async function*(){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Hn;for await(const a of this){var s;if(t!=null&&(s=t.signal)!==null&&s!==void 0&&s.aborted)throw new Hn;if(e-- >0)yield a;else return}}).call(this)}Jd.streamReturningOperators={asIndexedPairs:TP,drop:$P,filter:uh,flatMap:xP,map:pf,take:DP,compose:IP};Jd.promiseReturningOperators={every:OP,forEach:LP,reduce:CP,toArray:BP,some:Oy,find:NP};var Ul,b_;function Ly(){if(b_)return Ul;b_=1;const{ArrayPrototypePop:e,Promise:t}=nr,{isIterable:r,isNodeStream:i,isWebStream:s}=hi,{pipelineImpl:a}=ah,{finished:f}=$i;Py();function c(...d){return new t((l,h)=>{let y,A;const R=d[d.length-1];if(R&&typeof R=="object"&&!i(R)&&!r(R)&&!s(R)){const D=e(d);y=D.signal,A=D.end}a(d,(D,ie)=>{D?h(D):l(ie)},{signal:y,end:A})})}return Ul={finished:f,pipeline:c},Ul}var y_;function Py(){if(y_)return El.exports;y_=1;const{Buffer:e}=qn,{ObjectDefineProperty:t,ObjectKeys:r,ReflectApply:i}=nr,{promisify:{custom:s}}=di,{streamReturningOperators:a,promiseReturningOperators:f}=Jd,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=xr,d=Ay,{pipeline:l}=ah,{destroyer:h}=fs,y=$i,A=Ly(),R=hi,D=El.exports=nh.Stream;D.isDisturbed=R.isDisturbed,D.isErrored=R.isErrored,D.isReadable=R.isReadable,D.Readable=gf();for(const Z of r(a)){let E=function(...te){if(new.target)throw c();return D.Readable.from(i(J,this,te))};const J=a[Z];t(E,"name",{__proto__:null,value:J.name}),t(E,"length",{__proto__:null,value:J.length}),t(D.Readable.prototype,Z,{__proto__:null,value:E,enumerable:!1,configurable:!0,writable:!0})}for(const Z of r(f)){let E=function(...te){if(new.target)throw c();return i(J,this,te)};const J=f[Z];t(E,"name",{__proto__:null,value:J.name}),t(E,"length",{__proto__:null,value:J.length}),t(D.Readable.prototype,Z,{__proto__:null,value:E,enumerable:!1,configurable:!0,writable:!0})}D.Writable=wy(),D.Duplex=fi(),D.Transform=vy,D.PassThrough=Sy,D.pipeline=l;const{addAbortSignal:ie}=hf;return D.addAbortSignal=ie,D.finished=y,D.destroy=h,D.compose=d,t(D,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return A}}),t(l,s,{__proto__:null,enumerable:!0,get(){return A.pipeline}}),t(y,s,{__proto__:null,enumerable:!0,get(){return A.finished}}),D.Stream=D,D._isUint8Array=function(J){return J instanceof Uint8Array},D._uint8ArrayToBuffer=function(J){return e.from(J.buffer,J.byteOffset,J.byteLength)},El.exports}(function(e){const t=Py(),r=Ly(),i=t.Readable.destroy;e.exports=t.Readable,e.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,e.exports._isUint8Array=t._isUint8Array,e.exports.isDisturbed=t.isDisturbed,e.exports.isErrored=t.isErrored,e.exports.isReadable=t.isReadable,e.exports.Readable=t.Readable,e.exports.Writable=t.Writable,e.exports.Duplex=t.Duplex,e.exports.Transform=t.Transform,e.exports.PassThrough=t.PassThrough,e.exports.addAbortSignal=t.addAbortSignal,e.exports.finished=t.finished,e.exports.destroy=t.destroy,e.exports.destroy=i,e.exports.pipeline=t.pipeline,e.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return r}}),e.exports.Stream=t.Stream,e.exports.default=e.exports})(xO);var fh=ta;ta.default=ta;ta.stable=xy;ta.stableStringify=xy;var Hu="[...]",Cy="[Circular]",co=[],oo=[];function By(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function ta(e,t,r,i){typeof i>"u"&&(i=By()),Sd(e,"",0,[],void 0,0,i);var s;try{oo.length===0?s=JSON.stringify(e,t,r):s=JSON.stringify(e,$y(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;co.length!==0;){var a=co.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return s}function Zo(e,t,r,i){var s=Object.getOwnPropertyDescriptor(i,r);s.get!==void 0?s.configurable?(Object.defineProperty(i,r,{value:e}),co.push([i,r,t,s])):oo.push([t,r,e]):(i[r]=e,co.push([i,r,t]))}function Sd(e,t,r,i,s,a,f){a+=1;var c;if(typeof e=="object"&&e!==null){for(c=0;cf.depthLimit){Zo(Hu,e,t,s);return}if(typeof f.edgesLimit<"u"&&r+1>f.edgesLimit){Zo(Hu,e,t,s);return}if(i.push(e),Array.isArray(e))for(c=0;ct?1:0}function xy(e,t,r,i){typeof i>"u"&&(i=By());var s=Rd(e,"",0,[],void 0,0,i)||e,a;try{oo.length===0?a=JSON.stringify(s,t,r):a=JSON.stringify(s,$y(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;co.length!==0;){var f=co.pop();f.length===4?Object.defineProperty(f[0],f[1],f[3]):f[0][f[1]]=f[2]}}return a}function Rd(e,t,r,i,s,a,f){a+=1;var c;if(typeof e=="object"&&e!==null){for(c=0;cf.depthLimit){Zo(Hu,e,t,s);return}if(typeof f.edgesLimit<"u"&&r+1>f.edgesLimit){Zo(Hu,e,t,s);return}if(i.push(e),Array.isArray(e))for(c=0;c0)for(var i=0;ii??(i=[t,...r()])}}function FP(e){return cn(e)&&typeof e[Symbol.iterator]=="function"}function cn(e){return typeof e=="object"&&e!=null}function w_(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function rr(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function jP(e){const{done:t,value:r}=e.next();return t?void 0:r}function qP(e,t,r,i){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:s,branch:a}=t,{type:f}=r,{refinement:c,message:d=`Expected a value of type \`${f}\`${c?` with refinement \`${c}\``:""}, but received: \`${rr(i)}\``}=e;return{value:i,type:f,refinement:c,key:s[s.length-1],path:s,branch:a,...e,message:d}}function*Ad(e,t,r,i){FP(e)||(e=[e]);for(const s of e){const a=qP(s,t,r,i);a&&(yield a)}}function*lh(e,t,r={}){const{path:i=[],branch:s=[e],coerce:a=!1,mask:f=!1}=r,c={path:i,branch:s};if(a&&(e=t.coercer(e,c),f&&t.type!=="type"&&cn(t.schema)&&cn(e)&&!Array.isArray(e)))for(const l in e)t.schema[l]===void 0&&delete e[l];let d="valid";for(const l of t.validator(e,c))l.explanation=r.message,d="not_valid",yield[l,void 0];for(let[l,h,y]of t.entries(e,c)){const A=lh(h,y,{path:l===void 0?i:[...i,l],branch:l===void 0?s:[...s,h],coerce:a,mask:f,message:r.message});for(const R of A)R[0]?(d=R[0].refinement!=null?"not_refined":"not_valid",yield[R[0],void 0]):a&&(h=R[1],l===void 0?e=h:e instanceof Map?e.set(l,h):e instanceof Set?e.add(h):cn(e)&&(h!==void 0||l in e)&&(e[l]=h))}if(d!=="not_valid")for(const l of t.refiner(e,c))l.explanation=r.message,d="not_refined",yield[l,void 0];d==="valid"&&(yield[void 0,e])}class Yt{constructor(t){const{type:r,schema:i,validator:s,refiner:a,coercer:f=d=>d,entries:c=function*(){}}=t;this.type=r,this.schema=i,this.entries=c,this.coercer=f,s?this.validator=(d,l)=>{const h=s(d,l);return Ad(h,l,this,d)}:this.validator=()=>[],a?this.refiner=(d,l)=>{const h=a(d,l);return Ad(h,l,this,d)}:this.refiner=()=>[]}assert(t,r){return My(t,this,r)}create(t,r){return Uy(t,this,r)}is(t){return dh(t,this)}mask(t,r){return ky(t,this,r)}validate(t,r={}){return cs(t,this,r)}}function My(e,t,r){const i=cs(e,t,{message:r});if(i[0])throw i[0]}function Uy(e,t,r){const i=cs(e,t,{coerce:!0,message:r});if(i[0])throw i[0];return i[1]}function ky(e,t,r){const i=cs(e,t,{coerce:!0,mask:!0,message:r});if(i[0])throw i[0];return i[1]}function dh(e,t){return!cs(e,t)[0]}function cs(e,t,r={}){const i=lh(e,t,r),s=jP(i);return s[0]?[new Dy(s[0],function*(){for(const f of i)f[0]&&(yield f[0])}),void 0]:[void 0,s[1]]}function HP(...e){const t=e[0].type==="type",r=e.map(s=>s.schema),i=Object.assign({},...r);return t?gh(i):ca(i)}function $r(e,t){return new Yt({type:e,schema:null,validator:t})}function zP(e,t){return new Yt({...e,refiner:(r,i)=>r===void 0||e.refiner(r,i),validator(r,i){return r===void 0?!0:(t(r,i),e.validator(r,i))}})}function WP(e){return new Yt({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function GP(e){let t;return new Yt({type:"lazy",schema:null,*entries(r,i){t??(t=e()),yield*t.entries(r,i)},validator(r,i){return t??(t=e()),t.validator(r,i)},coercer(r,i){return t??(t=e()),t.coercer(r,i)},refiner(r,i){return t??(t=e()),t.refiner(r,i)}})}function VP(e,t){const{schema:r}=e,i={...r};for(const s of t)delete i[s];switch(e.type){case"type":return gh(i);default:return ca(i)}}function ZP(e){const t=e instanceof Yt?{...e.schema}:{...e};for(const r in t)t[r]=Fy(t[r]);return ca(t)}function KP(e,t){const{schema:r}=e,i={};for(const s of t)i[s]=r[s];return ca(i)}function JP(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),$r(e,t)}function XP(){return $r("any",()=>!0)}function YP(e){return new Yt({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,i]of t.entries())yield[r,i,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${rr(t)}`}})}function QP(){return $r("bigint",e=>typeof e=="bigint")}function eC(){return $r("boolean",e=>typeof e=="boolean")}function tC(){return $r("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${rr(e)}`)}function rC(e){const t={},r=e.map(i=>rr(i)).join();for(const i of e)t[i]=i;return new Yt({type:"enums",schema:t,validator(i){return e.includes(i)||`Expected one of \`${r}\`, but received: ${rr(i)}`}})}function nC(){return $r("func",e=>typeof e=="function"||`Expected a function, but received: ${rr(e)}`)}function iC(e){return $r("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${rr(t)}`)}function oC(){return $r("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${rr(e)}`)}function sC(e){return new Yt({type:"intersection",schema:null,*entries(t,r){for(const i of e)yield*i.entries(t,r)},*validator(t,r){for(const i of e)yield*i.validator(t,r)},*refiner(t,r){for(const i of e)yield*i.refiner(t,r)}})}function aC(e){const t=rr(e),r=typeof e;return new Yt({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(i){return i===e||`Expected the literal \`${t}\`, but received: ${rr(i)}`}})}function uC(e,t){return new Yt({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[i,s]of r.entries())yield[i,i,e],yield[i,s,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${rr(r)}`}})}function hh(){return $r("never",()=>!1)}function fC(e){return new Yt({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function cC(){return $r("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${rr(e)}`)}function ca(e){const t=e?Object.keys(e):[],r=hh();return new Yt({type:"object",schema:e||null,*entries(i){if(e&&cn(i)){const s=new Set(Object.keys(i));for(const a of t)s.delete(a),yield[a,i[a],e[a]];for(const a of s)yield[a,i[a],r]}},validator(i){return cn(i)||`Expected an object, but received: ${rr(i)}`},coercer(i){return cn(i)?{...i}:i}})}function Fy(e){return new Yt({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function lC(e,t){return new Yt({type:"record",schema:null,*entries(r){if(cn(r))for(const i in r){const s=r[i];yield[i,i,e],yield[i,s,t]}},validator(r){return cn(r)||`Expected an object, but received: ${rr(r)}`}})}function dC(){return $r("regexp",e=>e instanceof RegExp)}function hC(e){return new Yt({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${rr(t)}`}})}function jy(){return $r("string",e=>typeof e=="string"||`Expected a string, but received: ${rr(e)}`)}function gC(e){const t=hh();return new Yt({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const i=Math.max(e.length,r.length);for(let s=0;sr.type).join(" | ");return new Yt({type:"union",schema:null,coercer(r){for(const i of e){const[s,a]=i.validate(r,{coerce:!0});if(!s)return a}return r},validator(r,i){const s=[];for(const a of e){const[...f]=lh(r,a,i),[c]=f;if(c[0])for(const[d]of f)d&&s.push(d);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${rr(r)}`,...s]}})}function qy(){return $r("unknown",()=>!0)}function ph(e,t,r){return new Yt({...e,coercer:(i,s)=>dh(i,t)?e.coercer(r(i,s),s):e.coercer(i,s)})}function _C(e,t,r={}){return ph(e,qy(),i=>{const s=typeof t=="function"?t():t;if(i===void 0)return s;if(!r.strict&&w_(i)&&w_(s)){const a={...i};let f=!1;for(const c in s)a[c]===void 0&&(a[c]=s[c],f=!0);if(f)return a}return i})}function bC(e){return ph(e,jy(),t=>t.trim())}function yC(e){return yo(e,"empty",t=>{const r=Hy(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function Hy(e){return e instanceof Map||e instanceof Set?e.size:e.length}function wC(e,t,r={}){const{exclusive:i}=r;return yo(e,"max",s=>i?si?s>t:s>=t||`Expected a ${e.type} greater than ${i?"":"or equal to "}${t} but received \`${s}\``)}function vC(e){return yo(e,"nonempty",t=>Hy(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function EC(e,t){return yo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function SC(e,t,r=t){const i=`Expected a ${e.type}`,s=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return yo(e,"size",a=>{if(typeof a=="number"||a instanceof Date)return t<=a&&a<=r||`${i} ${s} but received \`${a}\``;if(a instanceof Map||a instanceof Set){const{size:f}=a;return t<=f&&f<=r||`${i} with a size ${s} but received one with a size of \`${f}\``}else{const{length:f}=a;return t<=f&&f<=r||`${i} with a length ${s} but received one with a length of \`${f}\``}})}function yo(e,t,r){return new Yt({...e,*refiner(i,s){yield*e.refiner(i,s);const a=r(i,s),f=Ad(a,s,e,i);for(const c of f)yield{...c,refinement:t}}})}const RC=Object.freeze(Object.defineProperty({__proto__:null,Struct:Yt,StructError:Dy,any:XP,array:YP,assert:My,assign:HP,bigint:QP,boolean:eC,coerce:ph,create:Uy,date:tC,defaulted:_C,define:$r,deprecated:zP,dynamic:WP,empty:yC,enums:rC,func:nC,instance:iC,integer:oC,intersection:sC,is:dh,lazy:GP,literal:aC,map:uC,mask:ky,max:wC,min:mC,never:hh,nonempty:vC,nullable:fC,number:cC,object:ca,omit:VP,optional:Fy,partial:ZP,pattern:EC,pick:KP,record:lC,refine:yo,regexp:dC,set:hC,size:SC,string:jy,struct:JP,trimmed:bC,tuple:gC,type:gh,union:pC,unknown:qy,validate:cs},Symbol.toStringTag,{value:"Module"})),wo=Fd(RC);Object.defineProperty(gr,"__esModule",{value:!0});gr.assertExhaustive=gr.assertStruct=gr.assert=gr.AssertionError=void 0;const AC=wo;function IC(e){return typeof e=="object"&&e!==null&&"message"in e}function TC(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function OC(e){const t=IC(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function zy(e,t){return TC(e)?new e({message:t}):e({message:t})}class _h extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}gr.AssertionError=_h;function NC(e,t="Assertion failed.",r=_h){if(!e)throw t instanceof Error?t:zy(r,t)}gr.assert=NC;function LC(e,t,r="Assertion failed",i=_h){try{(0,AC.assert)(e,t)}catch(s){throw zy(i,`${r}: ${OC(s)}.`)}}gr.assertStruct=LC;function PC(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}gr.assertExhaustive=PC;var la={};Object.defineProperty(la,"__esModule",{value:!0});la.base64=void 0;const CC=wo,BC=gr,xC=(e,t={})=>{var r,i;const s=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,a=(i=t.characterSet)!==null&&i!==void 0?i:"base64";let f;a==="base64"?f=String.raw`[A-Za-z0-9+\/]`:((0,BC.assert)(a==="base64url"),f=String.raw`[-_A-Za-z0-9]`);let c;return s?c=new RegExp(`^(?:${f}{4})*(?:${f}{3}=|${f}{2}==)?$`,"u"):c=new RegExp(`^(?:${f}{4})*(?:${f}{2,3}|${f}{3}=|${f}{2}==)?$`,"u"),(0,CC.pattern)(e,c)};la.base64=xC;var Et={},da={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=wo,r=gr;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function i(l){return(0,t.is)(l,e.HexStruct)}e.isHexString=i;function s(l){return(0,t.is)(l,e.StrictHexStruct)}e.isStrictHexString=s;function a(l){(0,r.assert)(i(l),"Value must be a hexadecimal string.")}e.assertIsHexString=a;function f(l){(0,r.assert)(s(l),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=f;function c(l){return l.startsWith("0x")?l:l.startsWith("0X")?`0x${l.substring(2)}`:`0x${l}`}e.add0x=c;function d(l){return l.startsWith("0x")||l.startsWith("0X")?l.substring(2):l}e.remove0x=d})(da);Object.defineProperty(Et,"__esModule",{value:!0});Et.createDataView=Et.concatBytes=Et.valueToBytes=Et.stringToBytes=Et.numberToBytes=Et.signedBigIntToBytes=Et.bigIntToBytes=Et.hexToBytes=Et.bytesToString=Et.bytesToNumber=Et.bytesToSignedBigInt=Et.bytesToBigInt=Et.bytesToHex=Et.assertIsBytes=Et.isBytes=void 0;const Hr=gr,Id=da,m_=48,v_=58,E_=87;function $C(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const DC=$C();function bh(e){return e instanceof Uint8Array}Et.isBytes=bh;function ls(e){(0,Hr.assert)(bh(e),"Value must be a Uint8Array.")}Et.assertIsBytes=ls;function Wy(e){if(ls(e),e.length===0)return"0x";const t=DC(),r=new Array(e.length);for(let i=0;i=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return _f(t)}Et.bigIntToBytes=Vy;function FC(e,t){(0,Hr.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function jC(e,t){(0,Hr.assert)(typeof e=="bigint","Value must be a bigint."),(0,Hr.assert)(typeof t=="number","Byte length must be a number."),(0,Hr.assert)(t>0,"Byte length must be greater than 0."),(0,Hr.assert)(FC(e,t),"Byte length is too small to represent the given value.");let r=e;const i=new Uint8Array(t);for(let s=0;s>=BigInt(8);return i.reverse()}Et.signedBigIntToBytes=jC;function Zy(e){(0,Hr.assert)(typeof e=="number","Value must be a number."),(0,Hr.assert)(e>=0,"Value must be a non-negative number."),(0,Hr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return _f(t)}Et.numberToBytes=Zy;function Ky(e){return(0,Hr.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}Et.stringToBytes=Ky;function Jy(e){if(typeof e=="bigint")return Vy(e);if(typeof e=="number")return Zy(e);if(typeof e=="string")return e.startsWith("0x")?_f(e):Ky(e);if(bh(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}Et.valueToBytes=Jy;function qC(e){const t=new Array(e.length);let r=0;for(let s=0;st.call(r,i,s,this))}get(t){return Ar(this,wn,"f").get(t)}has(t){return Ar(this,wn,"f").has(t)}keys(){return Ar(this,wn,"f").keys()}values(){return Ar(this,wn,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}Qo.FrozenMap=yh;class wh{constructor(t){Cn.set(this,void 0),Qy(this,Cn,new Set(t),"f"),Object.freeze(this)}get size(){return Ar(this,Cn,"f").size}[(Cn=new WeakMap,Symbol.iterator)](){return Ar(this,Cn,"f")[Symbol.iterator]()}entries(){return Ar(this,Cn,"f").entries()}forEach(t,r){return Ar(this,Cn,"f").forEach((i,s,a)=>t.call(r,i,s,this))}has(t){return Ar(this,Cn,"f").has(t)}keys(){return Ar(this,Cn,"f").keys()}values(){return Ar(this,Cn,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}Qo.FrozenSet=wh;Object.freeze(yh);Object.freeze(yh.prototype);Object.freeze(wh);Object.freeze(wh.prototype);var ew={};Object.defineProperty(ew,"__esModule",{value:!0});var tw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=wo,r=gr,i=()=>(0,t.define)("finite number",W=>(0,t.is)(W,(0,t.number)())&&Number.isFinite(W));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),i(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(W,F)=>{function G(m,S){const k=[...S.validator(m,F)];return k.length>0?k:!0}try{const m=G(W,e.UnsafeJsonStruct);return m!==!0?m:G(JSON.parse(JSON.stringify(W)),e.UnsafeJsonStruct)}catch(m){return m instanceof RangeError?"Circular reference detected":!1}});function s(W){return(0,t.is)(W,e.JsonStruct)}e.isValidJson=s;function a(W){(0,r.assertStruct)(W,e.JsonStruct,"Invalid JSON value");const F=JSON.stringify(W);return new TextEncoder().encode(F).byteLength}e.getJsonSize=a,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function f(W){return(0,t.is)(W,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=f;function c(W,F){(0,r.assertStruct)(W,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",F)}e.assertIsJsonRpcNotification=c;function d(W){return(0,t.is)(W,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=d;function l(W,F){(0,r.assertStruct)(W,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",F)}e.assertIsJsonRpcRequest=l,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function h(W){return(0,t.is)(W,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=h;function y(W,F){(0,r.assertStruct)(W,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",F)}e.assertIsPendingJsonRpcResponse=y;function A(W){return(0,t.is)(W,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=A;function R(W,F){(0,r.assertStruct)(W,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",F)}e.assertIsJsonRpcResponse=R;function D(W){return(0,t.is)(W,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=D;function ie(W,F){(0,r.assertStruct)(W,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",F)}e.assertIsJsonRpcSuccess=ie;function Z(W){return(0,t.is)(W,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=Z;function J(W,F){(0,r.assertStruct)(W,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",F)}e.assertIsJsonRpcFailure=J;function E(W){return(0,t.is)(W,e.JsonRpcErrorStruct)}e.isJsonRpcError=E;function te(W,F){(0,r.assertStruct)(W,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",F)}e.assertIsJsonRpcError=te;function q(W){const{permitEmptyString:F,permitFractions:G,permitNull:m}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},W);return w=>!!(typeof w=="number"&&(G||Number.isInteger(w))||typeof w=="string"&&(F||w.length>0)||m&&w===null)}e.getJsonRpcIdValidator=q})(tw);var rw={};Object.defineProperty(rw,"__esModule",{value:!0});var es={},Td={exports:{}},kl,R_;function eB(){if(R_)return kl;R_=1;var e=1e3,t=e*60,r=t*60,i=r*24,s=i*7,a=i*365.25;kl=function(h,y){y=y||{};var A=typeof h;if(A==="string"&&h.length>0)return f(h);if(A==="number"&&isFinite(h))return y.long?d(h):c(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function f(h){if(h=String(h),!(h.length>100)){var y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(y){var A=parseFloat(y[1]),R=(y[2]||"ms").toLowerCase();switch(R){case"years":case"year":case"yrs":case"yr":case"y":return A*a;case"weeks":case"week":case"w":return A*s;case"days":case"day":case"d":return A*i;case"hours":case"hour":case"hrs":case"hr":case"h":return A*r;case"minutes":case"minute":case"mins":case"min":case"m":return A*t;case"seconds":case"second":case"secs":case"sec":case"s":return A*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function c(h){var y=Math.abs(h);return y>=i?Math.round(h/i)+"d":y>=r?Math.round(h/r)+"h":y>=t?Math.round(h/t)+"m":y>=e?Math.round(h/e)+"s":h+"ms"}function d(h){var y=Math.abs(h);return y>=i?l(h,y,i,"day"):y>=r?l(h,y,r,"hour"):y>=t?l(h,y,t,"minute"):y>=e?l(h,y,e,"second"):h+" ms"}function l(h,y,A,R){var D=y>=A*1.5;return Math.round(h/A)+" "+R+(D?"s":"")}return kl}function tB(e){r.debug=r,r.default=r,r.coerce=d,r.disable=a,r.enable=s,r.enabled=f,r.humanize=eB(),r.destroy=l,Object.keys(e).forEach(h=>{r[h]=e[h]}),r.names=[],r.skips=[],r.formatters={};function t(h){let y=0;for(let A=0;A{if(F==="%%")return"%";q++;const m=r.formatters[G];if(typeof m=="function"){const S=Z[q];F=m.call(J,S),Z.splice(q,1),q--}return F}),r.formatArgs.call(J,Z),(J.log||r.log).apply(J,Z)}return ie.namespace=h,ie.useColors=r.useColors(),ie.color=r.selectColor(h),ie.extend=i,ie.destroy=r.destroy,Object.defineProperty(ie,"enabled",{enumerable:!0,configurable:!1,get:()=>A!==null?A:(R!==r.namespaces&&(R=r.namespaces,D=r.enabled(h)),D),set:Z=>{A=Z}}),typeof r.init=="function"&&r.init(ie),ie}function i(h,y){const A=r(this.namespace+(typeof y>"u"?":":y)+h);return A.log=this.log,A}function s(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let y;const A=(typeof h=="string"?h:"").split(/[\s,]+/),R=A.length;for(y=0;y"-"+y)].join(",");return r.enable(""),h}function f(h){if(h[h.length-1]==="*")return!0;let y,A;for(y=0,A=r.skips.length;y{let d=!1;return()=>{d||(d=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;d.splice(1,0,l,"color: inherit");let h=0,y=0;d[0].replace(/%[a-zA-Z%]/g,A=>{A!=="%%"&&(h++,A==="%c"&&(y=h))}),d.splice(y,0,l)}t.log=console.debug||console.log||(()=>{});function s(d){try{d?t.storage.setItem("debug",d):t.storage.removeItem("debug")}catch{}}function a(){let d;try{d=t.storage.getItem("debug")}catch{}return!d&&typeof Fe.process<"u"&&"env"in Fe.process&&(d={}.DEBUG),d}function f(){try{return localStorage}catch{}}e.exports=rB(t);const{formatters:c}=e.exports;c.j=function(d){try{return JSON.stringify(d)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}})(Td,Td.exports);var nB=Td.exports,iB=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(es,"__esModule",{value:!0});es.createModuleLogger=es.createProjectLogger=void 0;const oB=iB(nB),sB=(0,oB.default)("metamask");function aB(e){return sB.extend(e)}es.createProjectLogger=aB;function uB(e,t){return e.extend(t)}es.createModuleLogger=uB;var nw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(l){return Array.isArray(l)&&l.length>0}e.isNonEmptyArray=t;function r(l){return l==null}e.isNullOrUndefined=r;function i(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}e.isObject=i;const s=(l,h)=>Object.hasOwnProperty.call(l,h);e.hasProperty=s,function(l){l[l.Null=4]="Null",l[l.Comma=1]="Comma",l[l.Wrapper=1]="Wrapper",l[l.True=4]="True",l[l.False=5]="False",l[l.Quote=1]="Quote",l[l.Colon=1]="Colon",l[l.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function a(l){if(typeof l!="object"||l===null)return!1;try{let h=l;for(;Object.getPrototypeOf(h)!==null;)h=Object.getPrototypeOf(h);return Object.getPrototypeOf(l)===h}catch{return!1}}e.isPlainObject=a;function f(l){return l.charCodeAt(0)<=127}e.isASCII=f;function c(l){var h;return l.split("").reduce((A,R)=>f(R)?A+1:A+2,0)+((h=l.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&h!==void 0?h:[]).length}e.calculateStringSize=c;function d(l){return l.toString().length}e.calculateNumberSize=d})(nw);var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.hexToBigInt=Mn.hexToNumber=Mn.bigIntToHex=Mn.numberToHex=void 0;const Ko=gr,ra=da,fB=e=>((0,Ko.assert)(typeof e=="number","Value must be a number."),(0,Ko.assert)(e>=0,"Value must be a non-negative number."),(0,Ko.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,ra.add0x)(e.toString(16)));Mn.numberToHex=fB;const cB=e=>((0,Ko.assert)(typeof e=="bigint","Value must be a bigint."),(0,Ko.assert)(e>=0,"Value must be a non-negative bigint."),(0,ra.add0x)(e.toString(16)));Mn.bigIntToHex=cB;const lB=e=>{(0,ra.assertIsHexString)(e);const t=parseInt(e,16);return(0,Ko.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};Mn.hexToNumber=lB;const dB=e=>((0,ra.assertIsHexString)(e),BigInt((0,ra.add0x)(e)));Mn.hexToBigInt=dB;var iw={};Object.defineProperty(iw,"__esModule",{value:!0});var ow={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(a){a[a.Millisecond=1]="Millisecond",a[a.Second=1e3]="Second",a[a.Minute=6e4]="Minute",a[a.Hour=36e5]="Hour",a[a.Day=864e5]="Day",a[a.Week=6048e5]="Week",a[a.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=a=>Number.isInteger(a)&&a>=0,r=(a,f)=>{if(!t(a))throw new Error(`"${f}" must be a non-negative integer. Received: "${a}".`)};function i(a,f){return r(a,"count"),a*f}e.inMilliseconds=i;function s(a){return r(a,"timestamp"),Date.now()-a}e.timeSince=s})(ow);var sw={};Object.defineProperty(sw,"__esModule",{value:!0});var aw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=PO,r=wo,i=gr;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",y=>(0,t.valid)(y)===null?`Expected SemVer version, got "${y}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",y=>(0,t.validRange)(y)===null?`Expected SemVer range, got "${y}"`:!0);function s(y){return(0,r.is)(y,e.VersionStruct)}e.isValidSemVerVersion=s;function a(y){return(0,r.is)(y,e.VersionRangeStruct)}e.isValidSemVerRange=a;function f(y){(0,i.assertStruct)(y,e.VersionStruct)}e.assertIsSemVerVersion=f;function c(y){(0,i.assertStruct)(y,e.VersionRangeStruct)}e.assertIsSemVerRange=c;function d(y,A){return(0,t.gt)(y,A)}e.gtVersion=d;function l(y,A){return(0,t.gtr)(y,A)}e.gtRange=l;function h(y,A){return(0,t.satisfies)(y,A,{includePrerelease:!0})}e.satisfiesVersionRange=h})(aw);(function(e){var t=ft&&ft.__createBinding||(Object.create?function(i,s,a,f){f===void 0&&(f=a);var c=Object.getOwnPropertyDescriptor(s,a);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[a]}}),Object.defineProperty(i,f,c)}:function(i,s,a,f){f===void 0&&(f=a),i[f]=s[a]}),r=ft&&ft.__exportStar||function(i,s){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(s,a)&&t(s,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),r(gr,e),r(la,e),r(Et,e),r(bf,e),r(Dn,e),r(Qo,e),r(ew,e),r(da,e),r(tw,e),r(rw,e),r(es,e),r(nw,e),r(Mn,e),r(iw,e),r(ow,e),r(sw,e),r(aw,e)})(ch);var wf={},Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.errorValues=Pi.errorCodes=void 0;Pi.errorCodes={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}};Pi.errorValues={"-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."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeCause=e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=ch,r=Pi,i=r.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",a={code:i,message:f(i)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function f(R,D=s){if(c(R)){const ie=R.toString();if((0,t.hasProperty)(r.errorValues,ie))return r.errorValues[ie].message;if(h(R))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return D}e.getMessageFromCode=f;function c(R){return Number.isInteger(R)}e.isValidCode=c;function d(R,{fallbackError:D=a,shouldIncludeStack:ie=!0}={}){if(!(0,t.isJsonRpcError)(D))throw new Error("Must provide fallback error with integer number code and string message.");const Z=l(R,D);return ie||delete Z.stack,Z}e.serializeError=d;function l(R,D){if(R&&typeof R=="object"&&"serialize"in R&&typeof R.serialize=="function")return R.serialize();if((0,t.isJsonRpcError)(R))return R;const ie=y(R);return{...D,data:{cause:ie}}}function h(R){return R>=-32099&&R<=-32e3}function y(R){return Array.isArray(R)?R.map(D=>(0,t.isValidJson)(D)?D:(0,t.isObject)(D)?A(D):null):(0,t.isObject)(R)?A(R):(0,t.isValidJson)(R)?R:null}e.serializeCause=y;function A(R){return Object.getOwnPropertyNames(R).reduce((D,ie)=>{const Z=R[ie];return(0,t.isValidJson)(Z)&&(D[ie]=Z),D},{})}})(wf);var hB=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lo,"__esModule",{value:!0});lo.EthereumProviderError=lo.JsonRpcError=void 0;const gB=ch,pB=hB(fh),_B=wf;class uw extends Error{constructor(t,r,i){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a non-empty string.');super(r),this.code=t,i!==void 0&&(this.data=i)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data,(0,gB.isPlainObject)(this.data)&&(t.data.cause=(0,_B.serializeCause)(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return(0,pB.default)(this.serialize(),wB,2)}}lo.JsonRpcError=uw;let bB=class extends uw{constructor(t,r,i){if(!yB(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,i)}};lo.EthereumProviderError=bB;function yB(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function wB(e,t){if(t!=="[Circular]")return t}var ts={};Object.defineProperty(ts,"__esModule",{value:!0});ts.providerErrors=ts.rpcErrors=void 0;const mh=lo,wr=Pi,fw=wf;ts.rpcErrors={parse:e=>en(wr.errorCodes.rpc.parse,e),invalidRequest:e=>en(wr.errorCodes.rpc.invalidRequest,e),invalidParams:e=>en(wr.errorCodes.rpc.invalidParams,e),methodNotFound:e=>en(wr.errorCodes.rpc.methodNotFound,e),internal:e=>en(wr.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return en(t,e)},invalidInput:e=>en(wr.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>en(wr.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>en(wr.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>en(wr.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>en(wr.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>en(wr.errorCodes.rpc.limitExceeded,e)};ts.providerErrors={userRejectedRequest:e=>ks(wr.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>ks(wr.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>ks(wr.errorCodes.provider.unsupportedMethod,e),disconnected:e=>ks(wr.errorCodes.provider.disconnected,e),chainDisconnected:e=>ks(wr.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new mh.EthereumProviderError(t,r,i)}};function en(e,t){const[r,i]=cw(t);return new mh.JsonRpcError(e,r??(0,fw.getMessageFromCode)(e),i)}function ks(e,t){const[r,i]=cw(t);return new mh.EthereumProviderError(e,r??(0,fw.getMessageFromCode)(e),i)}function cw(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t??void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorCodes=e.providerErrors=e.rpcErrors=e.getMessageFromCode=e.serializeError=e.serializeCause=e.EthereumProviderError=e.JsonRpcError=void 0;var t=lo;Object.defineProperty(e,"JsonRpcError",{enumerable:!0,get:function(){return t.JsonRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});var r=wf;Object.defineProperty(e,"serializeCause",{enumerable:!0,get:function(){return r.serializeCause}}),Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});var i=ts;Object.defineProperty(e,"rpcErrors",{enumerable:!0,get:function(){return i.rpcErrors}}),Object.defineProperty(e,"providerErrors",{enumerable:!0,get:function(){return i.providerErrors}});var s=Pi;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})})(kP);var vh={exports:{}},mB=lw;function lw(e,t){if(e&&t)return lw(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(i){r[i]=e[i]}),r;function r(){for(var i=new Array(arguments.length),s=0;s0;return xB(s,f,c,function(d){r||(r=d),d&&i.forEach(I_),!f&&(i.forEach(I_),t(r))})});return e.reduce($B)},MB=DB;const T_=po(MB);var Rn={},Ci={};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.EthereumProviderError=Ci.EthereumRpcError=void 0;const UB=fh;class _w extends Error{constructor(t,r,i){if(!Number.isInteger(t))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=t,i!==void 0&&(this.data=i)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return UB.default(this.serialize(),jB,2)}}Ci.EthereumRpcError=_w;class kB extends _w{constructor(t,r,i){if(!FB(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,i)}}Ci.EthereumProviderError=kB;function FB(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function jB(e,t){if(t!=="[Circular]")return t}var Sh={},Bi={};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.errorValues=Bi.errorCodes=void 0;Bi.errorCodes={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}};Bi.errorValues={"-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."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Bi,r=Ci,i=t.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",a={code:i,message:f(i)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function f(A,R=s){if(Number.isInteger(A)){const D=A.toString();if(y(t.errorValues,D))return t.errorValues[D].message;if(l(A))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return R}e.getMessageFromCode=f;function c(A){if(!Number.isInteger(A))return!1;const R=A.toString();return!!(t.errorValues[R]||l(A))}e.isValidCode=c;function d(A,{fallbackError:R=a,shouldIncludeStack:D=!1}={}){var ie,Z;if(!R||!Number.isInteger(R.code)||typeof R.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(A instanceof r.EthereumRpcError)return A.serialize();const J={};if(A&&typeof A=="object"&&!Array.isArray(A)&&y(A,"code")&&c(A.code)){const te=A;J.code=te.code,te.message&&typeof te.message=="string"?(J.message=te.message,y(te,"data")&&(J.data=te.data)):(J.message=f(J.code),J.data={originalError:h(A)})}else{J.code=R.code;const te=(ie=A)===null||ie===void 0?void 0:ie.message;J.message=te&&typeof te=="string"?te:R.message,J.data={originalError:h(A)}}const E=(Z=A)===null||Z===void 0?void 0:Z.stack;return D&&A&&E&&typeof E=="string"&&(J.stack=E),J}e.serializeError=d;function l(A){return A>=-32099&&A<=-32e3}function h(A){return A&&typeof A=="object"&&!Array.isArray(A)?Object.assign({},A):A}function y(A,R){return Object.prototype.hasOwnProperty.call(A,R)}})(Sh);var vf={};Object.defineProperty(vf,"__esModule",{value:!0});vf.ethErrors=void 0;const Rh=Ci,bw=Sh,yr=Bi;vf.ethErrors={rpc:{parse:e=>tn(yr.errorCodes.rpc.parse,e),invalidRequest:e=>tn(yr.errorCodes.rpc.invalidRequest,e),invalidParams:e=>tn(yr.errorCodes.rpc.invalidParams,e),methodNotFound:e=>tn(yr.errorCodes.rpc.methodNotFound,e),internal:e=>tn(yr.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return tn(t,e)},invalidInput:e=>tn(yr.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>tn(yr.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>tn(yr.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>tn(yr.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>tn(yr.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>tn(yr.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Fs(yr.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Fs(yr.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Fs(yr.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Fs(yr.errorCodes.provider.disconnected,e),chainDisconnected:e=>Fs(yr.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Rh.EthereumProviderError(t,r,i)}}};function tn(e,t){const[r,i]=yw(t);return new Rh.EthereumRpcError(e,r||bw.getMessageFromCode(e),i)}function Fs(e,t){const[r,i]=yw(t);return new Rh.EthereumProviderError(e,r||bw.getMessageFromCode(e),i)}function yw(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Ci;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Sh;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const i=vf;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return i.ethErrors}});const s=Bi;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})})(Rn);var qB=HB;function HB(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const zB=po(qB);var WB={},Ef={},Sf={},ww={},rs={},Rf={},ur={};Object.defineProperty(ur,"__esModule",{value:!0});ur.output=ur.exists=ur.hash=ur.bytes=ur.bool=ur.number=void 0;function zu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}ur.number=zu;function mw(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}ur.bool=mw;function Ah(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}ur.bytes=Ah;function vw(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");zu(e.outputLen),zu(e.blockLen)}ur.hash=vw;function Ew(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}ur.exists=Ew;function Sw(e,t){Ah(e);const r=t.outputLen;if(e.lengthF instanceof Uint8Array,i=F=>new Uint8Array(F.buffer,F.byteOffset,F.byteLength);e.u8=i;const s=F=>new Uint32Array(F.buffer,F.byteOffset,Math.floor(F.byteLength/4));e.u32=s;const a=F=>new DataView(F.buffer,F.byteOffset,F.byteLength);e.createView=a;const f=(F,G)=>F<<32-G|F>>>G;if(e.rotr=f,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const c=Array.from({length:256},(F,G)=>G.toString(16).padStart(2,"0"));function d(F){if(!r(F))throw new Error("Uint8Array expected");let G="";for(let m=0;m{};e.nextTick=h;async function y(F,G,m){let S=Date.now();for(let w=0;w=0&&kS+w.length,0));let m=0;return F.forEach(S=>{if(!r(S))throw new Error("Uint8Array expected");G.set(S,m),m+=S.length}),G}e.concatBytes=D;class ie{clone(){return this._cloneInto()}}e.Hash=ie;const Z=F=>Object.prototype.toString.call(F)==="[object Object]"&&F.constructor===Object;function J(F,G){if(G!==void 0&&(typeof G!="object"||!Z(G)))throw new Error("Options should be object or undefined");return Object.assign(F,G)}e.checkOpts=J;function E(F){const G=S=>F().update(R(S)).digest(),m=F();return G.outputLen=m.outputLen,G.blockLen=m.blockLen,G.create=()=>F(),G}e.wrapConstructor=E;function te(F){const G=(S,w)=>F(w).update(R(S)).digest(),m=F({});return G.outputLen=m.outputLen,G.blockLen=m.blockLen,G.create=S=>F(S),G}e.wrapConstructorWithOpts=te;function q(F){const G=(S,w)=>F(w).update(R(S)).digest(),m=F({});return G.outputLen=m.outputLen,G.blockLen=m.blockLen,G.create=S=>F(S),G}e.wrapXOFConstructorWithOpts=q;function W(F=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(F));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=W})(li);Object.defineProperty(Rf,"__esModule",{value:!0});Rf.SHA2=void 0;const jl=ur,js=li;function VB(e,t,r,i){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,i);const s=BigInt(32),a=BigInt(4294967295),f=Number(r>>s&a),c=Number(r&a),d=i?4:0,l=i?0:4;e.setUint32(t+d,f,i),e.setUint32(t+l,c,i)}class ZB extends js.Hash{constructor(t,r,i,s){super(),this.blockLen=t,this.outputLen=r,this.padOffset=i,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,js.createView)(this.buffer)}update(t){jl.default.exists(this);const{view:r,buffer:i,blockLen:s}=this;t=(0,js.toBytes)(t);const a=t.length;for(let f=0;fs-f&&(this.process(i,0),f=0);for(let y=f;yh.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;ye&t^~e&r,XB=(e,t,r)=>e&t^e&r^t&r,YB=new Uint32Array([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]),Ii=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ti=new Uint32Array(64);class Rw extends KB.SHA2{constructor(){super(64,32,8,!1),this.A=Ii[0]|0,this.B=Ii[1]|0,this.C=Ii[2]|0,this.D=Ii[3]|0,this.E=Ii[4]|0,this.F=Ii[5]|0,this.G=Ii[6]|0,this.H=Ii[7]|0}get(){const{A:t,B:r,C:i,D:s,E:a,F:f,G:c,H:d}=this;return[t,r,i,s,a,f,c,d]}set(t,r,i,s,a,f,c,d){this.A=t|0,this.B=r|0,this.C=i|0,this.D=s|0,this.E=a|0,this.F=f|0,this.G=c|0,this.H=d|0}process(t,r){for(let y=0;y<16;y++,r+=4)Ti[y]=t.getUint32(r,!1);for(let y=16;y<64;y++){const A=Ti[y-15],R=Ti[y-2],D=(0,sn.rotr)(A,7)^(0,sn.rotr)(A,18)^A>>>3,ie=(0,sn.rotr)(R,17)^(0,sn.rotr)(R,19)^R>>>10;Ti[y]=ie+Ti[y-7]+D+Ti[y-16]|0}let{A:i,B:s,C:a,D:f,E:c,F:d,G:l,H:h}=this;for(let y=0;y<64;y++){const A=(0,sn.rotr)(c,6)^(0,sn.rotr)(c,11)^(0,sn.rotr)(c,25),R=h+A+JB(c,d,l)+YB[y]+Ti[y]|0,ie=((0,sn.rotr)(i,2)^(0,sn.rotr)(i,13)^(0,sn.rotr)(i,22))+XB(i,s,a)|0;h=l,l=d,d=c,c=f+R|0,f=a,a=s,s=i,i=R+ie|0}i=i+this.A|0,s=s+this.B|0,a=a+this.C|0,f=f+this.D|0,c=c+this.E|0,d=d+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(i,s,a,f,c,d,l,h)}roundClean(){Ti.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class QB extends Rw{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}rs.sha256=(0,sn.wrapConstructor)(()=>new Rw);rs.sha224=(0,sn.wrapConstructor)(()=>new QB);var bt={},ot={};Object.defineProperty(ot,"__esModule",{value:!0});ot.validateObject=ot.createHmacDrbg=ot.bitMask=ot.bitSet=ot.bitGet=ot.bitLen=ot.utf8ToBytes=ot.equalBytes=ot.concatBytes=ot.ensureBytes=ot.numberToVarBytesBE=ot.numberToBytesLE=ot.numberToBytesBE=ot.bytesToNumberLE=ot.bytesToNumberBE=ot.hexToBytes=ot.hexToNumber=ot.numberToHexUnpadded=ot.bytesToHex=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Aw=BigInt(0),If=BigInt(1),ex=BigInt(2),Tf=e=>e instanceof Uint8Array,tx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ih(e){if(!Tf(e))throw new Error("Uint8Array expected");let t="";for(let r=0;ri+s.length,0));let r=0;return e.forEach(i=>{if(!Tf(i))throw new Error("Uint8Array expected");t.set(i,r),r+=i.length}),t}ot.concatBytes=Ow;function ax(e,t){if(e.length!==t.length)return!1;for(let r=0;rAw;e>>=If,t+=1);return t}ot.bitLen=fx;function cx(e,t){return e>>BigInt(t)&If}ot.bitGet=cx;const lx=(e,t,r)=>e|(r?If:Aw)<(ex<new Uint8Array(e),O_=e=>Uint8Array.from(e);function hx(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let i=ql(e),s=ql(e),a=0;const f=()=>{i.fill(1),s.fill(0),a=0},c=(...y)=>r(s,i,...y),d=(y=ql())=>{s=c(O_([0]),y),i=c(),y.length!==0&&(s=c(O_([1]),y),i=c())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const A=[];for(;y{f(),d(y);let R;for(;!(R=A(l()));)d();return f(),R}}ot.createHmacDrbg=hx;const gx={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function px(e,t,r={}){const i=(s,a,f)=>{const c=gx[a];if(typeof c!="function")throw new Error(`Invalid validator "${a}", expected function`);const d=e[s];if(!(f&&d===void 0)&&!c(d,e))throw new Error(`Invalid param ${String(s)}=${d} (${typeof d}), expected ${a}`)};for(const[s,a]of Object.entries(t))i(s,a,!1);for(const[s,a]of Object.entries(r))i(s,a,!0);return e}ot.validateObject=px;Object.defineProperty(bt,"__esModule",{value:!0});bt.hashToPrivateScalar=bt.FpSqrtEven=bt.FpSqrtOdd=bt.Field=bt.nLength=bt.FpIsSquare=bt.FpDiv=bt.FpInvertBatch=bt.FpPow=bt.validateField=bt.isNegativeLE=bt.FpSqrt=bt.tonelliShanks=bt.invert=bt.pow2=bt.pow=bt.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ui=ot,fr=BigInt(0),Ht=BigInt(1),Li=BigInt(2),_x=BigInt(3),Od=BigInt(4),N_=BigInt(5),L_=BigInt(8);BigInt(9);BigInt(16);function an(e,t){const r=e%t;return r>=fr?r:t+r}bt.mod=an;function Nw(e,t,r){if(r<=fr||t 0");if(r===Ht)return fr;let i=Ht;for(;t>fr;)t&Ht&&(i=i*e%r),e=e*e%r,t>>=Ht;return i}bt.pow=Nw;function bx(e,t,r){let i=e;for(;t-- >fr;)i*=i,i%=r;return i}bt.pow2=bx;function Wu(e,t){if(e===fr||t<=fr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=an(e,t),i=t,s=fr,a=Ht;for(;r!==fr;){const c=i/r,d=i%r,l=s-a*c;i=r,r=d,s=a,a=l}if(i!==Ht)throw new Error("invert: does not exist");return an(s,t)}bt.invert=Wu;function Lw(e){const t=(e-Ht)/Li;let r,i,s;for(r=e-Ht,i=0;r%Li===fr;r/=Li,i++);for(s=Li;s(an(e,t)&Ht)===Ht;bt.isNegativeLE=yx;const wx=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mx(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=wx.reduce((i,s)=>(i[s]="function",i),t);return(0,ui.validateObject)(e,r)}bt.validateField=mx;function Cw(e,t,r){if(r 0");if(r===fr)return e.ONE;if(r===Ht)return t;let i=e.ONE,s=t;for(;r>fr;)r&Ht&&(i=e.mul(i,s)),s=e.sqr(s),r>>=Ht;return i}bt.FpPow=Cw;function Bw(e,t){const r=new Array(t.length),i=t.reduce((a,f,c)=>e.is0(f)?a:(r[c]=a,e.mul(a,f)),e.ONE),s=e.inv(i);return t.reduceRight((a,f,c)=>e.is0(f)?a:(r[c]=e.mul(a,r[c]),e.mul(a,f)),s),r}bt.FpInvertBatch=Bw;function vx(e,t,r){return e.mul(t,typeof r=="bigint"?Wu(r,e.ORDER):e.inv(r))}bt.FpDiv=vx;function Ex(e){const t=(e.ORDER-Ht)/Li;return r=>{const i=e.pow(r,t);return e.eql(i,e.ZERO)||e.eql(i,e.ONE)}}bt.FpIsSquare=Ex;function Oh(e,t){const r=t!==void 0?t:e.toString(2).length,i=Math.ceil(r/8);return{nBitLength:r,nByteLength:i}}bt.nLength=Oh;function Sx(e,t,r=!1,i={}){if(e<=fr)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:a}=Oh(e,t);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const f=Pw(e),c=Object.freeze({ORDER:e,BITS:s,BYTES:a,MASK:(0,ui.bitMask)(s),ZERO:fr,ONE:Ht,create:d=>an(d,e),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return fr<=d&&dd===fr,isOdd:d=>(d&Ht)===Ht,neg:d=>an(-d,e),eql:(d,l)=>d===l,sqr:d=>an(d*d,e),add:(d,l)=>an(d+l,e),sub:(d,l)=>an(d-l,e),mul:(d,l)=>an(d*l,e),pow:(d,l)=>Cw(c,d,l),div:(d,l)=>an(d*Wu(l,e),e),sqrN:d=>d*d,addN:(d,l)=>d+l,subN:(d,l)=>d-l,mulN:(d,l)=>d*l,inv:d=>Wu(d,e),sqrt:i.sqrt||(d=>f(c,d)),invertBatch:d=>Bw(c,d),cmov:(d,l,h)=>h?l:d,toBytes:d=>r?(0,ui.numberToBytesLE)(d,a):(0,ui.numberToBytesBE)(d,a),fromBytes:d=>{if(d.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${d.length}`);return r?(0,ui.bytesToNumberLE)(d):(0,ui.bytesToNumberBE)(d)}});return Object.freeze(c)}bt.Field=Sx;function Rx(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)}bt.FpSqrtOdd=Rx;function Ax(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}bt.FpSqrtEven=Ax;function Ix(e,t,r=!1){e=(0,ui.ensureBytes)("privateHash",e);const i=e.length,s=Oh(t).nByteLength+8;if(s<24||i1024)throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${i}`);const a=r?(0,ui.bytesToNumberLE)(e):(0,ui.bytesToNumberBE)(e);return an(a,t-Ht)+Ht}bt.hashToPrivateScalar=Ix;var Nh={},ns={};Object.defineProperty(ns,"__esModule",{value:!0});ns.validateBasic=ns.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const P_=bt,Tx=ot,Ox=BigInt(0),Hl=BigInt(1);function Nx(e,t){const r=(s,a)=>{const f=a.negate();return s?f:a},i=s=>{const a=Math.ceil(t/s)+1,f=2**(s-1);return{windows:a,windowSize:f}};return{constTimeNegate:r,unsafeLadder(s,a){let f=e.ZERO,c=s;for(;a>Ox;)a&Hl&&(f=f.add(c)),c=c.double(),a>>=Hl;return f},precomputeWindow(s,a){const{windows:f,windowSize:c}=i(a),d=[];let l=s,h=l;for(let y=0;y>=R,Z>d&&(Z-=A,f+=Hl);const J=ie,E=ie+Math.abs(Z)-1,te=D%2!==0,q=Z<0;Z===0?h=h.add(r(te,a[J])):l=l.add(r(q,a[E]))}return{p:l,f:h}},wNAFCached(s,a,f,c){const d=s._WINDOW_SIZE||1;let l=a.get(s);return l||(l=this.precomputeWindow(s,d),d!==1&&a.set(s,c(l))),this.wNAF(d,l,f)}}}ns.wNAF=Nx;function Lx(e){return(0,P_.validateField)(e.Fp),(0,Tx.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,P_.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}ns.validateBasic=Lx;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapToCurveSimpleSWU=e.SWUFpSqrtRatio=e.weierstrass=e.weierstrassPoints=e.DER=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=bt,r=ot,i=ot,s=ns;function a(E){const te=(0,s.validateBasic)(E);r.validateObject(te,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:q,Fp:W,a:F}=te;if(q){if(!W.eql(F,W.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof q!="object"||typeof q.beta!="bigint"||typeof q.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...te})}const{bytesToNumberBE:f,hexToBytes:c}=r;e.DER={Err:class extends Error{constructor(te=""){super(te)}},_parseInt(E){const{Err:te}=e.DER;if(E.length<2||E[0]!==2)throw new te("Invalid signature integer tag");const q=E[1],W=E.subarray(2,q+2);if(!q||W.length!==q)throw new te("Invalid signature integer: wrong length");if(W[0]&128)throw new te("Invalid signature integer: negative");if(W[0]===0&&!(W[1]&128))throw new te("Invalid signature integer: unnecessary leading zero");return{d:f(W),l:E.subarray(q+2)}},toSig(E){const{Err:te}=e.DER,q=typeof E=="string"?c(E):E;if(!(q instanceof Uint8Array))throw new Error("ui8a expected");let W=q.length;if(W<2||q[0]!=48)throw new te("Invalid signature tag");if(q[1]!==W-2)throw new te("Invalid signature: incorrect length");const{d:F,l:G}=e.DER._parseInt(q.subarray(2)),{d:m,l:S}=e.DER._parseInt(G);if(S.length)throw new te("Invalid signature: left bytes after parsing");return{r:F,s:m}},hexFromSig(E){const te=k=>Number.parseInt(k[0],16)&8?"00"+k:k,q=k=>{const _=k.toString(16);return _.length&1?`0${_}`:_},W=te(q(E.s)),F=te(q(E.r)),G=W.length/2,m=F.length/2,S=q(G),w=q(m);return`30${q(m+G+4)}02${w}${F}02${S}${W}`}};const d=BigInt(0),l=BigInt(1),h=BigInt(2),y=BigInt(3),A=BigInt(4);function R(E){const te=a(E),{Fp:q}=te,W=te.toBytes||((B,C,x)=>{const O=C.toAffine();return r.concatBytes(Uint8Array.from([4]),q.toBytes(O.x),q.toBytes(O.y))}),F=te.fromBytes||(B=>{const C=B.subarray(1),x=q.fromBytes(C.subarray(0,q.BYTES)),O=q.fromBytes(C.subarray(q.BYTES,2*q.BYTES));return{x,y:O}});function G(B){const{a:C,b:x}=te,O=q.sqr(B),L=q.mul(O,B);return q.add(q.add(L,q.mul(B,C)),x)}if(!q.eql(q.sqr(te.Gy),G(te.Gx)))throw new Error("bad generator point: equation left != right");function m(B){return typeof B=="bigint"&&dq.eql(X,q.ZERO);return L(x)&&L(O)?b.ZERO:new b(x,O,q.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const x=q.invertBatch(C.map(O=>O.pz));return C.map((O,L)=>O.toAffine(x[L])).map(b.fromAffine)}static fromHex(C){const x=b.fromAffine(F((0,i.ensureBytes)("pointHex",C)));return x.assertValidity(),x}static fromPrivateKey(C){return b.BASE.multiply(w(C))}_setWindowSize(C){this._WINDOW_SIZE=C,k.delete(this)}assertValidity(){if(this.is0()){if(te.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:C,y:x}=this.toAffine();if(!q.isValid(C)||!q.isValid(x))throw new Error("bad point: x or y not FE");const O=q.sqr(x),L=G(C);if(!q.eql(O,L))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:C}=this.toAffine();if(q.isOdd)return!q.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){_(C);const{px:x,py:O,pz:L}=this,{px:X,py:re,pz:fe}=C,_e=q.eql(q.mul(x,fe),q.mul(X,L)),be=q.eql(q.mul(O,fe),q.mul(re,L));return _e&&be}negate(){return new b(this.px,q.neg(this.py),this.pz)}double(){const{a:C,b:x}=te,O=q.mul(x,y),{px:L,py:X,pz:re}=this;let fe=q.ZERO,_e=q.ZERO,be=q.ZERO,ye=q.mul(L,L),oe=q.mul(X,X),K=q.mul(re,re),Q=q.mul(L,X);return Q=q.add(Q,Q),be=q.mul(L,re),be=q.add(be,be),fe=q.mul(C,be),_e=q.mul(O,K),_e=q.add(fe,_e),fe=q.sub(oe,_e),_e=q.add(oe,_e),_e=q.mul(fe,_e),fe=q.mul(Q,fe),be=q.mul(O,be),K=q.mul(C,K),Q=q.sub(ye,K),Q=q.mul(C,Q),Q=q.add(Q,be),be=q.add(ye,ye),ye=q.add(be,ye),ye=q.add(ye,K),ye=q.mul(ye,Q),_e=q.add(_e,ye),K=q.mul(X,re),K=q.add(K,K),ye=q.mul(K,Q),fe=q.sub(fe,ye),be=q.mul(K,oe),be=q.add(be,be),be=q.add(be,be),new b(fe,_e,be)}add(C){_(C);const{px:x,py:O,pz:L}=this,{px:X,py:re,pz:fe}=C;let _e=q.ZERO,be=q.ZERO,ye=q.ZERO;const oe=te.a,K=q.mul(te.b,y);let Q=q.mul(x,X),pe=q.mul(O,re),Oe=q.mul(L,fe),Le=q.add(x,O),z=q.add(X,re);Le=q.mul(Le,z),z=q.add(Q,pe),Le=q.sub(Le,z),z=q.add(x,L);let V=q.add(X,fe);return z=q.mul(z,V),V=q.add(Q,Oe),z=q.sub(z,V),V=q.add(O,L),_e=q.add(re,fe),V=q.mul(V,_e),_e=q.add(pe,Oe),V=q.sub(V,_e),ye=q.mul(oe,z),_e=q.mul(K,Oe),ye=q.add(_e,ye),_e=q.sub(pe,ye),ye=q.add(pe,ye),be=q.mul(_e,ye),pe=q.add(Q,Q),pe=q.add(pe,Q),Oe=q.mul(oe,Oe),z=q.mul(K,z),pe=q.add(pe,Oe),Oe=q.sub(Q,Oe),Oe=q.mul(oe,Oe),z=q.add(z,Oe),Q=q.mul(pe,z),be=q.add(be,Q),Q=q.mul(V,z),_e=q.mul(Le,_e),_e=q.sub(_e,Q),Q=q.mul(Le,pe),ye=q.mul(V,ye),ye=q.add(ye,Q),new b(_e,be,ye)}subtract(C){return this.add(C.negate())}is0(){return this.equals(b.ZERO)}wNAF(C){return T.wNAFCached(this,k,C,x=>{const O=q.invertBatch(x.map(L=>L.pz));return x.map((L,X)=>L.toAffine(O[X])).map(b.fromAffine)})}multiplyUnsafe(C){const x=b.ZERO;if(C===d)return x;if(S(C),C===l)return this;const{endo:O}=te;if(!O)return T.unsafeLadder(this,C);let{k1neg:L,k1:X,k2neg:re,k2:fe}=O.splitScalar(C),_e=x,be=x,ye=this;for(;X>d||fe>d;)X&l&&(_e=_e.add(ye)),fe&l&&(be=be.add(ye)),ye=ye.double(),X>>=l,fe>>=l;return L&&(_e=_e.negate()),re&&(be=be.negate()),be=new b(q.mul(be.px,O.beta),be.py,be.pz),_e.add(be)}multiply(C){S(C);let x=C,O,L;const{endo:X}=te;if(X){const{k1neg:re,k1:fe,k2neg:_e,k2:be}=X.splitScalar(x);let{p:ye,f:oe}=this.wNAF(fe),{p:K,f:Q}=this.wNAF(be);ye=T.constTimeNegate(re,ye),K=T.constTimeNegate(_e,K),K=new b(q.mul(K.px,X.beta),K.py,K.pz),O=ye.add(K),L=oe.add(Q)}else{const{p:re,f:fe}=this.wNAF(x);O=re,L=fe}return b.normalizeZ([O,L])[0]}multiplyAndAddUnsafe(C,x,O){const L=b.BASE,X=(fe,_e)=>_e===d||_e===l||!fe.equals(L)?fe.multiplyUnsafe(_e):fe.multiply(_e),re=X(this,x).add(X(C,O));return re.is0()?void 0:re}toAffine(C){const{px:x,py:O,pz:L}=this,X=this.is0();C==null&&(C=X?q.ONE:q.inv(L));const re=q.mul(x,C),fe=q.mul(O,C),_e=q.mul(L,C);if(X)return{x:q.ZERO,y:q.ZERO};if(!q.eql(_e,q.ONE))throw new Error("invZ was invalid");return{x:re,y:fe}}isTorsionFree(){const{h:C,isTorsionFree:x}=te;if(C===l)return!0;if(x)return x(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:x}=te;return C===l?this:x?x(b,this):this.multiplyUnsafe(te.h)}toRawBytes(C=!0){return this.assertValidity(),W(b,this,C)}toHex(C=!0){return r.bytesToHex(this.toRawBytes(C))}}b.BASE=new b(te.Gx,te.Gy,q.ONE),b.ZERO=new b(q.ZERO,q.ONE,q.ZERO);const v=te.nBitLength,T=(0,s.wNAF)(b,te.endo?Math.ceil(v/2):v);return{CURVE:te,ProjectivePoint:b,normPrivateKeyToScalar:w,weierstrassEquation:G,isWithinCurveOrder:m}}e.weierstrassPoints=R;function D(E){const te=(0,s.validateBasic)(E);return r.validateObject(te,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...te})}function ie(E){const te=D(E),{Fp:q,n:W}=te,F=q.BYTES+1,G=2*q.BYTES+1;function m(z){return dr.bytesToHex(r.numberToBytesBE(z,te.nByteLength));function B(z){const V=W>>l;return z>V}function C(z){return B(z)?S(-z):z}const x=(z,V,ue)=>r.bytesToNumberBE(z.slice(V,ue));class O{constructor(V,ue,xe){this.r=V,this.s=ue,this.recovery=xe,this.assertValidity()}static fromCompact(V){const ue=te.nByteLength;return V=(0,i.ensureBytes)("compactSignature",V,ue*2),new O(x(V,0,ue),x(V,ue,2*ue))}static fromDER(V){const{r:ue,s:xe}=e.DER.toSig((0,i.ensureBytes)("DER",V));return new O(ue,xe)}assertValidity(){if(!v(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!v(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(V){return new O(this.r,this.s,V)}recoverPublicKey(V){const{r:ue,s:xe,recovery:Te}=this,Me=be((0,i.ensureBytes)("msgHash",V));if(Te==null||![0,1,2,3].includes(Te))throw new Error("recovery id invalid");const Ze=Te===2||Te===3?ue+te.n:ue;if(Ze>=q.ORDER)throw new Error("recovery id 2 or 3 invalid");const Qe=Te&1?"03":"02",Xe=k.fromHex(Qe+T(Ze)),it=w(Ze),et=S(-Me*it),ce=S(xe*it),I=k.BASE.multiplyAndAddUnsafe(Xe,et,ce);if(!I)throw new Error("point at infinify");return I.assertValidity(),I}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new O(this.r,S(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}const L={isValidPrivateKey(z){try{return _(z),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const z=te.randomBytes(q.BYTES+8),V=t.hashToPrivateScalar(z,W);return r.numberToBytesBE(V,te.nByteLength)},precompute(z=8,V=k.BASE){return V._setWindowSize(z),V.multiply(BigInt(3)),V}};function X(z,V=!0){return k.fromPrivateKey(z).toRawBytes(V)}function re(z){const V=z instanceof Uint8Array,ue=typeof z=="string",xe=(V||ue)&&z.length;return V?xe===F||xe===G:ue?xe===2*F||xe===2*G:z instanceof k}function fe(z,V,ue=!0){if(re(z))throw new Error("first arg must be private key");if(!re(V))throw new Error("second arg must be public key");return k.fromHex(V).multiply(_(z)).toRawBytes(ue)}const _e=te.bits2int||function(z){const V=r.bytesToNumberBE(z),ue=z.length*8-te.nBitLength;return ue>0?V>>BigInt(ue):V},be=te.bits2int_modN||function(z){return S(_e(z))},ye=r.bitMask(te.nBitLength);function oe(z){if(typeof z!="bigint")throw new Error("bigint expected");if(!(d<=z&&zwe in ue))throw new Error("sign() legacy options not supported");const{hash:xe,randomBytes:Te}=te;let{lowS:Me,prehash:Ze,extraEntropy:Qe}=ue;Me==null&&(Me=!0),z=(0,i.ensureBytes)("msgHash",z),Ze&&(z=(0,i.ensureBytes)("prehashed msgHash",xe(z)));const Xe=be(z),it=_(V),et=[oe(it),oe(Xe)];if(Qe!=null){const we=Qe===!0?Te(q.BYTES):Qe;et.push((0,i.ensureBytes)("extraEntropy",we,q.BYTES))}const ce=r.concatBytes(...et),I=Xe;function j(we){const ge=_e(we);if(!v(ge))return;const Ce=w(ge),je=k.BASE.multiply(ge).toAffine(),$=S(je.x);if($===d)return;const Se=S(Ce*S(I+$*it));if(Se===d)return;let Ne=(je.x===$?0:2)|Number(je.y&l),ke=Se;return Me&&B(Se)&&(ke=C(Se),Ne^=1),new O($,ke,Ne)}return{seed:ce,k2sig:j}}const Q={lowS:te.lowS,prehash:!1},pe={lowS:te.lowS,prehash:!1};function Oe(z,V,ue=Q){const{seed:xe,k2sig:Te}=K(z,V,ue),Me=te;return r.createHmacDrbg(Me.hash.outputLen,Me.nByteLength,Me.hmac)(xe,Te)}k.BASE._setWindowSize(8);function Le(z,V,ue,xe=pe){var je;const Te=z;if(V=(0,i.ensureBytes)("msgHash",V),ue=(0,i.ensureBytes)("publicKey",ue),"strict"in xe)throw new Error("options.strict was renamed to lowS");const{lowS:Me,prehash:Ze}=xe;let Qe,Xe;try{if(typeof Te=="string"||Te instanceof Uint8Array)try{Qe=O.fromDER(Te)}catch($){if(!($ instanceof e.DER.Err))throw $;Qe=O.fromCompact(Te)}else if(typeof Te=="object"&&typeof Te.r=="bigint"&&typeof Te.s=="bigint"){const{r:$,s:Se}=Te;Qe=new O($,Se)}else throw new Error("PARSE");Xe=k.fromHex(ue)}catch($){if($.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Me&&Qe.hasHighS())return!1;Ze&&(V=te.hash(V));const{r:it,s:et}=Qe,ce=be(V),I=w(et),j=S(ce*I),we=S(it*I),ge=(je=k.BASE.multiplyAndAddUnsafe(Xe,j,we))==null?void 0:je.toAffine();return ge?S(ge.x)===it:!1}return{CURVE:te,getPublicKey:X,getSharedSecret:fe,sign:Oe,verify:Le,ProjectivePoint:k,Signature:O,utils:L}}e.weierstrass=ie;function Z(E,te){const q=E.ORDER;let W=d;for(let B=q-l;B%h===d;B/=h)W+=l;const F=W,G=h<{let x=b,O=E.pow(C,k),L=E.sqr(O);L=E.mul(L,C);let X=E.mul(B,L);X=E.pow(X,w),X=E.mul(X,O),O=E.mul(X,C),L=E.mul(X,B);let re=E.mul(L,O);X=E.pow(re,_);let fe=E.eql(X,E.ONE);O=E.mul(L,v),X=E.mul(re,x),L=E.cmov(O,L,fe),re=E.cmov(X,re,fe);for(let _e=F;_e>l;_e--){let be=_e-h;be=h<{let L=E.sqr(O);const X=E.mul(x,O);L=E.mul(L,X);let re=E.pow(L,B);re=E.mul(re,X);const fe=E.mul(re,C),_e=E.mul(E.sqr(re),O),be=E.eql(_e,x);let ye=E.cmov(fe,re,be);return{isValid:be,value:ye}}}return T}e.SWUFpSqrtRatio=Z;function J(E,te){if(t.validateField(E),!E.isValid(te.A)||!E.isValid(te.B)||!E.isValid(te.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const q=Z(E,te.Z);if(!E.isOdd)throw new Error("Fp.isOdd is not implemented!");return W=>{let F,G,m,S,w,k,_,b;F=E.sqr(W),F=E.mul(F,te.Z),G=E.sqr(F),G=E.add(G,F),m=E.add(G,E.ONE),m=E.mul(m,te.B),S=E.cmov(te.Z,E.neg(G),!E.eql(G,E.ZERO)),S=E.mul(S,te.A),G=E.sqr(m),k=E.sqr(S),w=E.mul(k,te.A),G=E.add(G,w),G=E.mul(G,m),k=E.mul(k,S),w=E.mul(k,te.B),G=E.add(G,w),_=E.mul(F,m);const{isValid:v,value:T}=q(G,k);b=E.mul(F,W),b=E.mul(b,T),_=E.cmov(_,m,v),b=E.cmov(b,T,v);const B=E.isOdd(W)===E.isOdd(b);return b=E.cmov(E.neg(b),b,B),_=E.div(_,S),{x:_,y:b}}}e.mapToCurveSimpleSWU=J})(Nh);var un={};Object.defineProperty(un,"__esModule",{value:!0});un.createHasher=un.isogenyMap=un.hash_to_field=un.expand_message_xof=un.expand_message_xmd=void 0;const Px=bt,En=ot;function Cx(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return(0,En.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}const Bx=En.bytesToNumberBE;function Ni(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let i=t-1;i>=0;i--)r[i]=e&255,e>>>=8;return new Uint8Array(r)}function xx(e,t){const r=new Uint8Array(e.length);for(let i=0;i255&&(t=i((0,En.concatBytes)((0,En.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:s,blockLen:a}=i,f=Math.ceil(r/s);if(f>255)throw new Error("Invalid xmd length");const c=(0,En.concatBytes)(t,Ni(t.length,1)),d=Ni(0,a),l=Ni(r,2),h=new Array(f),y=i((0,En.concatBytes)(d,e,l,Ni(0,1),c));h[0]=i((0,En.concatBytes)(y,Ni(1,1),c));for(let R=1;R<=f;R++){const D=[xx(y,h[R-1]),Ni(R+1,1),c];h[R]=i((0,En.concatBytes)(...D))}return(0,En.concatBytes)(...h).slice(0,r)}un.expand_message_xmd=xw;function $w(e,t,r,i,s){if(ia(e),ia(t),Lh(r),t.length>255){const a=Math.ceil(2*i/8);t=s.create({dkLen:a}).update((0,En.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return s.create({dkLen:r}).update(e).update(Ni(r,2)).update(t).update(Ni(t.length,1)).digest()}un.expand_message_xof=$w;function Nd(e,t,r){(0,En.validateObject)(r,{DST:"string",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:i,k:s,m:a,hash:f,expand:c,DST:d}=r;ia(e),Lh(t);const l=Cx(d),h=i.toString(2).length,y=Math.ceil((h+s)/8),A=t*a*y;let R;if(c==="xmd")R=xw(e,l,A,f);else if(c==="xof")R=$w(e,l,A,s,f);else if(c==="_internal_pass")R=e;else throw new Error('expand must be "xmd" or "xof"');const D=new Array(t);for(let ie=0;ieArray.from(i).reverse());return(i,s)=>{const[a,f,c,d]=r.map(l=>l.reduce((h,y)=>e.add(e.mul(h,i),y)));return i=e.div(a,f),s=e.mul(s,e.div(c,d)),{x:i,y:s}}}un.isogenyMap=$x;function Dx(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(i,s){const a=Nd(i,2,{...r,DST:r.DST,...s}),f=e.fromAffine(t(a[0])),c=e.fromAffine(t(a[1])),d=f.add(c).clearCofactor();return d.assertValidity(),d},encodeToCurve(i,s){const a=Nd(i,1,{...r,DST:r.encodeDST,...s}),f=e.fromAffine(t(a[0])).clearCofactor();return f.assertValidity(),f}}}un.createHasher=Dx;var is={},Dw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=ur,r=li;class i extends r.Hash{constructor(f,c){super(),this.finished=!1,this.destroyed=!1,t.default.hash(f);const d=(0,r.toBytes)(c);if(this.iHash=f.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 l=this.blockLen,h=new Uint8Array(l);h.set(d.length>l?f.create().update(d).digest():d);for(let y=0;ynew i(a,f).update(c).digest();e.hmac=s,e.hmac.create=(a,f)=>new i(a,f)})(Dw);Object.defineProperty(is,"__esModule",{value:!0});is.createCurve=is.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mx=Dw,C_=li,Ux=Nh;function Mw(e){return{hash:e,hmac:(t,...r)=>(0,Mx.hmac)(e,t,(0,C_.concatBytes)(...r)),randomBytes:C_.randomBytes}}is.getHash=Mw;function kx(e,t){const r=i=>(0,Ux.weierstrass)({...e,...Mw(i)});return Object.freeze({...r(t),create:r})}is.createCurve=kx;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=rs,r=li,i=bt,s=Nh,a=ot,f=un,c=is,d=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h=BigInt(1),y=BigInt(2),A=(O,L)=>(O+L/y)/L;function R(O){const L=d,X=BigInt(3),re=BigInt(6),fe=BigInt(11),_e=BigInt(22),be=BigInt(23),ye=BigInt(44),oe=BigInt(88),K=O*O*O%L,Q=K*K*O%L,pe=(0,i.pow2)(Q,X,L)*Q%L,Oe=(0,i.pow2)(pe,X,L)*Q%L,Le=(0,i.pow2)(Oe,y,L)*K%L,z=(0,i.pow2)(Le,fe,L)*Le%L,V=(0,i.pow2)(z,_e,L)*z%L,ue=(0,i.pow2)(V,ye,L)*V%L,xe=(0,i.pow2)(ue,oe,L)*ue%L,Te=(0,i.pow2)(xe,ye,L)*V%L,Me=(0,i.pow2)(Te,X,L)*Q%L,Ze=(0,i.pow2)(Me,be,L)*z%L,Qe=(0,i.pow2)(Ze,re,L)*K%L,Xe=(0,i.pow2)(Qe,y,L);if(!D.eql(D.sqr(Xe),O))throw new Error("Cannot find square root");return Xe}const D=(0,i.Field)(d,void 0,void 0,{sqrt:R});e.secp256k1=(0,c.createCurve)({a:BigInt(0),b:BigInt(7),Fp:D,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:O=>{const L=l,X=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),re=-h*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),fe=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),_e=X,be=BigInt("0x100000000000000000000000000000000"),ye=A(_e*O,L),oe=A(-re*O,L);let K=(0,i.mod)(O-ye*X-oe*fe,L),Q=(0,i.mod)(-ye*re-oe*_e,L);const pe=K>be,Oe=Q>be;if(pe&&(K=L-K),Oe&&(Q=L-Q),K>be||Q>be)throw new Error("splitScalar: Endomorphism failed, k="+O);return{k1neg:pe,k1:K,k2neg:Oe,k2:Q}}}},t.sha256);const ie=BigInt(0),Z=O=>typeof O=="bigint"&&ietypeof O=="bigint"&&iefe.charCodeAt(0)));X=(0,a.concatBytes)(re,re),E[O]=X}return(0,t.sha256)((0,a.concatBytes)(X,...L))}const q=O=>O.toRawBytes(!0).slice(1),W=O=>(0,a.numberToBytesBE)(O,32),F=O=>(0,i.mod)(O,d),G=O=>(0,i.mod)(O,l),m=e.secp256k1.ProjectivePoint,S=(O,L,X)=>m.BASE.multiplyAndAddUnsafe(O,L,X);function w(O){let L=e.secp256k1.utils.normPrivateKeyToScalar(O),X=m.fromPrivateKey(L);return{scalar:X.hasEvenY()?L:G(-L),bytes:q(X)}}function k(O){if(!Z(O))throw new Error("bad x: need 0 < x < p");const L=F(O*O),X=F(L*O+BigInt(7));let re=R(X);re%y!==ie&&(re=F(-re));const fe=new m(O,re,h);return fe.assertValidity(),fe}function _(...O){return G((0,a.bytesToNumberBE)(te("BIP0340/challenge",...O)))}function b(O){return w(O).bytes}function v(O,L,X=(0,r.randomBytes)(32)){const re=(0,a.ensureBytes)("message",O),{bytes:fe,scalar:_e}=w(L),be=(0,a.ensureBytes)("auxRand",X,32),ye=W(_e^(0,a.bytesToNumberBE)(te("BIP0340/aux",be))),oe=te("BIP0340/nonce",ye,fe,re),K=G((0,a.bytesToNumberBE)(oe));if(K===ie)throw new Error("sign failed: k is zero");const{bytes:Q,scalar:pe}=w(K),Oe=_(Q,fe,re),Le=new Uint8Array(64);if(Le.set(Q,0),Le.set(W(G(pe+Oe*_e)),32),!T(Le,re,fe))throw new Error("sign: Invalid signature produced");return Le}function T(O,L,X){const re=(0,a.ensureBytes)("signature",O,64),fe=(0,a.ensureBytes)("message",L),_e=(0,a.ensureBytes)("publicKey",X,32);try{const be=k((0,a.bytesToNumberBE)(_e)),ye=(0,a.bytesToNumberBE)(re.subarray(0,32));if(!Z(ye))return!1;const oe=(0,a.bytesToNumberBE)(re.subarray(32,64));if(!J(oe))return!1;const K=_(W(ye),q(be),fe),Q=S(be,oe,G(-K));return!(!Q||!Q.hasEvenY()||Q.toAffine().x!==ye)}catch{return!1}}e.schnorr=(()=>({getPublicKey:b,sign:v,verify:T,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:k,pointToBytes:q,numberToBytesBE:a.numberToBytesBE,bytesToNumberBE:a.bytesToNumberBE,taggedHash:te,mod:i.mod}}))();const B=(()=>(0,f.isogenyMap)(D,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(O=>O.map(L=>BigInt(L)))))(),C=(()=>(0,s.mapToCurveSimpleSWU)(D,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:D.create(BigInt("-11"))}))(),x=(()=>(0,f.createHasher)(e.secp256k1.ProjectivePoint,O=>{const{x:L,y:X}=C(D.create(O[0]));return B(L,X)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:D.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=(()=>x.hashToCurve)(),e.encodeToCurve=(()=>x.encodeToCurve)()})(ww);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=ww;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})})(Sf);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=qn,r=Sf;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16})(Ef);var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0});Nf.GWEI_TO_WEI=void 0;Nf.GWEI_TO_WEI=BigInt(1e9);var Ph={},Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.RLP=Un.utils=Un.decode=Un.encode=void 0;function Ch(e){if(Array.isArray(e)){const r=[];let i=0;for(let s=0;se.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function B_(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return Fw(kw(e))}function x_(e,t){if(e<56)return Uint8Array.from([e+t]);const r=Cd(e),i=r.length/2,s=Cd(t+55+i);return Uint8Array.from(Gu(s+r))}function Uw(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=Hw(e),i=Ld(r);if(t)return i;if(i.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return i.data}Un.decode=Uw;function Ld(e){let t,r,i,s,a;const f=[],c=e[0];if(c<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(c<=183){if(t=c-127,c===128?i=Uint8Array.from([]):i=zo(e,1,t),t===2&&i[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:i,remainder:e.slice(t)}}else if(c<=191){if(r=c-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(s=zo(e,r,d);s.length;)a=Ld(s),f.push(a.data),s=a.remainder;return{data:f,remainder:e.slice(d)}}}const Fx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function kw(e){let t="";for(let r=0;ri+s.length,0),r=new Uint8Array(t);for(let i=0,s=0;i=2&&e[0]==="0"&&e[1]==="x"}function qx(e){return typeof e!="string"?e:qw(e)?e.slice(2):e}function Hw(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return qw(e)?Gu(jx(qx(e))):jw(e);if(typeof e=="number"||typeof e=="bigint")return e?Gu(Cd(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}Un.utils={bytesToHex:kw,concatBytes:Pd,hexToBytes:Gu,utf8ToBytes:jw};Un.RLP={encode:Ch,decode:Uw};var Sn={},Dt={},zw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.add=e.toBig=e.split=e.fromBig=void 0;const t=BigInt(2**32-1),r=BigInt(32);function i(w,k=!1){return k?{h:Number(w&t),l:Number(w>>r&t)}:{h:Number(w>>r&t)|0,l:Number(w&t)|0}}e.fromBig=i;function s(w,k=!1){let _=new Uint32Array(w.length),b=new Uint32Array(w.length);for(let v=0;vBigInt(w>>>0)<>>0);e.toBig=a;const f=(w,k,_)=>w>>>_,c=(w,k,_)=>w<<32-_|k>>>_,d=(w,k,_)=>w>>>_|k<<32-_,l=(w,k,_)=>w<<32-_|k>>>_,h=(w,k,_)=>w<<64-_|k>>>_-32,y=(w,k,_)=>w>>>_-32|k<<64-_,A=(w,k)=>k,R=(w,k)=>w,D=(w,k,_)=>w<<_|k>>>32-_,ie=(w,k,_)=>k<<_|w>>>32-_,Z=(w,k,_)=>k<<_-32|w>>>64-_,J=(w,k,_)=>w<<_-32|k>>>64-_;function E(w,k,_,b){const v=(k>>>0)+(b>>>0);return{h:w+_+(v/2**32|0)|0,l:v|0}}e.add=E;const te=(w,k,_)=>(w>>>0)+(k>>>0)+(_>>>0),q=(w,k,_,b)=>k+_+b+(w/2**32|0)|0,W=(w,k,_,b)=>(w>>>0)+(k>>>0)+(_>>>0)+(b>>>0),F=(w,k,_,b,v)=>k+_+b+v+(w/2**32|0)|0,G=(w,k,_,b,v)=>(w>>>0)+(k>>>0)+(_>>>0)+(b>>>0)+(v>>>0),m=(w,k,_,b,v,T)=>k+_+b+v+T+(w/2**32|0)|0,S={fromBig:i,split:s,toBig:e.toBig,shrSH:f,shrSL:c,rotrSH:d,rotrSL:l,rotrBH:h,rotrBL:y,rotr32H:A,rotr32L:R,rotlSH:D,rotlSL:ie,rotlBH:Z,rotlBL:J,add:E,add3L:te,add3H:q,add4L:W,add4H:F,add5H:m,add5L:G};e.default=S})(zw);Object.defineProperty(Dt,"__esModule",{value:!0});Dt.shake256=Dt.shake128=Dt.keccak_512=Dt.keccak_384=Dt.keccak_256=Dt.keccak_224=Dt.sha3_512=Dt.sha3_384=Dt.sha3_256=Dt.sha3_224=Dt.Keccak=Dt.keccakP=void 0;const Wo=ur,oa=zw,Xs=li,[Ww,Gw,Vw]=[[],[],[]],Hx=BigInt(0),qs=BigInt(1),zx=BigInt(2),Wx=BigInt(7),Gx=BigInt(256),Vx=BigInt(113);for(let e=0,t=qs,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],Ww.push(2*(5*i+r)),Gw.push((e+1)*(e+2)/2%64);let s=Hx;for(let a=0;a<7;a++)t=(t<>Wx)*Vx)%Gx,t&zx&&(s^=qs<<(qs<r>32?oa.default.rotlBH(e,t,r):oa.default.rotlSH(e,t,r),D_=(e,t,r)=>r>32?oa.default.rotlBL(e,t,r):oa.default.rotlSL(e,t,r);function Zw(e,t=24){const r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let f=0;f<10;f++)r[f]=e[f]^e[f+10]^e[f+20]^e[f+30]^e[f+40];for(let f=0;f<10;f+=2){const c=(f+8)%10,d=(f+2)%10,l=r[d],h=r[d+1],y=$_(l,h,1)^r[c],A=D_(l,h,1)^r[c+1];for(let R=0;R<50;R+=10)e[f+R]^=y,e[f+R+1]^=A}let s=e[2],a=e[3];for(let f=0;f<24;f++){const c=Gw[f],d=$_(s,a,c),l=D_(s,a,c),h=Ww[f];s=e[h],a=e[h+1],e[h]=d,e[h+1]=l}for(let f=0;f<50;f+=10){for(let c=0;c<10;c++)r[c]=e[f+c];for(let c=0;c<10;c++)e[f+c]^=~r[(c+2)%10]&r[(c+4)%10]}e[0]^=Zx[i],e[1]^=Kx[i]}r.fill(0)}Dt.keccakP=Zw;let Bh=class Kw extends Xs.Hash{constructor(t,r,i,s=!1,a=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=i,this.enableXOF=s,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Wo.default.number(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Xs.u32)(this.state)}keccak(){Zw(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Wo.default.exists(this);const{blockLen:r,state:i}=this;t=(0,Xs.toBytes)(t);const s=t.length;for(let a=0;a=i&&this.keccak();const f=Math.min(i-this.posOut,a-s);t.set(r.subarray(this.posOut,this.posOut+f),s),this.posOut+=f,s+=f}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Wo.default.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Wo.default.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:i,outputLen:s,rounds:a,enableXOF:f}=this;return t||(t=new Kw(r,i,s,f,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=i,t.outputLen=s,t.enableXOF=f,t.destroyed=this.destroyed,t}};Dt.Keccak=Bh;const Di=(e,t,r)=>(0,Xs.wrapConstructor)(()=>new Bh(t,e,r));Dt.sha3_224=Di(6,144,224/8);Dt.sha3_256=Di(6,136,256/8);Dt.sha3_384=Di(6,104,384/8);Dt.sha3_512=Di(6,72,512/8);Dt.keccak_224=Di(1,144,224/8);Dt.keccak_256=Di(1,136,256/8);Dt.keccak_384=Di(1,104,384/8);Dt.keccak_512=Di(1,72,512/8);const Jw=(e,t,r)=>(0,Xs.wrapXOFConstructorWithOpts)((i={})=>new Bh(t,e,i.dkLen===void 0?r:i.dkLen,!0));Dt.shake128=Jw(31,168,128/8);Dt.shake256=Jw(31,136,256/8);var Vu={exports:{}};Vu.exports;(function(e,t){var r=ft&&ft.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.wrapHash=t.equalsBytes=t.hexToBytes=t.bytesToUtf8=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0;const i=r(ur),s=li,a=i.default.bool;t.assertBool=a;const f=i.default.bytes;t.assertBytes=f;var c=li;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}});function d(A){if(!(A instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof A}`);return new TextDecoder().decode(A)}t.bytesToUtf8=d;function l(A){const R=A.startsWith("0x")?A.substring(2):A;return(0,s.hexToBytes)(R)}t.hexToBytes=l;function h(A,R){if(A.length!==R.length)return!1;for(let D=0;D(i.default.bytes(R),A(R))}t.wrapHash=y,t.crypto=(()=>{const A=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,R=typeof z0=="function"&&z0.bind(e);return{node:R&&!A?R("crypto"):void 0,web:A}})()})(Vu,Vu.exports);var Xw=Vu.exports;Object.defineProperty(Sn,"__esModule",{value:!0});Sn.keccak512=Sn.keccak384=Sn.keccak256=Sn.keccak224=void 0;const sa=Dt,Lf=Xw;Sn.keccak224=(0,Lf.wrapHash)(sa.keccak_224);Sn.keccak256=(()=>{const e=(0,Lf.wrapHash)(sa.keccak_256);return e.create=sa.keccak_256.create,e})();Sn.keccak384=(0,Lf.wrapHash)(sa.keccak_384);Sn.keccak512=(0,Lf.wrapHash)(sa.keccak_512);var mo={},fn={},Mt={};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.isHexString=Mt.getKeys=Mt.fromAscii=Mt.fromUtf8=Mt.toAscii=Mt.arrayContainsArray=Mt.getBinarySize=Mt.padToEven=Mt.stripHexPrefix=Mt.isHexPrefixed=void 0;function Yw(e){if(typeof e!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof e}`);return e[0]==="0"&&e[1]==="x"}Mt.isHexPrefixed=Yw;const Jx=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return Yw(e)?e.slice(2):e};Mt.stripHexPrefix=Jx;function Qw(e){let t=e;if(typeof t!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof t}`);return t.length%2&&(t=`0${t}`),t}Mt.padToEven=Qw;function Xx(e){if(typeof e!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof e}`);return Fe.Buffer.byteLength(e,"utf8")}Mt.getBinarySize=Xx;function Yx(e,t,r){if(Array.isArray(e)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(Array.isArray(t)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[r===!0?"some":"every"](i=>e.indexOf(i)>=0)}Mt.arrayContainsArray=Yx;function Qx(e){let t="",r=0;const i=e.length;for(e.substring(0,2)==="0x"&&(r=2);r0&&e.length!==2+2*t)}Mt.isHexString=n3;Object.defineProperty(fn,"__esModule",{value:!0});fn.assertIsString=fn.assertIsArray=fn.assertIsBuffer=fn.assertIsHexString=void 0;const i3=Mt,o3=function(e){if(!(0,i3.isHexString)(e)){const t=`This method only supports 0x-prefixed hex strings but input was: ${e}`;throw new Error(t)}};fn.assertIsHexString=o3;const s3=function(e){if(!Fe.Buffer.isBuffer(e)){const t=`This method only supports Buffer but input was: ${e}`;throw new Error(t)}};fn.assertIsBuffer=s3;const a3=function(e){if(!Array.isArray(e)){const t=`This method only supports number arrays but input was: ${e}`;throw new Error(t)}};fn.assertIsArray=a3;const u3=function(e){if(typeof e!="string"){const t=`This method only supports strings but input was: ${e}`;throw new Error(t)}};fn.assertIsString=u3;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=fn,r=Mt,i=function(v){if(!Number.isSafeInteger(v)||v<0)throw new Error(`Received an invalid integer type: ${v}`);return`0x${v.toString(16)}`};e.intToHex=i;const s=function(v){const T=(0,e.intToHex)(v);return Fe.Buffer.from((0,r.padToEven)(T.slice(2)),"hex")};e.intToBuffer=s;const a=function(v){return Fe.Buffer.allocUnsafe(v).fill(0)};e.zeros=a;const f=function(v,T,B){const C=(0,e.zeros)(T);return B?v.length0&&T.toString()==="0";)v=v.slice(1),T=v[0];return v},h=function(v){return(0,t.assertIsBuffer)(v),l(v)};e.unpadBuffer=h;const y=function(v){return(0,t.assertIsArray)(v),l(v)};e.unpadArray=y;const A=function(v){return(0,t.assertIsHexString)(v),v=(0,r.stripHexPrefix)(v),"0x"+l(v)};e.unpadHexString=A;const R=function(v){if(v==null)return Fe.Buffer.allocUnsafe(0);if(Fe.Buffer.isBuffer(v))return Fe.Buffer.from(v);if(Array.isArray(v)||v instanceof Uint8Array)return Fe.Buffer.from(v);if(typeof v=="string"){if(!(0,r.isHexString)(v))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${v}`);return Fe.Buffer.from((0,r.padToEven)((0,r.stripHexPrefix)(v)),"hex")}if(typeof v=="number")return(0,e.intToBuffer)(v);if(typeof v=="bigint"){if(v0&&B[0]===0)throw new Error(`${T} cannot have leading zeroes, received: ${B.toString("hex")}`)};e.validateNoLeadingZeroes=m;function S(v){return Array.isArray(v)?v.map(T=>S(T)):Fe.Buffer.from(v)}e.arrToBufArr=S;function w(v){return Array.isArray(v)?v.map(T=>w(T)):Uint8Array.from(v??[])}e.bufArrToArr=w;const k=v=>"0x"+v.toString(16);e.bigIntToHex=k;function _(v){return(0,e.unpadBuffer)(Z(v))}e.bigIntToUnpaddedBuffer=_;function b(v){return(0,e.unpadBuffer)((0,e.intToBuffer)(v))}e.intToUnpaddedBuffer=b})(mo);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=Un,r=Sn,i=Sf,s=Xw,a=mo,f=Ef,c=fn,d=Mt,l=BigInt(0);class h{constructor(b=l,v=l,T=f.KECCAK256_RLP,B=f.KECCAK256_NULL){this.nonce=b,this.balance=v,this.storageRoot=T,this.codeHash=B,this._validate()}static fromAccountData(b){const{nonce:v,balance:T,storageRoot:B,codeHash:C}=b;return new h(v!==void 0?(0,a.bufferToBigInt)((0,a.toBuffer)(v)):void 0,T!==void 0?(0,a.bufferToBigInt)((0,a.toBuffer)(T)):void 0,B!==void 0?(0,a.toBuffer)(B):void 0,C!==void 0?(0,a.toBuffer)(C):void 0)}static fromRlpSerializedAccount(b){const v=(0,a.arrToBufArr)(t.RLP.decode(Uint8Array.from(b)));if(!Array.isArray(v))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(v)}static fromValuesArray(b){const[v,T,B,C]=b;return new h((0,a.bufferToBigInt)(v),(0,a.bufferToBigInt)(T),B,C)}_validate(){if(this.nonce=8?x+=v[O].toUpperCase():x+=v[O];return x};e.toChecksumAddress=A;const R=function(_,b){return(0,e.isValidAddress)(_)&&(0,e.toChecksumAddress)(_,b)===_};e.isValidChecksumAddress=R;const D=function(_,b){return(0,c.assertIsBuffer)(_),(0,c.assertIsBuffer)(b),(0,a.bufferToBigInt)(b)===BigInt(0)?Fe.Buffer.from((0,r.keccak256)(t.RLP.encode((0,a.bufArrToArr)([_,null])))).slice(-20):Fe.Buffer.from((0,r.keccak256)(t.RLP.encode((0,a.bufArrToArr)([_,b])))).slice(-20)};e.generateAddress=D;const ie=function(_,b,v){if((0,c.assertIsBuffer)(_),(0,c.assertIsBuffer)(b),(0,c.assertIsBuffer)(v),_.length!==20)throw new Error("Expected from to be of length 20");if(b.length!==32)throw new Error("Expected salt to be of length 32");const T=(0,r.keccak256)(Fe.Buffer.concat([Fe.Buffer.from("ff","hex"),_,b,(0,r.keccak256)(v)]));return(0,a.toBuffer)(T).slice(-20)};e.generateAddress2=ie;const Z=function(_){return i.secp256k1.utils.isValidPrivateKey(_)};e.isValidPrivate=Z;const J=function(_,b=!1){if((0,c.assertIsBuffer)(_),_.length===64)try{return i.secp256k1.ProjectivePoint.fromHex(Fe.Buffer.concat([Fe.Buffer.from([4]),_])),!0}catch{return!1}if(!b)return!1;try{return i.secp256k1.ProjectivePoint.fromHex(_),!0}catch{return!1}};e.isValidPublic=J;const E=function(_,b=!1){if((0,c.assertIsBuffer)(_),b&&_.length!==64&&(_=Fe.Buffer.from(i.secp256k1.ProjectivePoint.fromHex(_).toRawBytes(!1).slice(1))),_.length!==64)throw new Error("Expected pubKey to be of length 64");return Fe.Buffer.from((0,r.keccak256)(_)).slice(-20)};e.pubToAddress=E,e.publicToAddress=e.pubToAddress;const te=function(_){return(0,c.assertIsBuffer)(_),Fe.Buffer.from(i.secp256k1.ProjectivePoint.fromPrivateKey(_).toRawBytes(!1).slice(1))};e.privateToPublic=te;const q=function(_){return(0,e.publicToAddress)((0,e.privateToPublic)(_))};e.privateToAddress=q;const W=function(_){return(0,c.assertIsBuffer)(_),_.length!==64&&(_=Fe.Buffer.from(i.secp256k1.ProjectivePoint.fromHex(_).toRawBytes(!1).slice(1))),_};e.importPublic=W;const F=function(){const b=(0,a.zeros)(20);return(0,a.bufferToHex)(b)};e.zeroAddress=F;const G=function(_){try{(0,c.assertIsString)(_)}catch{return!1}return(0,e.zeroAddress)()===_};e.isZeroAddress=G;function m(_){const[b,v,T,B]=_;return[b,v,(0,a.arrToBufArr)(T).length===0?f.KECCAK256_RLP:T,(0,a.arrToBufArr)(B).length===0?f.KECCAK256_NULL:B]}e.accountBodyFromSlim=m;const S=new Uint8Array(0);function w(_){const[b,v,T,B]=_;return[b,v,(0,a.arrToBufArr)(T).equals(f.KECCAK256_RLP)?S:T,(0,a.arrToBufArr)(B).equals(f.KECCAK256_NULL)?S:B]}e.accountBodyToSlim=w;function k(_,b=!0){const v=b?m(_):_;return(0,a.arrToBufArr)(t.RLP.encode(v))}e.accountBodyToRLP=k})(Ph);var ha={};Object.defineProperty(ha,"__esModule",{value:!0});ha.Address=void 0;const Hs=Ph,Lu=mo;class oi{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new oi((0,Lu.zeros)(20))}static fromString(t){if(!(0,Hs.isValidAddress)(t))throw new Error("Invalid address");return new oi((0,Lu.toBuffer)(t))}static fromPublicKey(t){if(!Fe.Buffer.isBuffer(t))throw new Error("Public key should be Buffer");const r=(0,Hs.pubToAddress)(t);return new oi(r)}static fromPrivateKey(t){if(!Fe.Buffer.isBuffer(t))throw new Error("Private key should be Buffer");const r=(0,Hs.privateToAddress)(t);return new oi(r)}static generate(t,r){if(typeof r!="bigint")throw new Error("Expected nonce to be a bigint");return new oi((0,Hs.generateAddress)(t.buf,(0,Lu.bigIntToBuffer)(r)))}static generate2(t,r,i){if(!Fe.Buffer.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!Fe.Buffer.isBuffer(i))throw new Error("Expected initCode to be a Buffer");return new oi((0,Hs.generateAddress2)(t.buf,r,i))}equals(t){return this.buf.equals(t.buf)}isZero(){return this.equals(oi.zero())}isPrecompileOrSystemAddress(){const t=(0,Lu.bufferToBigInt)(this.buf),r=BigInt(0),i=BigInt("0xffff");return t>=r&&t<=i}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return Fe.Buffer.from(this.buf)}}ha.Address=oi;var Pf={},xh={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=mo,r=Mt;var i;(function(a){a[a.Number=0]="Number",a[a.BigInt=1]="BigInt",a[a.Buffer=2]="Buffer",a[a.PrefixedHexString=3]="PrefixedHexString"})(i=e.TypeOutput||(e.TypeOutput={}));function s(a,f){if(a===null)return null;if(a===void 0)return;if(typeof a=="string"&&!(0,r.isHexString)(a))throw new Error(`A string must be provided with a 0x-prefix, given: ${a}`);if(typeof a=="number"&&!Number.isSafeInteger(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const c=(0,t.toBuffer)(a);switch(f){case i.Buffer:return c;case i.BigInt:return(0,t.bufferToBigInt)(c);case i.Number:{const d=(0,t.bufferToBigInt)(c);if(d>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(d)}case i.PrefixedHexString:return(0,t.bufferToHex)(c);default:throw new Error("unknown outputType")}}e.toType=s})(xh);Object.defineProperty(Pf,"__esModule",{value:!0});Pf.Withdrawal=void 0;const M_=ha,zl=mo,Kt=xh;class Ys{constructor(t,r,i,s){this.index=t,this.validatorIndex=r,this.address=i,this.amount=s}static fromWithdrawalData(t){const{index:r,validatorIndex:i,address:s,amount:a}=t,f=(0,Kt.toType)(r,Kt.TypeOutput.BigInt),c=(0,Kt.toType)(i,Kt.TypeOutput.BigInt),d=new M_.Address((0,Kt.toType)(s,Kt.TypeOutput.Buffer)),l=(0,Kt.toType)(a,Kt.TypeOutput.BigInt);return new Ys(f,c,d,l)}static fromValuesArray(t){if(t.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${t.length}`);const[r,i,s,a]=t;return Ys.fromWithdrawalData({index:r,validatorIndex:i,address:s,amount:a})}static toBufferArray(t){const{index:r,validatorIndex:i,address:s,amount:a}=t,f=(0,Kt.toType)(r,Kt.TypeOutput.BigInt)===BigInt(0)?Fe.Buffer.alloc(0):(0,Kt.toType)(r,Kt.TypeOutput.Buffer),c=(0,Kt.toType)(i,Kt.TypeOutput.BigInt)===BigInt(0)?Fe.Buffer.alloc(0):(0,Kt.toType)(i,Kt.TypeOutput.Buffer);let d;s instanceof M_.Address?d=s.buf:d=(0,Kt.toType)(s,Kt.TypeOutput.Buffer);const l=(0,Kt.toType)(a,Kt.TypeOutput.BigInt)===BigInt(0)?Fe.Buffer.alloc(0):(0,Kt.toType)(a,Kt.TypeOutput.Buffer);return[f,c,d,l]}raw(){return Ys.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,zl.bigIntToHex)(this.index),validatorIndex:(0,zl.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,zl.bigIntToHex)(this.amount)}}}Pf.Withdrawal=Ys;var mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.hashPersonalMessage=mr.isValidSignature=mr.fromRpcSig=mr.toCompactSig=mr.toRpcSig=mr.ecrecover=mr.ecsign=void 0;const f3=Sn,em=Sf,Br=mo,Wl=Ef,c3=fn;function l3(e,t,r){const i=em.secp256k1.sign(e,t),s=i.toCompactRawBytes(),a=Fe.Buffer.from(s.slice(0,32)),f=Fe.Buffer.from(s.slice(32,64)),c=r===void 0?BigInt(i.recovery+27):BigInt(i.recovery+35)+BigInt(r)*BigInt(2);return{r:a,s:f,v:c}}mr.ecsign=l3;function Cf(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function Bf(e){return e===BigInt(0)||e===BigInt(1)}const d3=function(e,t,r,i,s){const a=Fe.Buffer.concat([(0,Br.setLengthLeft)(r,32),(0,Br.setLengthLeft)(i,32)],64),f=Cf(t,s);if(!Bf(f))throw new Error("Invalid signature v value");const d=em.secp256k1.Signature.fromCompact(a).addRecoveryBit(Number(f)).recoverPublicKey(e);return Fe.Buffer.from(d.toRawBytes(!1).slice(1))};mr.ecrecover=d3;const h3=function(e,t,r,i){const s=Cf(e,i);if(!Bf(s))throw new Error("Invalid signature v value");return(0,Br.bufferToHex)(Fe.Buffer.concat([(0,Br.setLengthLeft)(t,32),(0,Br.setLengthLeft)(r,32),(0,Br.toBuffer)(e)]))};mr.toRpcSig=h3;const g3=function(e,t,r,i){const s=Cf(e,i);if(!Bf(s))throw new Error("Invalid signature v value");let a=r;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(a=Fe.Buffer.from(r),a[0]|=128),(0,Br.bufferToHex)(Fe.Buffer.concat([(0,Br.setLengthLeft)(t,32),(0,Br.setLengthLeft)(a,32)]))};mr.toCompactSig=g3;const p3=function(e){const t=(0,Br.toBuffer)(e);let r,i,s;if(t.length>=65)r=t.slice(0,32),i=t.slice(32,64),s=(0,Br.bufferToBigInt)(t.slice(64));else if(t.length===64)r=t.slice(0,32),i=t.slice(32,64),s=BigInt((0,Br.bufferToInt)(t.slice(32,33))>>7),i[0]&=127;else throw new Error("Invalid signature length");return s<27&&(s=s+BigInt(27)),{v:s,r,s:i}};mr.fromRpcSig=p3;const _3=function(e,t,r,i=!0,s){if(t.length!==32||r.length!==32||!Bf(Cf(e,s)))return!1;const a=(0,Br.bufferToBigInt)(t),f=(0,Br.bufferToBigInt)(r);return!(a===BigInt(0)||a>=Wl.SECP256K1_ORDER||f===BigInt(0)||f>=Wl.SECP256K1_ORDER||i&&f>=Wl.SECP256K1_ORDER_DIV_2)};mr.isValidSignature=_3;const b3=function(e){(0,c3.assertIsBuffer)(e);const t=Fe.Buffer.from(`Ethereum Signed Message: +${e.length}`,"utf-8");return Fe.Buffer.from((0,f3.keccak256)(Fe.Buffer.concat([t,e])))};mr.hashPersonalMessage=b3;var tm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=f=>f.length>0&&f[f.length-1]===16;e.hasTerminator=t;const r=(f,c)=>{for(let d=0,l=0;l{let c=0;(0,e.hasTerminator)(f)&&(c=1,f=f.subarray(0,f.length-1));const d=new Uint8Array(f.length/2+1);return d[0]=c<<5,(f.length&1)===1&&(d[0]|=16,d[0]|=f[0],f=f.subarray(1)),(0,e.nibblesToBytes)(f,d.subarray(1)),d};e.nibblesToCompactBytes=i;const s=f=>{const c=f.length*2+1,d=new Uint8Array(c);for(let l=0;l{if(f.length===0)return f;let c=(0,e.bytesToNibbles)(f);c[0]<2&&(c=c.subarray(0,c.length-1));const d=2-(c[0]&1);return c.subarray(d)};e.compactBytesToNibbles=a})(tm);var xf={};Object.defineProperty(xf,"__esModule",{value:!0});xf.AsyncEventEmitter=void 0;const y3=aa;async function w3(e,t,r){let i;for await(const s of t)try{s.length<2?s.call(e,r):await new Promise((a,f)=>{s.call(e,r,c=>{c?f(c):a()})})}catch(a){i=a}if(i)throw i}class m3 extends y3.EventEmitter{emit(t,...r){let[i,s]=r;const a=this;let f=a._events[t]??[];return s===void 0&&typeof i=="function"&&(s=i,i=void 0),(t==="newListener"||t==="removeListener")&&(i={event:i,fn:s},s=void 0),f=Array.isArray(f)?f:[f],w3(a,f.slice(),i).then(s).catch(s),a.listenerCount(t)>0}once(t,r){const i=this;let s;if(typeof r!="function")throw new TypeError("listener must be a function");return r.length>=2?s=function(a,f){i.removeListener(t,s),r(a,f)}:s=function(a){i.removeListener(t,s),r(a,s)},i.on(t,s),i}first(t,r){let i=this._events[t]??[];if(typeof r!="function")throw new TypeError("listener must be a function");return Array.isArray(i)||(this._events[t]=i=[i]),i.unshift(r),this}before(t,r,i){return this.beforeOrAfter(t,r,i)}after(t,r,i){return this.beforeOrAfter(t,r,i,"after")}beforeOrAfter(t,r,i,s){let a=this._events[t]??[],f,c;const d=s==="after"?1:0;if(typeof i!="function")throw new TypeError("listener must be a function");if(typeof r!="function")throw new TypeError("target must be a function");for(Array.isArray(a)||(this._events[t]=a=[a]),c=a.length,f=a.length;f--;)if(a[f]===r){c=f+d;break}return a.splice(c,0,i),this}on(t,r){return super.on(t,r)}addListener(t,r){return super.addListener(t,r)}prependListener(t,r){return super.prependListener(t,r)}prependOnceListener(t,r){return super.prependOnceListener(t,r)}removeAllListeners(t){return super.removeAllListeners(t)}removeListener(t,r){return super.removeListener(t,r)}eventNames(){return super.eventNames()}listeners(t){return super.listeners(t)}listenerCount(t){return super.listenerCount(t)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(t){return super.setMaxListeners(t)}}xf.AsyncEventEmitter=m3;var $f={};Object.defineProperty($f,"__esModule",{value:!0});$f.Lock=void 0;class v3{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(t=>this.promiseResolverQueue.push(t))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const t=this.promiseResolverQueue.shift();t&&t(!0)}}}$f.Lock=v3;var os={},ho={},Gl={},Vl={exports:{}},Zl={},U_;function rm(){return U_||(U_=1,function(e){e.fetch=s(ft.fetch)&&s(ft.ReadableStream),e.writableStream=s(ft.WritableStream),e.abortController=s(ft.AbortController);var t;function r(){if(t!==void 0)return t;if(ft.XMLHttpRequest){t=new ft.XMLHttpRequest;try{t.open("GET",ft.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function i(a){var f=r();if(!f)return!1;try{return f.responseType=a,f.responseType===a}catch{}return!1}e.arraybuffer=e.fetch||i("arraybuffer"),e.msstream=!e.fetch&&i("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&i("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||(r()?s(r().overrideMimeType):!1);function s(a){return typeof a=="function"}t=null}(Zl)),Zl}var Pu={},k_;function nm(){if(k_)return Pu;k_=1;var e=rm(),t=Ab,r=ss,i=Pu.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},s=Pu.IncomingMessage=function(a,f,c,d){var l=this;if(r.Readable.call(l),l._mode=c,l.headers={},l.rawHeaders=[],l.trailers={},l.rawTrailers=[],l.on("end",function(){Fe.process.nextTick(function(){l.emit("close")})}),c==="fetch"){let ie=function(){y.read().then(function(Z){if(!l._destroyed){if(d(Z.done),Z.done){l.push(null);return}l.push(Fe.Buffer.from(Z.value)),ie()}}).catch(function(Z){d(!0),l._destroyed||l.emit("error",Z)})};if(l._fetchResponse=f,l.url=f.url,l.statusCode=f.status,l.statusMessage=f.statusText,f.headers.forEach(function(Z,J){l.headers[J.toLowerCase()]=Z,l.rawHeaders.push(J,Z)}),e.writableStream){var h=new WritableStream({write:function(Z){return d(!1),new Promise(function(J,E){l._destroyed?E():l.push(Fe.Buffer.from(Z))?J():l._resumeFetch=J})},close:function(){d(!0),l._destroyed||l.push(null)},abort:function(Z){d(!0),l._destroyed||l.emit("error",Z)}});try{f.body.pipeTo(h).catch(function(Z){d(!0),l._destroyed||l.emit("error",Z)});return}catch{}}var y=f.body.getReader();ie()}else{l._xhr=a,l._pos=0,l.url=a.responseURL,l.statusCode=a.status,l.statusMessage=a.statusText;var A=a.getAllResponseHeaders().split(/\r?\n/);if(A.forEach(function(ie){var Z=ie.match(/^([^:]+):\s*(.*)/);if(Z){var J=Z[1].toLowerCase();J==="set-cookie"?(l.headers[J]===void 0&&(l.headers[J]=[]),l.headers[J].push(Z[2])):l.headers[J]!==void 0?l.headers[J]+=", "+Z[2]:l.headers[J]=Z[2],l.rawHeaders.push(Z[1],Z[2])}}),l._charset="x-user-defined",!e.overrideMimeType){var R=l.rawHeaders["mime-type"];if(R){var D=R.match(/;\s*charset=([^;])(;|$)/);D&&(l._charset=D[1].toLowerCase())}l._charset||(l._charset="utf-8")}}};return t(s,r.Readable),s.prototype._read=function(){var a=this,f=a._resumeFetch;f&&(a._resumeFetch=null,f())},s.prototype._onXHRProgress=function(a){var f=this,c=f._xhr,d=null;switch(f._mode){case"text":if(d=c.responseText,d.length>f._pos){var l=d.substr(f._pos);if(f._charset==="x-user-defined"){for(var h=Fe.Buffer.alloc(l.length),y=0;yf._pos&&(f.push(Fe.Buffer.from(new Uint8Array(A.result.slice(f._pos)))),f._pos=A.result.byteLength)},A.onload=function(){a(!0),f.push(null)},A.readAsArrayBuffer(d);break}f._xhr.readyState===i.DONE&&f._mode!=="ms-stream"&&(a(!0),f.push(null))},Pu}var F_;function E3(){if(F_)return Vl.exports;F_=1;var e=rm(),t=Ab,r=nm(),i=ss,s=r.IncomingMessage,a=r.readyStates;function f(h,y){return e.fetch&&y?"fetch":e.mozchunkedarraybuffer?"moz-chunked-arraybuffer":e.msstream?"ms-stream":e.arraybuffer&&h?"arraybuffer":"text"}var c=Vl.exports=function(h){var y=this;i.Writable.call(y),y._opts=h,y._body=[],y._headers={},h.auth&&y.setHeader("Authorization","Basic "+Fe.Buffer.from(h.auth).toString("base64")),Object.keys(h.headers).forEach(function(D){y.setHeader(D,h.headers[D])});var A,R=!0;if(h.mode==="disable-fetch"||"requestTimeout"in h&&!e.abortController)R=!1,A=!0;else if(h.mode==="prefer-streaming")A=!1;else if(h.mode==="allow-wrong-content-type")A=!e.overrideMimeType;else if(!h.mode||h.mode==="default"||h.mode==="prefer-fast")A=!0;else throw new Error("Invalid value for opts.mode");y._mode=f(A,R),y._fetchTimer=null,y._socketTimeout=null,y._socketTimer=null,y.on("finish",function(){y._onFinish()})};t(c,i.Writable),c.prototype.setHeader=function(h,y){var A=this,R=h.toLowerCase();l.indexOf(R)===-1&&(A._headers[R]={name:h,value:y})},c.prototype.getHeader=function(h){var y=this._headers[h.toLowerCase()];return y?y.value:null},c.prototype.removeHeader=function(h){var y=this;delete y._headers[h.toLowerCase()]},c.prototype._onFinish=function(){var h=this;if(!h._destroyed){var y=h._opts;"timeout"in y&&y.timeout!==0&&h.setTimeout(y.timeout);var A=h._headers,R=null;y.method!=="GET"&&y.method!=="HEAD"&&(R=new Blob(h._body,{type:(A["content-type"]||{}).value||""}));var D=[];if(Object.keys(A).forEach(function(E){var te=A[E].name,q=A[E].value;Array.isArray(q)?q.forEach(function(W){D.push([te,W])}):D.push([te,q])}),h._mode==="fetch"){var ie=null;if(e.abortController){var Z=new AbortController;ie=Z.signal,h._fetchAbortController=Z,"requestTimeout"in y&&y.requestTimeout!==0&&(h._fetchTimer=ft.setTimeout(function(){h.emit("requestTimeout"),h._fetchAbortController&&h._fetchAbortController.abort()},y.requestTimeout))}ft.fetch(h._opts.url,{method:h._opts.method,headers:D,body:R||void 0,mode:"cors",credentials:y.withCredentials?"include":"same-origin",signal:ie}).then(function(E){h._fetchResponse=E,h._resetTimers(!1),h._connect()},function(E){h._resetTimers(!0),h._destroyed||h.emit("error",E)})}else{var J=h._xhr=new ft.XMLHttpRequest;try{J.open(h._opts.method,h._opts.url,!0)}catch(E){Fe.process.nextTick(function(){h.emit("error",E)});return}"responseType"in J&&(J.responseType=h._mode),"withCredentials"in J&&(J.withCredentials=!!y.withCredentials),h._mode==="text"&&"overrideMimeType"in J&&J.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in y&&(J.timeout=y.requestTimeout,J.ontimeout=function(){h.emit("requestTimeout")}),D.forEach(function(E){J.setRequestHeader(E[0],E[1])}),h._response=null,J.onreadystatechange=function(){switch(J.readyState){case a.LOADING:case a.DONE:h._onXHRProgress();break}},h._mode==="moz-chunked-arraybuffer"&&(J.onprogress=function(){h._onXHRProgress()}),J.onerror=function(){h._destroyed||(h._resetTimers(!0),h.emit("error",new Error("XHR error")))};try{J.send(R)}catch(E){Fe.process.nextTick(function(){h.emit("error",E)});return}}}};function d(h){try{var y=h.status;return y!==null&&y!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var h=this;h._resetTimers(!1),!(!d(h._xhr)||h._destroyed)&&(h._response||h._connect(),h._response._onXHRProgress(h._resetTimers.bind(h)))},c.prototype._connect=function(){var h=this;h._destroyed||(h._response=new s(h._xhr,h._fetchResponse,h._mode,h._resetTimers.bind(h)),h._response.on("error",function(y){h.emit("error",y)}),h.emit("response",h._response))},c.prototype._write=function(h,y,A){var R=this;R._body.push(h),A()},c.prototype._resetTimers=function(h){var y=this;ft.clearTimeout(y._socketTimer),y._socketTimer=null,h?(ft.clearTimeout(y._fetchTimer),y._fetchTimer=null):y._socketTimeout&&(y._socketTimer=ft.setTimeout(function(){y.emit("timeout")},y._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(h){var y=this;y._destroyed=!0,y._resetTimers(!0),y._response&&(y._response._destroyed=!0),y._xhr?y._xhr.abort():y._fetchAbortController&&y._fetchAbortController.abort(),h&&y.emit("error",h)},c.prototype.end=function(h,y,A){var R=this;typeof h=="function"&&(A=h,h=void 0),i.Writable.prototype.end.call(R,h,y,A)},c.prototype.setTimeout=function(h,y){var A=this;y&&A.once("timeout",y),A._socketTimeout=h,A._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var l=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return Vl.exports}var Kl,j_;function S3(){if(j_)return Kl;j_=1,Kl=t;var e=Object.prototype.hasOwnProperty;function t(){for(var r={},i=0;i0&&c>f&&(c=f);for(var d=0;d=0?(y=l.substr(0,h),A=l.substr(h+1)):(y=l,A=""),R=decodeURIComponent(y),D=decodeURIComponent(A),A3(s,R)?T3(s[R])?s[R].push(D):s[R]=[s[R],D]:s[R]=D}return s},T3=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},zs=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},O3=function(e,t,r,i){return t=t||"&",r=r||"=",e===null&&(e=void 0),typeof e=="object"?H_(L3(e),function(s){var a=encodeURIComponent(zs(s))+r;return N3(e[s])?H_(e[s],function(f){return a+encodeURIComponent(zs(f))}).join(t):a+encodeURIComponent(zs(e[s]))}).join(t):i?encodeURIComponent(zs(i))+r+encodeURIComponent(zs(e)):""},N3=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function H_(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i",'"',"`"," ","\r",` +`," "],G3=["{","}","|","\\","^","`"].concat(W3),Bd=["'"].concat(G3),z_=["%","/","?",";","#"].concat(Bd),W_=["/","?","#"],V3=255,G_=/^[+a-z0-9A-Z_-]{0,63}$/,Z3=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,K3={javascript:!0,"javascript:":!0},xd={javascript:!0,"javascript:":!0},Jo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},$d=$3;function ga(e,t,r){if(e&&xn.isObject(e)&&e instanceof ln)return e;var i=new ln;return i.parse(e,t,r),i}ln.prototype.parse=function(e,t,r){if(!xn.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=i!==-1&&i127?W+="x":W+=q[F];if(!W.match(G_)){var m=E.slice(0,R),S=E.slice(R+1),w=q.match(Z3);w&&(m.push(w[1]),S.unshift(w[2])),S.length&&(c="/"+S.join(".")+c),this.hostname=m.join(".");break}}}this.hostname.length>V3?this.hostname="":this.hostname=this.hostname.toLowerCase(),J||(this.hostname=M3.toASCII(this.hostname));var k=this.port?":"+this.port:"",_=this.hostname||"";this.host=_+k,this.href+=this.host,J&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),c[0]!=="/"&&(c="/"+c))}if(!K3[h])for(var R=0,te=Bd.length;R0?r.host.split("@"):!1;W&&(r.auth=W.shift(),r.host=r.hostname=W.shift())}return r.search=e.search,r.query=e.query,(!xn.isNull(r.pathname)||!xn.isNull(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var F=E.slice(-1)[0],G=(r.host||e.host||E.length>1)&&(F==="."||F==="..")||F==="",m=0,S=E.length;S>=0;S--)F=E[S],F==="."?E.splice(S,1):F===".."?(E.splice(S,1),m++):m&&(E.splice(S,1),m--);if(!Z&&!J)for(;m--;m)E.unshift("..");Z&&E[0]!==""&&(!E[0]||E[0].charAt(0)!=="/")&&E.unshift(""),G&&E.join("/").substr(-1)!=="/"&&E.push("");var w=E[0]===""||E[0]&&E[0].charAt(0)==="/";if(q){r.hostname=r.host=w?"":E.length?E.shift():"";var W=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;W&&(r.auth=W.shift(),r.host=r.hostname=W.shift())}return Z=Z||r.host&&E.length,Z&&!w&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),(!xn.isNull(r.pathname)||!xn.isNull(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r};ln.prototype.parseHost=function(){var e=this.host,t=H3.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};function Q3(e,t){for(var r=0,i=e.length-1;i>=0;i--){var s=e[i];s==="."?e.splice(i,1):s===".."?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function e$(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:"/";if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)continue;e=i+"/"+e,t=i.charAt(0)==="/"}return e=Q3(t$(e.split("/"),function(s){return!!s}),!t).join("/"),(t?"/":"")+e||"."}function t$(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i"u")throw new TypeError('The "domain" argument must be specified');return new xi("http://"+t).hostname},hm=function(t){if(typeof t>"u")throw new TypeError('The "domain" argument must be specified');return new xi("http://"+t).hostname},gm=function(t){var r=new xi("file://"),i=e$(t),s=t.charCodeAt(t.length-1);return s===u$&&i[i.length-1]!=="/"&&(i+="/"),r.pathname=l$(i),r},pm=function(t){if(!f$(t)&&typeof t!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof t+" ("+t+")");var r=new xi(t);if(r.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return c$(r)},_m=function(t,r){var i,s,a;if(r===void 0&&(r={}),!(t instanceof xi))return r$(t);if(typeof r!="object"||r===null)throw new TypeError('The "options" argument must be of type object.');var f=(i=r.auth)!=null?i:!0,c=(s=r.fragment)!=null?s:!0,d=(a=r.search)!=null?a:!0,l=new xi(t.toString());return f||(l.username="",l.password=""),c||(l.hash=""),d||(l.search=""),l.toString()},d$={format:_m,parse:um,resolve:fm,resolveObject:sm,Url:cm,URL:xi,URLSearchParams:lm,domainToASCII:dm,domainToUnicode:hm,pathToFileURL:gm,fileURLToPath:pm};const h$=Object.freeze(Object.defineProperty({__proto__:null,URL:xi,URLSearchParams:lm,Url:cm,default:d$,domainToASCII:dm,domainToUnicode:hm,fileURLToPath:pm,format:_m,parse:um,pathToFileURL:gm,resolve:fm,resolveObject:sm},Symbol.toStringTag,{value:"Module"})),$h=Fd(h$);var V_;function bm(){return V_||(V_=1,function(e){var t=E3(),r=nm(),i=S3(),s=R3(),a=$h,f=e;f.request=function(c,d){typeof c=="string"?c=a.parse(c):c=i(c);var l=ft.location.protocol.search(/^https?:$/)===-1?"http:":"",h=c.protocol||l,y=c.hostname||c.host,A=c.port,R=c.path||"/";y&&y.indexOf(":")!==-1&&(y="["+y+"]"),c.url=(y?h+"//"+y:"")+(A?":"+A:"")+R,c.method=(c.method||"GET").toUpperCase(),c.headers=c.headers||{};var D=new t(c);return d&&D.on("response",d),D},f.get=function(d,l){var h=f.request(d,l);return h.end(),h},f.ClientRequest=t,f.IncomingMessage=r.IncomingMessage,f.Agent=function(){},f.Agent.defaultMaxSockets=4,f.globalAgent=new f.Agent,f.STATUS_CODES=s,f.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}(Gl)),Gl}var Xl={exports:{}},Z_;function g$(){return Z_||(Z_=1,function(e){var t=bm(),r=$h,i=e.exports;for(var s in t)t.hasOwnProperty(s)&&(i[s]=t[s]);i.request=function(f,c){return f=a(f),t.request.call(this,f,c)},i.get=function(f,c){return f=a(f),t.get.call(this,f,c)};function a(f){if(typeof f=="string"&&(f=r.parse(f)),f.protocol||(f.protocol="https:"),f.protocol!=="https:")throw new Error('Protocol "'+f.protocol+'" not supported. Expected "https:"');return f}}(Xl)),Xl.exports}var Yl={},Ql={},ed,K_;function p$(){if(K_)return ed;K_=1;function e(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}return ed=e,ed}var mn={},td={},J_;function Df(){return J_||(J_=1,function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function r(a,f){return Object.prototype.hasOwnProperty.call(a,f)}e.assign=function(a){for(var f=Array.prototype.slice.call(arguments,1);f.length;){var c=f.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var d in c)r(c,d)&&(a[d]=c[d])}}return a},e.shrinkBuf=function(a,f){return a.length===f?a:a.subarray?a.subarray(0,f):(a.length=f,a)};var i={arraySet:function(a,f,c,d,l){if(f.subarray&&a.subarray){a.set(f.subarray(c,c+d),l);return}for(var h=0;h=0;)$[Se]=0}var f=0,c=1,d=2,l=3,h=258,y=29,A=256,R=A+1+y,D=30,ie=19,Z=2*R+1,J=15,E=16,te=7,q=256,W=16,F=17,G=18,m=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],S=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_=512,b=new Array((R+2)*2);a(b);var v=new Array(D*2);a(v);var T=new Array(_);a(T);var B=new Array(h-l+1);a(B);var C=new Array(y);a(C);var x=new Array(D);a(x);function O($,Se,Ne,ke,ae){this.static_tree=$,this.extra_bits=Se,this.extra_base=Ne,this.elems=ke,this.max_length=ae,this.has_stree=$&&$.length}var L,X,re;function fe($,Se){this.dyn_tree=$,this.max_code=0,this.stat_desc=Se}function _e($){return $<256?T[$]:T[256+($>>>7)]}function be($,Se){$.pending_buf[$.pending++]=Se&255,$.pending_buf[$.pending++]=Se>>>8&255}function ye($,Se,Ne){$.bi_valid>E-Ne?($.bi_buf|=Se<<$.bi_valid&65535,be($,$.bi_buf),$.bi_buf=Se>>E-$.bi_valid,$.bi_valid+=Ne-E):($.bi_buf|=Se<<$.bi_valid&65535,$.bi_valid+=Ne)}function oe($,Se,Ne){ye($,Ne[Se*2],Ne[Se*2+1])}function K($,Se){var Ne=0;do Ne|=$&1,$>>>=1,Ne<<=1;while(--Se>0);return Ne>>>1}function Q($){$.bi_valid===16?(be($,$.bi_buf),$.bi_buf=0,$.bi_valid=0):$.bi_valid>=8&&($.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8)}function pe($,Se){var Ne=Se.dyn_tree,ke=Se.max_code,ae=Se.stat_desc.static_tree,Re=Se.stat_desc.has_stree,P=Se.stat_desc.extra_bits,Be=Se.stat_desc.extra_base,We=Se.stat_desc.max_length,g,me,Ee,M,ne,ve,Ke=0;for(M=0;M<=J;M++)$.bl_count[M]=0;for(Ne[$.heap[$.heap_max]*2+1]=0,g=$.heap_max+1;gWe&&(M=We,Ke++),Ne[me*2+1]=M,!(me>ke)&&($.bl_count[M]++,ne=0,me>=Be&&(ne=P[me-Be]),ve=Ne[me*2],$.opt_len+=ve*(M+ne),Re&&($.static_len+=ve*(ae[me*2+1]+ne)));if(Ke!==0){do{for(M=We-1;$.bl_count[M]===0;)M--;$.bl_count[M]--,$.bl_count[M+1]+=2,$.bl_count[We]--,Ke-=2}while(Ke>0);for(M=We;M!==0;M--)for(me=$.bl_count[M];me!==0;)Ee=$.heap[--g],!(Ee>ke)&&(Ne[Ee*2+1]!==M&&($.opt_len+=(M-Ne[Ee*2+1])*Ne[Ee*2],Ne[Ee*2+1]=M),me--)}}function Oe($,Se,Ne){var ke=new Array(J+1),ae=0,Re,P;for(Re=1;Re<=J;Re++)ke[Re]=ae=ae+Ne[Re-1]<<1;for(P=0;P<=Se;P++){var Be=$[P*2+1];Be!==0&&($[P*2]=K(ke[Be]++,Be))}}function Le(){var $,Se,Ne,ke,ae,Re=new Array(J+1);for(Ne=0,ke=0;ke>=7;ke8?be($,$.bi_buf):$.bi_valid>0&&($.pending_buf[$.pending++]=$.bi_buf),$.bi_buf=0,$.bi_valid=0}function ue($,Se,Ne,ke){V($),ke&&(be($,Ne),be($,~Ne)),e.arraySet($.pending_buf,$.window,Se,Ne,$.pending),$.pending+=Ne}function xe($,Se,Ne,ke){var ae=Se*2,Re=Ne*2;return $[ae]<$[Re]||$[ae]===$[Re]&&ke[Se]<=ke[Ne]}function Te($,Se,Ne){for(var ke=$.heap[Ne],ae=Ne<<1;ae<=$.heap_len&&(ae<$.heap_len&&xe(Se,$.heap[ae+1],$.heap[ae],$.depth)&&ae++,!xe(Se,ke,$.heap[ae],$.depth));)$.heap[Ne]=$.heap[ae],Ne=ae,ae<<=1;$.heap[Ne]=ke}function Me($,Se,Ne){var ke,ae,Re=0,P,Be;if($.last_lit!==0)do ke=$.pending_buf[$.d_buf+Re*2]<<8|$.pending_buf[$.d_buf+Re*2+1],ae=$.pending_buf[$.l_buf+Re],Re++,ke===0?oe($,ae,Se):(P=B[ae],oe($,P+A+1,Se),Be=m[P],Be!==0&&(ae-=C[P],ye($,ae,Be)),ke--,P=_e(ke),oe($,P,Ne),Be=S[P],Be!==0&&(ke-=x[P],ye($,ke,Be)));while(Re<$.last_lit);oe($,q,Se)}function Ze($,Se){var Ne=Se.dyn_tree,ke=Se.stat_desc.static_tree,ae=Se.stat_desc.has_stree,Re=Se.stat_desc.elems,P,Be,We=-1,g;for($.heap_len=0,$.heap_max=Z,P=0;P>1;P>=1;P--)Te($,Ne,P);g=Re;do P=$.heap[1],$.heap[1]=$.heap[$.heap_len--],Te($,Ne,1),Be=$.heap[1],$.heap[--$.heap_max]=P,$.heap[--$.heap_max]=Be,Ne[g*2]=Ne[P*2]+Ne[Be*2],$.depth[g]=($.depth[P]>=$.depth[Be]?$.depth[P]:$.depth[Be])+1,Ne[P*2+1]=Ne[Be*2+1]=g,$.heap[1]=g++,Te($,Ne,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],pe($,Se),Oe(Ne,We,$.bl_count)}function Qe($,Se,Ne){var ke,ae=-1,Re,P=Se[0*2+1],Be=0,We=7,g=4;for(P===0&&(We=138,g=3),Se[(Ne+1)*2+1]=65535,ke=0;ke<=Ne;ke++)Re=P,P=Se[(ke+1)*2+1],!(++Be=3&&$.bl_tree[k[Se]*2+1]===0;Se--);return $.opt_len+=3*(Se+1)+5+5+4,Se}function et($,Se,Ne,ke){var ae;for(ye($,Se-257,5),ye($,Ne-1,5),ye($,ke-4,4),ae=0;ae>>=1)if(Se&1&&$.dyn_ltree[Ne*2]!==0)return r;if($.dyn_ltree[9*2]!==0||$.dyn_ltree[10*2]!==0||$.dyn_ltree[13*2]!==0)return i;for(Ne=32;Ne0?($.strm.data_type===s&&($.strm.data_type=ce($)),Ze($,$.l_desc),Ze($,$.d_desc),P=it($),ae=$.opt_len+3+7>>>3,Re=$.static_len+3+7>>>3,Re<=ae&&(ae=Re)):ae=Re=Ne+5,Ne+4<=ae&&Se!==-1?we($,Se,Ne,ke):$.strategy===t||Re===ae?(ye($,(c<<1)+(ke?1:0),3),Me($,b,v)):(ye($,(d<<1)+(ke?1:0),3),et($,$.l_desc.max_code+1,$.d_desc.max_code+1,P+1),Me($,$.dyn_ltree,$.dyn_dtree)),z($),ke&&V($)}function je($,Se,Ne){return $.pending_buf[$.d_buf+$.last_lit*2]=Se>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=Se&255,$.pending_buf[$.l_buf+$.last_lit]=Ne&255,$.last_lit++,Se===0?$.dyn_ltree[Ne*2]++:($.matches++,Se--,$.dyn_ltree[(B[Ne]+A+1)*2]++,$.dyn_dtree[_e(Se)*2]++),$.last_lit===$.lit_bufsize-1}return to._tr_init=j,to._tr_stored_block=we,to._tr_flush_block=Ce,to._tr_tally=je,to._tr_align=ge,to}var rd,Y_;function ym(){if(Y_)return rd;Y_=1;function e(t,r,i,s){for(var a=t&65535|0,f=t>>>16&65535|0,c=0;i!==0;){c=i>2e3?2e3:i,i-=c;do a=a+r[s++]|0,f=f+a|0;while(--c);a%=65521,f%=65521}return a|f<<16|0}return rd=e,rd}var nd,Q_;function wm(){if(Q_)return nd;Q_=1;function e(){for(var i,s=[],a=0;a<256;a++){i=a;for(var f=0;f<8;f++)i=i&1?3988292384^i>>>1:i>>>1;s[a]=i}return s}var t=e();function r(i,s,a,f){var c=t,d=f+a;i^=-1;for(var l=f;l>>8^c[(i^s[l])&255];return i^-1}return nd=r,nd}var id,eb;function b$(){return eb||(eb=1,id={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}),id}var tb;function y$(){if(tb)return mn;tb=1;var e=Df(),t=_$(),r=ym(),i=wm(),s=b$(),a=0,f=1,c=3,d=4,l=5,h=0,y=1,A=-2,R=-3,D=-5,ie=-1,Z=1,J=2,E=3,te=4,q=0,W=2,F=8,G=9,m=15,S=8,w=29,k=256,_=k+1+w,b=30,v=19,T=2*_+1,B=15,C=3,x=258,O=x+C+1,L=32,X=42,re=69,fe=73,_e=91,be=103,ye=113,oe=666,K=1,Q=2,pe=3,Oe=4,Le=3;function z(g,me){return g.msg=s[me],me}function V(g){return(g<<1)-(g>4?9:0)}function ue(g){for(var me=g.length;--me>=0;)g[me]=0}function xe(g){var me=g.state,Ee=me.pending;Ee>g.avail_out&&(Ee=g.avail_out),Ee!==0&&(e.arraySet(g.output,me.pending_buf,me.pending_out,Ee,g.next_out),g.next_out+=Ee,me.pending_out+=Ee,g.total_out+=Ee,g.avail_out-=Ee,me.pending-=Ee,me.pending===0&&(me.pending_out=0))}function Te(g,me){t._tr_flush_block(g,g.block_start>=0?g.block_start:-1,g.strstart-g.block_start,me),g.block_start=g.strstart,xe(g.strm)}function Me(g,me){g.pending_buf[g.pending++]=me}function Ze(g,me){g.pending_buf[g.pending++]=me>>>8&255,g.pending_buf[g.pending++]=me&255}function Qe(g,me,Ee,M){var ne=g.avail_in;return ne>M&&(ne=M),ne===0?0:(g.avail_in-=ne,e.arraySet(me,g.input,g.next_in,ne,Ee),g.state.wrap===1?g.adler=r(g.adler,me,ne,Ee):g.state.wrap===2&&(g.adler=i(g.adler,me,ne,Ee)),g.next_in+=ne,g.total_in+=ne,ne)}function Xe(g,me){var Ee=g.max_chain_length,M=g.strstart,ne,ve,Ke=g.prev_length,qe=g.nice_match,He=g.strstart>g.w_size-O?g.strstart-(g.w_size-O):0,ct=g.window,Ut=g.w_mask,St=g.prev,dt=g.strstart+x,Ot=ct[M+Ke-1],Ft=ct[M+Ke];g.prev_length>=g.good_match&&(Ee>>=2),qe>g.lookahead&&(qe=g.lookahead);do if(ne=me,!(ct[ne+Ke]!==Ft||ct[ne+Ke-1]!==Ot||ct[ne]!==ct[M]||ct[++ne]!==ct[M+1])){M+=2,ne++;do;while(ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&ct[++M]===ct[++ne]&&MKe){if(g.match_start=me,Ke=ve,ve>=qe)break;Ot=ct[M+Ke-1],Ft=ct[M+Ke]}}while((me=St[me&Ut])>He&&--Ee!==0);return Ke<=g.lookahead?Ke:g.lookahead}function it(g){var me=g.w_size,Ee,M,ne,ve,Ke;do{if(ve=g.window_size-g.lookahead-g.strstart,g.strstart>=me+(me-O)){e.arraySet(g.window,g.window,me,me,0),g.match_start-=me,g.strstart-=me,g.block_start-=me,M=g.hash_size,Ee=M;do ne=g.head[--Ee],g.head[Ee]=ne>=me?ne-me:0;while(--M);M=me,Ee=M;do ne=g.prev[--Ee],g.prev[Ee]=ne>=me?ne-me:0;while(--M);ve+=me}if(g.strm.avail_in===0)break;if(M=Qe(g.strm,g.window,g.strstart+g.lookahead,ve),g.lookahead+=M,g.lookahead+g.insert>=C)for(Ke=g.strstart-g.insert,g.ins_h=g.window[Ke],g.ins_h=(g.ins_h<g.pending_buf_size-5&&(Ee=g.pending_buf_size-5);;){if(g.lookahead<=1){if(it(g),g.lookahead===0&&me===a)return K;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var M=g.block_start+Ee;if((g.strstart===0||g.strstart>=M)&&(g.lookahead=g.strstart-M,g.strstart=M,Te(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-O&&(Te(g,!1),g.strm.avail_out===0))return K}return g.insert=0,me===d?(Te(g,!0),g.strm.avail_out===0?pe:Oe):(g.strstart>g.block_start&&(Te(g,!1),g.strm.avail_out===0),K)}function ce(g,me){for(var Ee,M;;){if(g.lookahead=C&&(g.ins_h=(g.ins_h<=C)if(M=t._tr_tally(g,g.strstart-g.match_start,g.match_length-C),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=C){g.match_length--;do g.strstart++,g.ins_h=(g.ins_h<=C&&(g.ins_h=(g.ins_h<4096)&&(g.match_length=C-1)),g.prev_length>=C&&g.match_length<=g.prev_length){ne=g.strstart+g.lookahead-C,M=t._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-C),g.lookahead-=g.prev_length-1,g.prev_length-=2;do++g.strstart<=ne&&(g.ins_h=(g.ins_h<=C&&g.strstart>0&&(ne=g.strstart-1,M=Ke[ne],M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne])){ve=g.strstart+x;do;while(M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne]&&M===Ke[++ne]&&neg.lookahead&&(g.match_length=g.lookahead)}if(g.match_length>=C?(Ee=t._tr_tally(g,1,g.match_length-C),g.lookahead-=g.match_length,g.strstart+=g.match_length,g.match_length=0):(Ee=t._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++),Ee&&(Te(g,!1),g.strm.avail_out===0))return K}return g.insert=0,me===d?(Te(g,!0),g.strm.avail_out===0?pe:Oe):g.last_lit&&(Te(g,!1),g.strm.avail_out===0)?K:Q}function we(g,me){for(var Ee;;){if(g.lookahead===0&&(it(g),g.lookahead===0)){if(me===a)return K;break}if(g.match_length=0,Ee=t._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++,Ee&&(Te(g,!1),g.strm.avail_out===0))return K}return g.insert=0,me===d?(Te(g,!0),g.strm.avail_out===0?pe:Oe):g.last_lit&&(Te(g,!1),g.strm.avail_out===0)?K:Q}function ge(g,me,Ee,M,ne){this.good_length=g,this.max_lazy=me,this.nice_length=Ee,this.max_chain=M,this.func=ne}var Ce;Ce=[new ge(0,0,0,0,et),new ge(4,4,8,4,ce),new ge(4,5,16,8,ce),new ge(4,6,32,32,ce),new ge(4,4,16,16,I),new ge(8,16,32,32,I),new ge(8,16,128,128,I),new ge(8,32,128,256,I),new ge(32,128,258,1024,I),new ge(32,258,258,4096,I)];function je(g){g.window_size=2*g.w_size,ue(g.head),g.max_lazy_match=Ce[g.level].max_lazy,g.good_match=Ce[g.level].good_length,g.nice_match=Ce[g.level].nice_length,g.max_chain_length=Ce[g.level].max_chain,g.strstart=0,g.block_start=0,g.lookahead=0,g.insert=0,g.match_length=g.prev_length=C-1,g.match_available=0,g.ins_h=0}function $(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=F,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new e.Buf16(T*2),this.dyn_dtree=new e.Buf16((2*b+1)*2),this.bl_tree=new e.Buf16((2*v+1)*2),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(B+1),this.heap=new e.Buf16(2*_+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(2*_+1),ue(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Se(g){var me;return!g||!g.state?z(g,A):(g.total_in=g.total_out=0,g.data_type=W,me=g.state,me.pending=0,me.pending_out=0,me.wrap<0&&(me.wrap=-me.wrap),me.status=me.wrap?X:ye,g.adler=me.wrap===2?0:1,me.last_flush=a,t._tr_init(me),h)}function Ne(g){var me=Se(g);return me===h&&je(g.state),me}function ke(g,me){return!g||!g.state||g.state.wrap!==2?A:(g.state.gzhead=me,h)}function ae(g,me,Ee,M,ne,ve){if(!g)return A;var Ke=1;if(me===ie&&(me=6),M<0?(Ke=0,M=-M):M>15&&(Ke=2,M-=16),ne<1||ne>G||Ee!==F||M<8||M>15||me<0||me>9||ve<0||ve>te)return z(g,A);M===8&&(M=9);var qe=new $;return g.state=qe,qe.strm=g,qe.wrap=Ke,qe.gzhead=null,qe.w_bits=M,qe.w_size=1<l||me<0)return g?z(g,A):A;if(M=g.state,!g.output||!g.input&&g.avail_in!==0||M.status===oe&&me!==d)return z(g,g.avail_out===0?D:A);if(M.strm=g,Ee=M.last_flush,M.last_flush=me,M.status===X)if(M.wrap===2)g.adler=0,Me(M,31),Me(M,139),Me(M,8),M.gzhead?(Me(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),Me(M,M.gzhead.time&255),Me(M,M.gzhead.time>>8&255),Me(M,M.gzhead.time>>16&255),Me(M,M.gzhead.time>>24&255),Me(M,M.level===9?2:M.strategy>=J||M.level<2?4:0),Me(M,M.gzhead.os&255),M.gzhead.extra&&M.gzhead.extra.length&&(Me(M,M.gzhead.extra.length&255),Me(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(g.adler=i(g.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=re):(Me(M,0),Me(M,0),Me(M,0),Me(M,0),Me(M,0),Me(M,M.level===9?2:M.strategy>=J||M.level<2?4:0),Me(M,Le),M.status=ye);else{var Ke=F+(M.w_bits-8<<4)<<8,qe=-1;M.strategy>=J||M.level<2?qe=0:M.level<6?qe=1:M.level===6?qe=2:qe=3,Ke|=qe<<6,M.strstart!==0&&(Ke|=L),Ke+=31-Ke%31,M.status=ye,Ze(M,Ke),M.strstart!==0&&(Ze(M,g.adler>>>16),Ze(M,g.adler&65535)),g.adler=1}if(M.status===re)if(M.gzhead.extra){for(ne=M.pending;M.gzindex<(M.gzhead.extra.length&65535)&&!(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>ne&&(g.adler=i(g.adler,M.pending_buf,M.pending-ne,ne)),xe(g),ne=M.pending,M.pending===M.pending_buf_size));)Me(M,M.gzhead.extra[M.gzindex]&255),M.gzindex++;M.gzhead.hcrc&&M.pending>ne&&(g.adler=i(g.adler,M.pending_buf,M.pending-ne,ne)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=fe)}else M.status=fe;if(M.status===fe)if(M.gzhead.name){ne=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>ne&&(g.adler=i(g.adler,M.pending_buf,M.pending-ne,ne)),xe(g),ne=M.pending,M.pending===M.pending_buf_size)){ve=1;break}M.gzindexne&&(g.adler=i(g.adler,M.pending_buf,M.pending-ne,ne)),ve===0&&(M.gzindex=0,M.status=_e)}else M.status=_e;if(M.status===_e)if(M.gzhead.comment){ne=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>ne&&(g.adler=i(g.adler,M.pending_buf,M.pending-ne,ne)),xe(g),ne=M.pending,M.pending===M.pending_buf_size)){ve=1;break}M.gzindexne&&(g.adler=i(g.adler,M.pending_buf,M.pending-ne,ne)),ve===0&&(M.status=be)}else M.status=be;if(M.status===be&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&xe(g),M.pending+2<=M.pending_buf_size&&(Me(M,g.adler&255),Me(M,g.adler>>8&255),g.adler=0,M.status=ye)):M.status=ye),M.pending!==0){if(xe(g),g.avail_out===0)return M.last_flush=-1,h}else if(g.avail_in===0&&V(me)<=V(Ee)&&me!==d)return z(g,D);if(M.status===oe&&g.avail_in!==0)return z(g,D);if(g.avail_in!==0||M.lookahead!==0||me!==a&&M.status!==oe){var He=M.strategy===J?we(M,me):M.strategy===E?j(M,me):Ce[M.level].func(M,me);if((He===pe||He===Oe)&&(M.status=oe),He===K||He===pe)return g.avail_out===0&&(M.last_flush=-1),h;if(He===Q&&(me===f?t._tr_align(M):me!==l&&(t._tr_stored_block(M,0,0,!1),me===c&&(ue(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),xe(g),g.avail_out===0))return M.last_flush=-1,h}return me!==d?h:M.wrap<=0?y:(M.wrap===2?(Me(M,g.adler&255),Me(M,g.adler>>8&255),Me(M,g.adler>>16&255),Me(M,g.adler>>24&255),Me(M,g.total_in&255),Me(M,g.total_in>>8&255),Me(M,g.total_in>>16&255),Me(M,g.total_in>>24&255)):(Ze(M,g.adler>>>16),Ze(M,g.adler&65535)),xe(g),M.wrap>0&&(M.wrap=-M.wrap),M.pending!==0?h:y)}function Be(g){var me;return!g||!g.state?A:(me=g.state.status,me!==X&&me!==re&&me!==fe&&me!==_e&&me!==be&&me!==ye&&me!==oe?z(g,A):(g.state=null,me===ye?z(g,R):h))}function We(g,me){var Ee=me.length,M,ne,ve,Ke,qe,He,ct,Ut;if(!g||!g.state||(M=g.state,Ke=M.wrap,Ke===2||Ke===1&&M.status!==X||M.lookahead))return A;for(Ke===1&&(g.adler=r(g.adler,me,Ee,0)),M.wrap=0,Ee>=M.w_size&&(Ke===0&&(ue(M.head),M.strstart=0,M.block_start=0,M.insert=0),Ut=new e.Buf8(M.w_size),e.arraySet(Ut,me,Ee-M.w_size,M.w_size,0),me=Ut,Ee=M.w_size),qe=g.avail_in,He=g.next_in,ct=g.input,g.avail_in=Ee,g.next_in=0,g.input=me,it(M);M.lookahead>=C;){ne=M.strstart,ve=M.lookahead-(C-1);do M.ins_h=(M.ins_h<>>24,Z>>>=G,J-=G,G=F>>>16&255,G===0)b[d++]=F&65535;else if(G&16){m=F&65535,G&=15,G&&(J>>=G,J-=G),J<15&&(Z+=_[f++]<>>24,Z>>>=G,J-=G,G=F>>>16&255,G&16){if(S=F&65535,G&=15,Jy){i.msg="invalid distance too far back",a.mode=e;break e}if(Z>>>=G,J-=G,G=d-l,S>G){if(G=S-G,G>R&&a.sane){i.msg="invalid distance too far back",a.mode=e;break e}if(w=0,k=ie,D===0){if(w+=A-G,G2;)b[d++]=k[w++],b[d++]=k[w++],b[d++]=k[w++],m-=3;m&&(b[d++]=k[w++],m>1&&(b[d++]=k[w++]))}else{w=d-S;do b[d++]=b[w++],b[d++]=b[w++],b[d++]=b[w++],m-=3;while(m>2);m&&(b[d++]=b[w++],m>1&&(b[d++]=b[w++]))}}else if(G&64){i.msg="invalid distance code",a.mode=e;break e}else{F=te[(F&65535)+(Z&(1<>3,f-=m,J-=m<<3,Z&=(1<=1&&fe[m]===0;m--);if(S>m&&(S=m),m===0)return Z[J++]=1<<24|64<<16|0,Z[J++]=1<<24|64<<16|0,te.bits=1,0;for(G=1;G0&&(A===s||m!==1))return-1;for(_e[1]=0,W=1;Wr||A===f&&b>i)return 1;for(;;){oe=W-k,E[F]re?(K=be[ye+E[F]],Q=L[X+E[F]]):(K=32+64,Q=0),T=1<>k)+B]=oe<<24|K<<16|Q|0;while(B!==0);for(T=1<>=1;if(T!==0?(v&=T-1,v+=T):v=0,F++,--fe[W]===0){if(W===m)break;W=R[D+E[F]]}if(W>S&&(v&x)!==C){for(k===0&&(k=S),O+=G,w=W-k,_=1<r||A===f&&b>i)return 1;C=v&x,Z[C]=S<<24|w<<16|O-J|0}}return v!==0&&(Z[O+v]=W-k<<24|64<<16|0),te.bits=S,0},sd}var ib;function v$(){if(ib)return rn;ib=1;var e=Df(),t=ym(),r=wm(),i=w$(),s=m$(),a=0,f=1,c=2,d=4,l=5,h=6,y=0,A=1,R=2,D=-2,ie=-3,Z=-4,J=-5,E=8,te=1,q=2,W=3,F=4,G=5,m=6,S=7,w=8,k=9,_=10,b=11,v=12,T=13,B=14,C=15,x=16,O=17,L=18,X=19,re=20,fe=21,_e=22,be=23,ye=24,oe=25,K=26,Q=27,pe=28,Oe=29,Le=30,z=31,V=32,ue=852,xe=592,Te=15,Me=Te;function Ze(ae){return(ae>>>24&255)+(ae>>>8&65280)+((ae&65280)<<8)+((ae&255)<<24)}function Qe(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Xe(ae){var Re;return!ae||!ae.state?D:(Re=ae.state,ae.total_in=ae.total_out=Re.total=0,ae.msg="",Re.wrap&&(ae.adler=Re.wrap&1),Re.mode=te,Re.last=0,Re.havedict=0,Re.dmax=32768,Re.head=null,Re.hold=0,Re.bits=0,Re.lencode=Re.lendyn=new e.Buf32(ue),Re.distcode=Re.distdyn=new e.Buf32(xe),Re.sane=1,Re.back=-1,y)}function it(ae){var Re;return!ae||!ae.state?D:(Re=ae.state,Re.wsize=0,Re.whave=0,Re.wnext=0,Xe(ae))}function et(ae,Re){var P,Be;return!ae||!ae.state||(Be=ae.state,Re<0?(P=0,Re=-Re):(P=(Re>>4)+1,Re<48&&(Re&=15)),Re&&(Re<8||Re>15))?D:(Be.window!==null&&Be.wbits!==Re&&(Be.window=null),Be.wrap=P,Be.wbits=Re,it(ae))}function ce(ae,Re){var P,Be;return ae?(Be=new Qe,ae.state=Be,Be.window=null,P=et(ae,Re),P!==y&&(ae.state=null),P):D}function I(ae){return ce(ae,Me)}var j=!0,we,ge;function Ce(ae){if(j){var Re;for(we=new e.Buf32(512),ge=new e.Buf32(32),Re=0;Re<144;)ae.lens[Re++]=8;for(;Re<256;)ae.lens[Re++]=9;for(;Re<280;)ae.lens[Re++]=7;for(;Re<288;)ae.lens[Re++]=8;for(s(f,ae.lens,0,288,we,0,ae.work,{bits:9}),Re=0;Re<32;)ae.lens[Re++]=5;s(c,ae.lens,0,32,ge,0,ae.work,{bits:5}),j=!1}ae.lencode=we,ae.lenbits=9,ae.distcode=ge,ae.distbits=5}function je(ae,Re,P,Be){var We,g=ae.state;return g.window===null&&(g.wsize=1<=g.wsize?(e.arraySet(g.window,Re,P-g.wsize,g.wsize,0),g.wnext=0,g.whave=g.wsize):(We=g.wsize-g.wnext,We>Be&&(We=Be),e.arraySet(g.window,Re,P-Be,We,g.wnext),Be-=We,Be?(e.arraySet(g.window,Re,P-Be,Be,0),g.wnext=Be,g.whave=g.wsize):(g.wnext+=We,g.wnext===g.wsize&&(g.wnext=0),g.whave>>8&255,P.check=r(P.check,kt,2,0),ne=0,ve=0,P.mode=q;break}if(P.flags=0,P.head&&(P.head.done=!1),!(P.wrap&1)||(((ne&255)<<8)+(ne>>8))%31){ae.msg="incorrect header check",P.mode=Le;break}if((ne&15)!==E){ae.msg="unknown compression method",P.mode=Le;break}if(ne>>>=4,ve-=4,Pt=(ne&15)+8,P.wbits===0)P.wbits=Pt;else if(Pt>P.wbits){ae.msg="invalid window size",P.mode=Le;break}P.dmax=1<>8&1),P.flags&512&&(kt[0]=ne&255,kt[1]=ne>>>8&255,P.check=r(P.check,kt,2,0)),ne=0,ve=0,P.mode=W;case W:for(;ve<32;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>8&255,kt[2]=ne>>>16&255,kt[3]=ne>>>24&255,P.check=r(P.check,kt,4,0)),ne=0,ve=0,P.mode=F;case F:for(;ve<16;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>8),P.flags&512&&(kt[0]=ne&255,kt[1]=ne>>>8&255,P.check=r(P.check,kt,2,0)),ne=0,ve=0,P.mode=G;case G:if(P.flags&1024){for(;ve<16;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>8&255,P.check=r(P.check,kt,2,0)),ne=0,ve=0}else P.head&&(P.head.extra=null);P.mode=m;case m:if(P.flags&1024&&(He=P.length,He>Ee&&(He=Ee),He&&(P.head&&(Pt=P.head.extra_len-P.length,P.head.extra||(P.head.extra=new Array(P.head.extra_len)),e.arraySet(P.head.extra,Be,g,He,Pt)),P.flags&512&&(P.check=r(P.check,Be,He,g)),Ee-=He,g+=He,P.length-=He),P.length))break e;P.length=0,P.mode=S;case S:if(P.flags&2048){if(Ee===0)break e;He=0;do Pt=Be[g+He++],P.head&&Pt&&P.length<65536&&(P.head.name+=String.fromCharCode(Pt));while(Pt&&He>9&1,P.head.done=!0),ae.adler=P.check=0,P.mode=v;break;case _:for(;ve<32;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>=ve&7,ve-=ve&7,P.mode=Q;break}for(;ve<3;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>=1,ve-=1,ne&3){case 0:P.mode=B;break;case 1:if(Ce(P),P.mode=re,Re===h){ne>>>=2,ve-=2;break e}break;case 2:P.mode=O;break;case 3:ae.msg="invalid block type",P.mode=Le}ne>>>=2,ve-=2;break;case B:for(ne>>>=ve&7,ve-=ve&7;ve<32;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>16^65535)){ae.msg="invalid stored block lengths",P.mode=Le;break}if(P.length=ne&65535,ne=0,ve=0,P.mode=C,Re===h)break e;case C:P.mode=x;case x:if(He=P.length,He){if(He>Ee&&(He=Ee),He>M&&(He=M),He===0)break e;e.arraySet(We,Be,g,He,me),Ee-=He,g+=He,M-=He,me+=He,P.length-=He;break}P.mode=v;break;case O:for(;ve<14;){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>=5,ve-=5,P.ndist=(ne&31)+1,ne>>>=5,ve-=5,P.ncode=(ne&15)+4,ne>>>=4,ve-=4,P.nlen>286||P.ndist>30){ae.msg="too many length or distance symbols",P.mode=Le;break}P.have=0,P.mode=L;case L:for(;P.have>>=3,ve-=3}for(;P.have<19;)P.lens[Tn[P.have++]]=0;if(P.lencode=P.lendyn,P.lenbits=7,lr={bits:P.lenbits},Qt=s(a,P.lens,0,19,P.lencode,0,P.work,lr),P.lenbits=lr.bits,Qt){ae.msg="invalid code lengths set",P.mode=Le;break}P.have=0,P.mode=X;case X:for(;P.have>>24,Ot=St>>>16&255,Ft=St&65535,!(dt<=ve);){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>=dt,ve-=dt,P.lens[P.have++]=Ft;else{if(Ft===16){for(jt=dt+2;ve>>=dt,ve-=dt,P.have===0){ae.msg="invalid bit length repeat",P.mode=Le;break}Pt=P.lens[P.have-1],He=3+(ne&3),ne>>>=2,ve-=2}else if(Ft===17){for(jt=dt+3;ve>>=dt,ve-=dt,Pt=0,He=3+(ne&7),ne>>>=3,ve-=3}else{for(jt=dt+7;ve>>=dt,ve-=dt,Pt=0,He=11+(ne&127),ne>>>=7,ve-=7}if(P.have+He>P.nlen+P.ndist){ae.msg="invalid bit length repeat",P.mode=Le;break}for(;He--;)P.lens[P.have++]=Pt}}if(P.mode===Le)break;if(P.lens[256]===0){ae.msg="invalid code -- missing end-of-block",P.mode=Le;break}if(P.lenbits=9,lr={bits:P.lenbits},Qt=s(f,P.lens,0,P.nlen,P.lencode,0,P.work,lr),P.lenbits=lr.bits,Qt){ae.msg="invalid literal/lengths set",P.mode=Le;break}if(P.distbits=6,P.distcode=P.distdyn,lr={bits:P.distbits},Qt=s(c,P.lens,P.nlen,P.ndist,P.distcode,0,P.work,lr),P.distbits=lr.bits,Qt){ae.msg="invalid distances set",P.mode=Le;break}if(P.mode=re,Re===h)break e;case re:P.mode=fe;case fe:if(Ee>=6&&M>=258){ae.next_out=me,ae.avail_out=M,ae.next_in=g,ae.avail_in=Ee,P.hold=ne,P.bits=ve,i(ae,qe),me=ae.next_out,We=ae.output,M=ae.avail_out,g=ae.next_in,Be=ae.input,Ee=ae.avail_in,ne=P.hold,ve=P.bits,P.mode===v&&(P.back=-1);break}for(P.back=0;St=P.lencode[ne&(1<>>24,Ot=St>>>16&255,Ft=St&65535,!(dt<=ve);){if(Ee===0)break e;Ee--,ne+=Be[g++]<>Vt)],dt=St>>>24,Ot=St>>>16&255,Ft=St&65535,!(Vt+dt<=ve);){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>=Vt,ve-=Vt,P.back+=Vt}if(ne>>>=dt,ve-=dt,P.back+=dt,P.length=Ft,Ot===0){P.mode=K;break}if(Ot&32){P.back=-1,P.mode=v;break}if(Ot&64){ae.msg="invalid literal/length code",P.mode=Le;break}P.extra=Ot&15,P.mode=_e;case _e:if(P.extra){for(jt=P.extra;ve>>=P.extra,ve-=P.extra,P.back+=P.extra}P.was=P.length,P.mode=be;case be:for(;St=P.distcode[ne&(1<>>24,Ot=St>>>16&255,Ft=St&65535,!(dt<=ve);){if(Ee===0)break e;Ee--,ne+=Be[g++]<>Vt)],dt=St>>>24,Ot=St>>>16&255,Ft=St&65535,!(Vt+dt<=ve);){if(Ee===0)break e;Ee--,ne+=Be[g++]<>>=Vt,ve-=Vt,P.back+=Vt}if(ne>>>=dt,ve-=dt,P.back+=dt,Ot&64){ae.msg="invalid distance code",P.mode=Le;break}P.offset=Ft,P.extra=Ot&15,P.mode=ye;case ye:if(P.extra){for(jt=P.extra;ve>>=P.extra,ve-=P.extra,P.back+=P.extra}if(P.offset>P.dmax){ae.msg="invalid distance too far back",P.mode=Le;break}P.mode=oe;case oe:if(M===0)break e;if(He=qe-M,P.offset>He){if(He=P.offset-He,He>P.whave&&P.sane){ae.msg="invalid distance too far back",P.mode=Le;break}He>P.wnext?(He-=P.wnext,ct=P.wsize-He):ct=P.wnext-He,He>P.length&&(He=P.length),Ut=P.window}else Ut=We,ct=me-P.offset,He=P.length;He>M&&(He=M),M-=He,P.length-=He;do We[me++]=Ut[ct++];while(--He);P.length===0&&(P.mode=fe);break;case K:if(M===0)break e;We[me++]=P.length,M--,P.mode=fe;break;case Q:if(P.wrap){for(;ve<32;){if(Ee===0)break e;Ee--,ne|=Be[g++]<e.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=h,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}l.prototype.close=function(){if(this.write_in_progress){this.pending_close=!0;return}this.pending_close=!1,t(this.init_done,"close before init"),t(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?i.deflateEnd(this.strm):(this.mode===e.INFLATE||this.mode===e.GUNZIP||this.mode===e.INFLATERAW||this.mode===e.UNZIP)&&s.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null},l.prototype.write=function(h,y,A,R,D,ie,Z){return this._write(!0,h,y,A,R,D,ie,Z)},l.prototype.writeSync=function(h,y,A,R,D,ie,Z){return this._write(!1,h,y,A,R,D,ie,Z)},l.prototype._write=function(h,y,A,R,D,ie,Z,J){if(t.equal(arguments.length,8),t(this.init_done,"write before init"),t(this.mode!==e.NONE,"already finalized"),t.equal(!1,this.write_in_progress,"write already in progress"),t.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,t.equal(!1,y===void 0,"must provide flush value"),this.write_in_progress=!0,y!==e.Z_NO_FLUSH&&y!==e.Z_PARTIAL_FLUSH&&y!==e.Z_SYNC_FLUSH&&y!==e.Z_FULL_FLUSH&&y!==e.Z_FINISH&&y!==e.Z_BLOCK)throw new Error("Invalid flush value");if(A==null&&(A=Fe.Buffer.alloc(0),D=0,R=0),this.strm.avail_in=D,this.strm.input=A,this.strm.next_in=R,this.strm.avail_out=J,this.strm.output=ie,this.strm.next_out=Z,this.flush=y,!h)return this._process(),this._checkError()?this._afterSync():void 0;var E=this;return Fe.process.nextTick(function(){E._process(),E._after()}),this},l.prototype._afterSync=function(){var h=this.strm.avail_out,y=this.strm.avail_in;return this.write_in_progress=!1,[y,h]},l.prototype._process=function(){var h=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=i.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(h=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(h===null)break;if(this.strm.input[h]===c){if(this.gzip_id_bytes_read=1,h++,this.strm.avail_in===1)break}else{this.mode=e.INFLATE;break}case 1:if(h===null)break;this.strm.input[h]===d?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&this.strm.next_in[0]!==0;)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},l.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(this.strm.avail_out!==0&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return this.dictionary==null?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},l.prototype._after=function(){if(this._checkError()){var h=this.strm.avail_out,y=this.strm.avail_in;this.write_in_progress=!1,this.callback(y,h),this.pending_close&&this.close()}},l.prototype._error=function(h){this.strm.msg&&(h=this.strm.msg),this.onerror(h,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},l.prototype.init=function(h,y,A,R,D){t(arguments.length===4||arguments.length===5,"init(windowBits, level, memLevel, strategy, [dictionary])"),t(h>=8&&h<=15,"invalid windowBits"),t(y>=-1&&y<=9,"invalid compression level"),t(A>=1&&A<=9,"invalid memlevel"),t(R===e.Z_FILTERED||R===e.Z_HUFFMAN_ONLY||R===e.Z_RLE||R===e.Z_FIXED||R===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(y,h,A,R,D),this._setDictionary()},l.prototype.params=function(){throw new Error("deflateParams Not supported")},l.prototype.reset=function(){this._reset(),this._setDictionary()},l.prototype._init=function(h,y,A,R,D){switch(this.level=h,this.windowBits=y,this.memLevel=A,this.strategy=R,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,(this.mode===e.GZIP||this.mode===e.GUNZIP)&&(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),(this.mode===e.DEFLATERAW||this.mode===e.INFLATERAW)&&(this.windowBits=-1*this.windowBits),this.strm=new r,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=i.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=D,this.write_in_progress=!1,this.init_done=!0},l.prototype._setDictionary=function(){if(this.dictionary!=null){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=i.deflateSetDictionary(this.strm,this.dictionary);break}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},l.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=i.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=s.inflateReset(this.strm);break}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=l}(Ql)),Ql}var ab;function R$(){return ab||(ab=1,function(e){var t=qn.Buffer,r=hI.Transform,i=S$(),s=ao,a=Uu().ok,f=qn.kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+f.toString(16)+" bytes";i.Z_MIN_WINDOWBITS=8,i.Z_MAX_WINDOWBITS=15,i.Z_DEFAULT_WINDOWBITS=15,i.Z_MIN_CHUNK=64,i.Z_MAX_CHUNK=1/0,i.Z_DEFAULT_CHUNK=16*1024,i.Z_MIN_MEMLEVEL=1,i.Z_MAX_MEMLEVEL=9,i.Z_DEFAULT_MEMLEVEL=8,i.Z_MIN_LEVEL=-1,i.Z_MAX_LEVEL=9,i.Z_DEFAULT_LEVEL=i.Z_DEFAULT_COMPRESSION;for(var d=Object.keys(i),l=0;l=f?X=new RangeError(c):L=t.concat(T,B),T=[],_.close(),v(X,L)}}function Z(_,b){if(typeof b=="string"&&(b=t.from(b)),!t.isBuffer(b))throw new TypeError("Not a string or buffer");var v=_._finishFlushFlag;return _._processChunk(b,v)}function J(_){if(!(this instanceof J))return new J(_);S.call(this,_,i.DEFLATE)}function E(_){if(!(this instanceof E))return new E(_);S.call(this,_,i.INFLATE)}function te(_){if(!(this instanceof te))return new te(_);S.call(this,_,i.GZIP)}function q(_){if(!(this instanceof q))return new q(_);S.call(this,_,i.GUNZIP)}function W(_){if(!(this instanceof W))return new W(_);S.call(this,_,i.DEFLATERAW)}function F(_){if(!(this instanceof F))return new F(_);S.call(this,_,i.INFLATERAW)}function G(_){if(!(this instanceof G))return new G(_);S.call(this,_,i.UNZIP)}function m(_){return _===i.Z_NO_FLUSH||_===i.Z_PARTIAL_FLUSH||_===i.Z_SYNC_FLUSH||_===i.Z_FULL_FLUSH||_===i.Z_FINISH||_===i.Z_BLOCK}function S(_,b){var v=this;if(this._opts=_=_||{},this._chunkSize=_.chunkSize||e.Z_DEFAULT_CHUNK,r.call(this,_),_.flush&&!m(_.flush))throw new Error("Invalid flush flag: "+_.flush);if(_.finishFlush&&!m(_.finishFlush))throw new Error("Invalid flush flag: "+_.finishFlush);if(this._flushFlag=_.flush||i.Z_NO_FLUSH,this._finishFlushFlag=typeof _.finishFlush<"u"?_.finishFlush:i.Z_FINISH,_.chunkSize&&(_.chunkSizee.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+_.chunkSize);if(_.windowBits&&(_.windowBitse.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+_.windowBits);if(_.level&&(_.levele.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+_.level);if(_.memLevel&&(_.memLevele.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+_.memLevel);if(_.strategy&&_.strategy!=e.Z_FILTERED&&_.strategy!=e.Z_HUFFMAN_ONLY&&_.strategy!=e.Z_RLE&&_.strategy!=e.Z_FIXED&&_.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+_.strategy);if(_.dictionary&&!t.isBuffer(_.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new i.Zlib(b);var T=this;this._hadError=!1,this._handle.onerror=function(x,O){w(T),T._hadError=!0;var L=new Error(x);L.errno=O,L.code=e.codes[O],T.emit("error",L)};var B=e.Z_DEFAULT_COMPRESSION;typeof _.level=="number"&&(B=_.level);var C=e.Z_DEFAULT_STRATEGY;typeof _.strategy=="number"&&(C=_.strategy),this._handle.init(_.windowBits||e.Z_DEFAULT_WINDOWBITS,B,_.memLevel||e.Z_DEFAULT_MEMLEVEL,C,_.dictionary),this._buffer=t.allocUnsafe(this._chunkSize),this._offset=0,this._level=B,this._strategy=C,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!v._handle},configurable:!0,enumerable:!0})}s.inherits(S,r),S.prototype.params=function(_,b,v){if(_e.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+_);if(b!=e.Z_FILTERED&&b!=e.Z_HUFFMAN_ONLY&&b!=e.Z_RLE&&b!=e.Z_FIXED&&b!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+b);if(this._level!==_||this._strategy!==b){var T=this;this.flush(i.Z_SYNC_FLUSH,function(){a(T._handle,"zlib binding closed"),T._handle.params(_,b),T._hadError||(T._level=_,T._strategy=b,v&&v())})}else Fe.process.nextTick(v)},S.prototype.reset=function(){return a(this._handle,"zlib binding closed"),this._handle.reset()},S.prototype._flush=function(_){this._transform(t.alloc(0),"",_)},S.prototype.flush=function(_,b){var v=this,T=this._writableState;(typeof _=="function"||_===void 0&&!b)&&(b=_,_=i.Z_FULL_FLUSH),T.ended?b&&Fe.process.nextTick(b):T.ending?b&&this.once("end",b):T.needDrain?b&&this.once("drain",function(){return v.flush(_,b)}):(this._flushFlag=_,this.write(t.alloc(0),"",b))},S.prototype.close=function(_){w(this,_),Fe.process.nextTick(k,this)};function w(_,b){b&&Fe.process.nextTick(b),_._handle&&(_._handle.close(),_._handle=null)}function k(_){_.emit("close")}S.prototype._transform=function(_,b,v){var T,B=this._writableState,C=B.ending||B.ended,x=C&&(!_||B.length===_.length);if(_!==null&&!t.isBuffer(_))return v(new Error("invalid input"));if(!this._handle)return v(new Error("zlib binding closed"));x?T=this._finishFlushFlag:(T=this._flushFlag,_.length>=B.length&&(this._flushFlag=this._opts.flush||i.Z_NO_FLUSH)),this._processChunk(_,T,v)},S.prototype._processChunk=function(_,b,v){var T=_&&_.length,B=this._chunkSize-this._offset,C=0,x=this,O=typeof v=="function";if(!O){var L=[],X=0,re;this.on("error",function(oe){re=oe}),a(this._handle,"zlib binding closed");do var fe=this._handle.writeSync(b,_,C,T,this._buffer,this._offset,B);while(!this._hadError&&ye(fe[0],fe[1]));if(this._hadError)throw re;if(X>=f)throw w(this),new RangeError(c);var _e=t.concat(L,X);return w(this),_e}a(this._handle,"zlib binding closed");var be=this._handle.write(b,_,C,T,this._buffer,this._offset,B);be.buffer=_,be.callback=ye;function ye(oe,K){if(this&&(this.buffer=null,this.callback=null),!x._hadError){var Q=B-K;if(a(Q>=0,"have should not go down"),Q>0){var pe=x._buffer.slice(x._offset,x._offset+Q);x._offset+=Q,O?x.push(pe):(L.push(pe),X+=pe.length)}if((K===0||x._offset>=x._chunkSize)&&(B=x._chunkSize,x._offset=0,x._buffer=t.allocUnsafe(x._chunkSize)),K===0){if(C+=T-oe,T=oe,!O)return!0;var Oe=x._handle.write(b,_,C,T,x._buffer,x._offset,x._chunkSize);Oe.callback=ye,Oe.buffer=_;return}if(!O)return!1;v()}}},s.inherits(J,S),s.inherits(E,S),s.inherits(te,S),s.inherits(q,S),s.inherits(W,S),s.inherits(F,S),s.inherits(G,S)}(Yl)),Yl}Object.defineProperty(ho,"__esModule",{value:!0});ho.InvalidStatusCodeError=ho.InvalidCertError=void 0;const mm=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class Dd extends Error{constructor(t,r){super(t),this.fingerprint256=r}}ho.InvalidCertError=Dd;class Dh extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}ho.InvalidStatusCodeError=Dh;function vm(e,t){if(!t||t==="text"||t==="json")try{let r=new TextDecoder("utf8",{fatal:!0}).decode(e);if(t==="text")return r;try{return JSON.parse(r)}catch(i){if(t==="json")throw i;return r}}catch(r){if(t==="text"||t==="json")throw r}return e}let ub={};function Md(e,t){var A;let r={...mm,...t};const i=bm(),s=g$(),a=R$(),{promisify:f}=ao,{resolve:c}=$h,d=!!/^https/.test(e);let l={method:r.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const h=R=>R.replace(/:| /g,"").toLowerCase();if(r.keepAlive){const R={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},D=[d,d&&((A=r.sslPinnedCertificates)==null?void 0:A.map(ie=>h(ie)).sort())].join();l.agent=ub[D]||(ub[D]=new(d?s:i).Agent(R))}r.type==="json"&&(l.headers["Content-Type"]="application/json"),r.data&&(r.method||(l.method="POST"),l.body=r.type==="json"?JSON.stringify(r.data):r.data),l.headers={...l.headers,...r.headers},r.sslAllowSelfSigned&&(l.rejectUnauthorized=!1);const y=async R=>{const D=R.statusCode;if(r.redirect&&300<=D&&D<400&&R.headers.location){if(r._redirectCount==10)throw new Error("Request failed. Too much redirects.");return r._redirectCount+=1,await Md(c(e,R.headers.location),r)}if(r.expectStatusCode&&D!==r.expectStatusCode)throw R.resume(),new Dh(D);let ie=[];for await(const te of R)ie.push(te);let Z=Fe.Buffer.concat(ie);const J=R.headers["content-encoding"];J==="br"&&(Z=await f(a.brotliDecompress)(Z)),(J==="gzip"||J==="deflate")&&(Z=await f(a.unzip)(Z));const E=vm(Z,r.type);return r.full?{headers:R.headers,status:D,body:E}:E};return new Promise((R,D)=>{var te;const ie=async q=>{if(q&&q.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await Md(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(W){W&&W.fingerprint256&&(q=new Dd(`Self-signed SSL certificate: ${W.fingerprint256}`,W.fingerprint256))}D(q)},Z=(d?s:i).request(e,l,q=>{q.on("error",ie),(async()=>{try{R(await y(q))}catch(W){D(W)}})()});Z.on("error",ie);const J=(te=r.sslPinnedCertificates)==null?void 0:te.map(q=>h(q)),E=q=>{var F;const W=h(((F=q.getPeerCertificate())==null?void 0:F.fingerprint256)||"");if(!(!W&&q.isSessionReused())&&!J.includes(W))return Z.emit("error",new Dd(`Invalid SSL certificate: ${W} Expected: ${J}`,W)),Z.abort()};r.sslPinnedCertificates&&Z.on("socket",q=>{q.listeners("secureConnect").map(F=>(F.name||"").replace("bound ","")).includes("mfetchSecureConnect")||q.on("secureConnect",E.bind(null,q))}),r.keepAlive&&Z.setNoDelay(!0),l.body&&Z.write(l.body),Z.end()})}const A$=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(e=>e.toLowerCase())),I$=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(e=>e.toLowerCase()));async function T$(e,t){let r={...mm,...t};const i=new Headers;r.type==="json"&&i.set("Content-Type","application/json");let s=new URL(e);if(s.username){const d=btoa(`${s.username}:${s.password}`);i.set("Authorization",`Basic ${d}`),s.username="",s.password=""}e=""+s;for(let d in r.headers){const l=d.toLowerCase();(A$.has(l)||r.cors&&!I$.has(l))&&i.set(d,r.headers[d])}let a={headers:i,redirect:r.redirect?"follow":"manual"};r.referrer||(a.referrerPolicy="no-referrer"),r.cors&&(a.mode="cors"),r.data&&(r.method||(a.method="POST"),a.body=r.type==="json"?JSON.stringify(r.data):r.data);const f=await fetch(e,a);if(r.expectStatusCode&&f.status!==r.expectStatusCode)throw new Dh(f.status);const c=vm(new Uint8Array(await f.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(f.headers.entries()),status:f.status,body:c}:c}const O$=!!(typeof Fe.process=="object"&&Fe.process.versions&&Fe.process.versions.node&&Fe.process.versions.v8);function N$(e,t){return(O$?Md:T$)(e,t)}ho.default=N$;Object.defineProperty(os,"__esModule",{value:!0});os.getProvider=os.fetchFromProvider=void 0;const L$=ho,P$=async(e,t)=>(await(0,L$.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;os.fetchFromProvider=P$;const C$=e=>{var t;if(typeof e=="string")return e;if(((t=e==null?void 0:e.connection)==null?void 0:t.url)!==void 0)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};os.getProvider=C$;(function(e){var t=ft&&ft.__createBinding||(Object.create?function(s,a,f,c){c===void 0&&(c=f);var d=Object.getOwnPropertyDescriptor(a,f);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[f]}}),Object.defineProperty(s,c,d)}:function(s,a,f,c){c===void 0&&(c=f),s[c]=a[f]}),r=ft&&ft.__exportStar||function(s,a){for(var f in s)f!=="default"&&!Object.prototype.hasOwnProperty.call(a,f)&&t(a,s,f)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(Ef,e),r(Nf,e),r(Ph,e),r(ha,e),r(Pf,e),r(mr,e),r(mo,e),r(xh,e),r(tm,e),r(xf,e);var i=Mt;Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return i.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),r($f,e),r(os,e)})(WB);var Em={exports:{}};(function(e){(function(t,r){e.exports?e.exports=r():t.log=r()})(ft,function(){var t=function(){},r="undefined",i=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"];function a(ie,Z){var J=ie[Z];if(typeof J.bind=="function")return J.bind(ie);try{return Function.prototype.bind.call(J,ie)}catch{return function(){return Function.prototype.apply.apply(J,[ie,arguments])}}}function f(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(ie){return ie==="debug"&&(ie="log"),typeof console===r?!1:ie==="trace"&&i?f:console[ie]!==void 0?a(console,ie):console.log!==void 0?a(console,"log"):t}function d(ie,Z){for(var J=0;J=0&&S<=E.levels.SILENT){if(te=S,w!==!1&&W(S),d.call(E,S,ie),typeof console===r&&S-1}function Vt(Y,le){var Ae=this.__data__,Ge=Dr(Ae,Y);return Ge<0?(++this.size,Ae.push([Y,le])):Ae[Ge][1]=le,this}Ut.prototype.clear=St,Ut.prototype.delete=dt,Ut.prototype.get=Ot,Ut.prototype.has=Ft,Ut.prototype.set=Vt;function cr(Y){var le=-1,Ae=Y==null?0:Y.length;for(this.clear();++le1?Ae[yt-1]:void 0,lt=yt>2?Ae[2]:void 0;for(Nt=Y.length>3&&typeof Nt=="function"?(yt--,Nt):void 0,lt&&Ra(Ae[0],Ae[1],lt)&&(Nt=yt<3?void 0:Nt,yt=1),le=Object(le);++Ge-1&&Y%1==0&&Y0){if(++le>=s)return arguments[0]}else le=0;return Y.apply(void 0,arguments)}}function Na(Y){if(Y!=null){try{return it.call(Y)}catch{}try{return Y+""}catch{}}return""}function Ao(Y,le){return Y===le||Y!==Y&&le!==le}var bs=Gn(function(){return arguments}())?Gn:function(Y){return zi(Y)&&et.call(Y,"callee")&&!ke.call(Y,"callee")},ys=Array.isArray;function Io(Y){return Y!=null&&Pa(Y.length)&&!ws(Y)}function Wf(Y){return zi(Y)&&Io(Y)}var La=Be||Zf;function ws(Y){if(!hn(Y))return!1;var le=On(Y);return le==R||le==D||le==l||le==te}function Pa(Y){return typeof Y=="number"&&Y>-1&&Y%1==0&&Y<=f}function hn(Y){var le=typeof Y;return Y!=null&&(le=="object"||le=="function")}function zi(Y){return Y!=null&&typeof Y=="object"}function Gf(Y){if(!zi(Y)||On(Y)!=E)return!1;var le=Se(Y);if(le===null)return!0;var Ae=et.call(le,"constructor")&&le.constructor;return typeof Ae=="function"&&Ae instanceof Ae&&it.call(Ae)==j}var Ca=Le?ue(Le):pi;function Vf(Y){return ma(Y,Ba(Y))}function Ba(Y){return Io(Y)?ji(Y,!0):Ff(Y)}var Bt=vo(function(Y,le,Ae){_a(Y,le,Ae)});function Ct(Y){return function(){return Y}}function xa(Y){return Y}function Zf(){return!1}e.exports=Bt})(Ku,Ku.exports);Ku.exports;const B$=Zu.getLogger("http-helpers");B$.setLevel(Sm.levels.INFO);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 + */Ju.exports;(function(e,t){(function(){var r,i="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",c="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",l=500,h="__lodash_placeholder__",y=1,A=2,R=4,D=1,ie=2,Z=1,J=2,E=4,te=8,q=16,W=32,F=64,G=128,m=256,S=512,w=30,k="...",_=800,b=16,v=1,T=2,B=3,C=1/0,x=9007199254740991,O=17976931348623157e292,L=0/0,X=4294967295,re=X-1,fe=X>>>1,_e=[["ary",G],["bind",Z],["bindKey",J],["curry",te],["curryRight",q],["flip",S],["partial",W],["partialRight",F],["rearg",m]],be="[object Arguments]",ye="[object Array]",oe="[object AsyncFunction]",K="[object Boolean]",Q="[object Date]",pe="[object DOMException]",Oe="[object Error]",Le="[object Function]",z="[object GeneratorFunction]",V="[object Map]",ue="[object Number]",xe="[object Null]",Te="[object Object]",Me="[object Promise]",Ze="[object Proxy]",Qe="[object RegExp]",Xe="[object Set]",it="[object String]",et="[object Symbol]",ce="[object Undefined]",I="[object WeakMap]",j="[object WeakSet]",we="[object ArrayBuffer]",ge="[object DataView]",Ce="[object Float32Array]",je="[object Float64Array]",$="[object Int8Array]",Se="[object Int16Array]",Ne="[object Int32Array]",ke="[object Uint8Array]",ae="[object Uint8ClampedArray]",Re="[object Uint16Array]",P="[object Uint32Array]",Be=/\b__p \+= '';/g,We=/\b(__p \+=) '' \+/g,g=/(__e\(.*?\)|\b__t\)) \+\n'';/g,me=/&(?:amp|lt|gt|quot|#39);/g,Ee=/[&<>"']/g,M=RegExp(me.source),ne=RegExp(Ee.source),ve=/<%-([\s\S]+?)%>/g,Ke=/<%([\s\S]+?)%>/g,qe=/<%=([\s\S]+?)%>/g,He=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ct=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,St=/[\\^$.*+?()[\]{}|]/g,dt=RegExp(St.source),Ot=/^\s+/,Ft=/\s/,Vt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,cr=/\{\n\/\* \[wrapped with (.+)\] \*/,zr=/,? & /,Pt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Qt=/[()=,{}\[\]\/\s]/,kt=/\\(\\)?/g,lr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,jt=/\w*$/,Tn=/^[-+]0x[0-9a-f]+$/i,Mi=/^0b[01]+$/i,Ui=/^\[object .+?Constructor\]$/,ki=/^0o[0-7]+$/i,Fi=/^(?:0|[1-9]\d*)$/,ji=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wr=/($^)/,qi=/['\n\r\u2028\u2029\\]/g,Dr="\\ud800-\\udfff",Wn="\\u0300-\\u036f",Hi="\\ufe20-\\ufe2f",On="\\u20d0-\\u20ff",Gn=Wn+Hi+On,gi="\\u2700-\\u27bf",pi="a-z\\xdf-\\xf6\\xf8-\\xff",Ff="\\xac\\xb1\\xd7\\xf7",_a="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jf="\\u2000-\\u206f",qf=" \\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",ba="A-Z\\xc0-\\xd6\\xd8-\\xde",ya="\\ufe0e\\ufe0f",wa=Ff+_a+jf+qf,hs="['’]",Hf="["+Dr+"]",ma="["+wa+"]",vo="["+Gn+"]",va="\\d+",Eo="["+gi+"]",So="["+pi+"]",Ea="[^"+Dr+wa+va+gi+pi+ba+"]",gs="\\ud83c[\\udffb-\\udfff]",Sa="(?:"+vo+"|"+gs+")",Ra="[^"+Dr+"]",ps="(?:\\ud83c[\\udde6-\\uddff]){2}",_s="[\\ud800-\\udbff][\\udc00-\\udfff]",Vn="["+ba+"]",Aa="\\u200d",Ia="(?:"+So+"|"+Ea+")",zf="(?:"+Vn+"|"+Ea+")",Ro="(?:"+hs+"(?:d|ll|m|re|s|t|ve))?",Ta="(?:"+hs+"(?:D|LL|M|RE|S|T|VE))?",Oa=Sa+"?",Na="["+ya+"]?",Ao="(?:"+Aa+"(?:"+[Ra,ps,_s].join("|")+")"+Na+Oa+")*",bs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ys="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Io=Na+Oa+Ao,Wf="(?:"+[Eo,ps,_s].join("|")+")"+Io,La="(?:"+[Ra+vo+"?",vo,ps,_s,Hf].join("|")+")",ws=RegExp(hs,"g"),Pa=RegExp(vo,"g"),hn=RegExp(gs+"(?="+gs+")|"+La+Io,"g"),zi=RegExp([Vn+"?"+So+"+"+Ro+"(?="+[ma,Vn,"$"].join("|")+")",zf+"+"+Ta+"(?="+[ma,Vn+Ia,"$"].join("|")+")",Vn+"?"+Ia+"+"+Ro,Vn+"+"+Ta,ys,bs,va,Wf].join("|"),"g"),Gf=RegExp("["+Aa+Dr+Gn+ya+"]"),Ca=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Vf=["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"],Ba=-1,Bt={};Bt[Ce]=Bt[je]=Bt[$]=Bt[Se]=Bt[Ne]=Bt[ke]=Bt[ae]=Bt[Re]=Bt[P]=!0,Bt[be]=Bt[ye]=Bt[we]=Bt[K]=Bt[ge]=Bt[Q]=Bt[Oe]=Bt[Le]=Bt[V]=Bt[ue]=Bt[Te]=Bt[Qe]=Bt[Xe]=Bt[it]=Bt[I]=!1;var Ct={};Ct[be]=Ct[ye]=Ct[we]=Ct[ge]=Ct[K]=Ct[Q]=Ct[Ce]=Ct[je]=Ct[$]=Ct[Se]=Ct[Ne]=Ct[V]=Ct[ue]=Ct[Te]=Ct[Qe]=Ct[Xe]=Ct[it]=Ct[et]=Ct[ke]=Ct[ae]=Ct[Re]=Ct[P]=!0,Ct[Oe]=Ct[Le]=Ct[I]=!1;var xa={À:"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"},Zf={"&":"&","<":"<",">":">",'"':""","'":"'"},Y={"&":"&","<":"<",">":">",""":'"',"'":"'"},le={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ae=parseFloat,Ge=parseInt,yt=typeof ft=="object"&&ft&&ft.Object===Object&&ft,Nt=typeof self=="object"&&self&&self.Object===Object&&self,lt=yt||Nt||Function("return this")(),pt=t&&!t.nodeType&&t,Rt=pt&&!0&&e&&!e.nodeType&&e,vr=Rt&&Rt.exports===pt,dr=vr&&yt.process,ir=function(){try{var de=Rt&&Rt.require&&Rt.require("util").types;return de||dr&&dr.binding&&dr.binding("util")}catch{}}(),To=ir&&ir.isArrayBuffer,Oo=ir&&ir.isDate,ms=ir&&ir.isMap,jh=ir&&ir.isRegExp,qh=ir&&ir.isSet,Hh=ir&&ir.isTypedArray;function Mr(de,Pe,Ie){switch(Ie.length){case 0:return de.call(Pe);case 1:return de.call(Pe,Ie[0]);case 2:return de.call(Pe,Ie[0],Ie[1]);case 3:return de.call(Pe,Ie[0],Ie[1],Ie[2])}return de.apply(Pe,Ie)}function Pm(de,Pe,Ie,Ve){for(var st=-1,It=de==null?0:de.length;++st-1}function Kf(de,Pe,Ie){for(var Ve=-1,st=de==null?0:de.length;++Ve-1;);return Ie}function Xh(de,Pe){for(var Ie=de.length;Ie--&&No(Pe,de[Ie],0)>-1;);return Ie}function Fm(de,Pe){for(var Ie=de.length,Ve=0;Ie--;)de[Ie]===Pe&&++Ve;return Ve}var jm=Qf(xa),qm=Qf(Zf);function Hm(de){return"\\"+le[de]}function zm(de,Pe){return de==null?r:de[Pe]}function Lo(de){return Gf.test(de)}function Wm(de){return Ca.test(de)}function Gm(de){for(var Pe,Ie=[];!(Pe=de.next()).done;)Ie.push(Pe.value);return Ie}function nc(de){var Pe=-1,Ie=Array(de.size);return de.forEach(function(Ve,st){Ie[++Pe]=[st,Ve]}),Ie}function Yh(de,Pe){return function(Ie){return de(Pe(Ie))}}function yi(de,Pe){for(var Ie=-1,Ve=de.length,st=0,It=[];++Ie-1}function Bv(n,o){var u=this.__data__,p=Ya(u,n);return p<0?(++this.size,u.push([n,o])):u[p][1]=o,this}Zn.prototype.clear=Nv,Zn.prototype.delete=Lv,Zn.prototype.get=Pv,Zn.prototype.has=Cv,Zn.prototype.set=Bv;function Kn(n){var o=-1,u=n==null?0:n.length;for(this.clear();++o=o?n:o)),n}function Kr(n,o,u,p,N,H){var ee,se=o&y,he=o&A,$e=o&R;if(u&&(ee=N?u(n,p,N,H):u(n)),ee!==r)return ee;if(!zt(n))return n;var De=at(n);if(De){if(ee=M1(n),!se)return Or(n,ee)}else{var Ue=br(n),ze=Ue==Le||Ue==z;if(Ri(n))return xg(n,se);if(Ue==Te||Ue==be||ze&&!N){if(ee=he||ze?{}:Qg(n),!se)return he?I1(n,Kv(ee,n)):A1(n,cg(ee,n))}else{if(!Ct[Ue])return N?n:{};ee=U1(n,Ue,se)}}H||(H=new pn);var Je=H.get(n);if(Je)return Je;H.set(n,ee),O0(n)?n.forEach(function(nt){ee.add(Kr(nt,o,u,nt,n,H))}):I0(n)&&n.forEach(function(nt,wt){ee.set(wt,Kr(nt,o,u,wt,n,H))});var rt=$e?he?Nc:Oc:he?Lr:or,gt=De?r:rt(n);return Gr(gt||n,function(nt,wt){gt&&(wt=nt,nt=n[wt]),Ts(ee,wt,Kr(nt,o,u,wt,n,H))}),ee}function Jv(n){var o=or(n);return function(u){return lg(u,n,o)}}function lg(n,o,u){var p=u.length;if(n==null)return!p;for(n=xt(n);p--;){var N=u[p],H=o[N],ee=n[N];if(ee===r&&!(N in n)||!H(ee))return!1}return!0}function dg(n,o,u){if(typeof n!="function")throw new Vr(f);return xs(function(){n.apply(r,u)},o)}function Os(n,o,u,p){var N=-1,H=$a,ee=!0,se=n.length,he=[],$e=o.length;if(!se)return he;u&&(o=qt(o,Ur(u))),p?(H=Kf,ee=!1):o.length>=s&&(H=vs,ee=!1,o=new Vi(o));e:for(;++NN?0:N+u),p=p===r||p>N?N:ht(p),p<0&&(p+=N),p=u>p?0:L0(p);u0&&u(se)?o>1?hr(se,o-1,u,p,N):bi(N,se):p||(N[N.length]=se)}return N}var cc=Fg(),pg=Fg(!0);function Nn(n,o){return n&&cc(n,o,or)}function lc(n,o){return n&&pg(n,o,or)}function eu(n,o){return _i(o,function(u){return ei(n[u])})}function Ki(n,o){o=Ei(o,n);for(var u=0,p=o.length;n!=null&&uo}function Qv(n,o){return n!=null&&Lt.call(n,o)}function e1(n,o){return n!=null&&o in xt(n)}function t1(n,o,u){return n>=_r(o,u)&&n=120&&De.length>=120)?new Vi(ee&&De):r}De=n[0];var Ue=-1,ze=se[0];e:for(;++Ue-1;)se!==n&&Wa.call(se,he,1),Wa.call(n,he,1);return n}function Ig(n,o){for(var u=n?o.length:0,p=u-1;u--;){var N=o[u];if(u==p||N!==H){var H=N;Qn(N)?Wa.call(n,N,1):vc(n,N)}}return n}function yc(n,o){return n+Za(sg()*(o-n+1))}function g1(n,o,u,p){for(var N=-1,H=tr(Va((o-n)/(u||1)),0),ee=Ie(H);H--;)ee[p?H:++N]=n,n+=u;return ee}function wc(n,o){var u="";if(!n||o<1||o>x)return u;do o%2&&(u+=n),o=Za(o/2),o&&(n+=n);while(o);return u}function _t(n,o){return Dc(r0(n,o,Pr),n+"")}function p1(n){return fg(jo(n))}function _1(n,o){var u=jo(n);return lu(u,Zi(o,0,u.length))}function Ps(n,o,u,p){if(!zt(n))return n;o=Ei(o,n);for(var N=-1,H=o.length,ee=H-1,se=n;se!=null&&++NN?0:N+o),u=u>N?N:u,u<0&&(u+=N),N=o>u?0:u-o>>>0,o>>>=0;for(var H=Ie(N);++p>>1,ee=n[H];ee!==null&&!Fr(ee)&&(u?ee<=o:ee=s){var $e=o?null:L1(n);if($e)return Ma($e);ee=!1,N=vs,he=new Vi}else he=o?[]:se;e:for(;++p=p?n:Jr(n,o,u)}var Bg=av||function(n){return lt.clearTimeout(n)};function xg(n,o){if(o)return n.slice();var u=n.length,p=tg?tg(u):new n.constructor(u);return n.copy(p),p}function Ac(n){var o=new n.constructor(n.byteLength);return new Ha(o).set(new Ha(n)),o}function v1(n,o){var u=o?Ac(n.buffer):n.buffer;return new n.constructor(u,n.byteOffset,n.byteLength)}function E1(n){var o=new n.constructor(n.source,jt.exec(n));return o.lastIndex=n.lastIndex,o}function S1(n){return Is?xt(Is.call(n)):{}}function $g(n,o){var u=o?Ac(n.buffer):n.buffer;return new n.constructor(u,n.byteOffset,n.length)}function Dg(n,o){if(n!==o){var u=n!==r,p=n===null,N=n===n,H=Fr(n),ee=o!==r,se=o===null,he=o===o,$e=Fr(o);if(!se&&!$e&&!H&&n>o||H&&ee&&he&&!se&&!$e||p&&ee&&he||!u&&he||!N)return 1;if(!p&&!H&&!$e&&n=se)return he;var $e=u[p];return he*($e=="desc"?-1:1)}}return n.index-o.index}function Mg(n,o,u,p){for(var N=-1,H=n.length,ee=u.length,se=-1,he=o.length,$e=tr(H-ee,0),De=Ie(he+$e),Ue=!p;++se1?u[N-1]:r,ee=N>2?u[2]:r;for(H=n.length>3&&typeof H=="function"?(N--,H):r,ee&&Sr(u[0],u[1],ee)&&(H=N<3?r:H,N=1),o=xt(o);++p-1?N[H?o[ee]:ee]:r}}function Hg(n){return Yn(function(o){var u=o.length,p=u,N=Zr.prototype.thru;for(n&&o.reverse();p--;){var H=o[p];if(typeof H!="function")throw new Vr(f);if(N&&!ee&&fu(H)=="wrapper")var ee=new Zr([],!0)}for(p=ee?p:u;++p1&&vt.reverse(),De&&hese))return!1;var $e=H.get(n),De=H.get(o);if($e&&De)return $e==o&&De==n;var Ue=-1,ze=!0,Je=u&ie?new Vi:r;for(H.set(n,o),H.set(o,n);++Ue1?"& ":"")+o[p],o=o.join(u>2?", ":" "),n.replace(Vt,`{ +/* [wrapped with `+o+`] */ +`)}function F1(n){return at(n)||Yi(n)||!!(ig&&n&&n[ig])}function Qn(n,o){var u=typeof n;return o=o??x,!!o&&(u=="number"||u!="symbol"&&Fi.test(n))&&n>-1&&n%1==0&&n0){if(++o>=_)return arguments[0]}else o=0;return n.apply(r,arguments)}}function lu(n,o){var u=-1,p=n.length,N=p-1;for(o=o===r?p:o;++u1?n[o-1]:r;return u=typeof u=="function"?(n.pop(),u):r,g0(n,u)});function p0(n){var o=U(n);return o.__chain__=!0,o}function XE(n,o){return o(n),n}function du(n,o){return o(n)}var YE=Yn(function(n){var o=n.length,u=o?n[0]:0,p=this.__wrapped__,N=function(H){return fc(H,n)};return o>1||this.__actions__.length||!(p instanceof mt)||!Qn(u)?this.thru(N):(p=p.slice(u,+u+(o?1:0)),p.__actions__.push({func:du,args:[N],thisArg:r}),new Zr(p,this.__chain__).thru(function(H){return o&&!H.length&&H.push(r),H}))});function QE(){return p0(this)}function eS(){return new Zr(this.value(),this.__chain__)}function tS(){this.__values__===r&&(this.__values__=N0(this.value()));var n=this.__index__>=this.__values__.length,o=n?r:this.__values__[this.__index__++];return{done:n,value:o}}function rS(){return this}function nS(n){for(var o,u=this;u instanceof Xa;){var p=u0(u);p.__index__=0,p.__values__=r,o?N.__wrapped__=p:o=p;var N=p;u=u.__wrapped__}return N.__wrapped__=n,o}function iS(){var n=this.__wrapped__;if(n instanceof mt){var o=n;return this.__actions__.length&&(o=new mt(this)),o=o.reverse(),o.__actions__.push({func:du,args:[Mc],thisArg:r}),new Zr(o,this.__chain__)}return this.thru(Mc)}function oS(){return Pg(this.__wrapped__,this.__actions__)}var sS=iu(function(n,o,u){Lt.call(n,u)?++n[u]:Jn(n,u,1)});function aS(n,o,u){var p=at(n)?zh:Xv;return u&&Sr(n,o,u)&&(o=r),p(n,tt(o,3))}function uS(n,o){var u=at(n)?_i:gg;return u(n,tt(o,3))}var fS=qg(f0),cS=qg(c0);function lS(n,o){return hr(hu(n,o),1)}function dS(n,o){return hr(hu(n,o),C)}function hS(n,o,u){return u=u===r?1:ht(u),hr(hu(n,o),u)}function _0(n,o){var u=at(n)?Gr:mi;return u(n,tt(o,3))}function b0(n,o){var u=at(n)?Cm:hg;return u(n,tt(o,3))}var gS=iu(function(n,o,u){Lt.call(n,u)?n[u].push(o):Jn(n,u,[o])});function pS(n,o,u,p){n=Nr(n)?n:jo(n),u=u&&!p?ht(u):0;var N=n.length;return u<0&&(u=tr(N+u,0)),yu(n)?u<=N&&n.indexOf(o,u)>-1:!!N&&No(n,o,u)>-1}var _S=_t(function(n,o,u){var p=-1,N=typeof o=="function",H=Nr(n)?Ie(n.length):[];return mi(n,function(ee){H[++p]=N?Mr(o,ee,u):Ns(ee,o,u)}),H}),bS=iu(function(n,o,u){Jn(n,u,o)});function hu(n,o){var u=at(n)?qt:mg;return u(n,tt(o,3))}function yS(n,o,u,p){return n==null?[]:(at(o)||(o=o==null?[]:[o]),u=p?r:u,at(u)||(u=u==null?[]:[u]),Rg(n,o,u))}var wS=iu(function(n,o,u){n[u?0:1].push(o)},function(){return[[],[]]});function mS(n,o,u){var p=at(n)?Jf:Zh,N=arguments.length<3;return p(n,tt(o,4),u,N,mi)}function vS(n,o,u){var p=at(n)?Bm:Zh,N=arguments.length<3;return p(n,tt(o,4),u,N,hg)}function ES(n,o){var u=at(n)?_i:gg;return u(n,_u(tt(o,3)))}function SS(n){var o=at(n)?fg:p1;return o(n)}function RS(n,o,u){(u?Sr(n,o,u):o===r)?o=1:o=ht(o);var p=at(n)?Gv:_1;return p(n,o)}function AS(n){var o=at(n)?Vv:y1;return o(n)}function IS(n){if(n==null)return 0;if(Nr(n))return yu(n)?Po(n):n.length;var o=br(n);return o==V||o==Xe?n.size:pc(n).length}function TS(n,o,u){var p=at(n)?Xf:w1;return u&&Sr(n,o,u)&&(o=r),p(n,tt(o,3))}var OS=_t(function(n,o){if(n==null)return[];var u=o.length;return u>1&&Sr(n,o[0],o[1])?o=[]:u>2&&Sr(o[0],o[1],o[2])&&(o=[o[0]]),Rg(n,hr(o,1),[])}),gu=uv||function(){return lt.Date.now()};function NS(n,o){if(typeof o!="function")throw new Vr(f);return n=ht(n),function(){if(--n<1)return o.apply(this,arguments)}}function y0(n,o,u){return o=u?r:o,o=n&&o==null?n.length:o,Xn(n,G,r,r,r,r,o)}function w0(n,o){var u;if(typeof o!="function")throw new Vr(f);return n=ht(n),function(){return--n>0&&(u=o.apply(this,arguments)),n<=1&&(o=r),u}}var kc=_t(function(n,o,u){var p=Z;if(u.length){var N=yi(u,ko(kc));p|=W}return Xn(n,p,o,u,N)}),m0=_t(function(n,o,u){var p=Z|J;if(u.length){var N=yi(u,ko(m0));p|=W}return Xn(o,p,n,u,N)});function v0(n,o,u){o=u?r:o;var p=Xn(n,te,r,r,r,r,r,o);return p.placeholder=v0.placeholder,p}function E0(n,o,u){o=u?r:o;var p=Xn(n,q,r,r,r,r,r,o);return p.placeholder=E0.placeholder,p}function S0(n,o,u){var p,N,H,ee,se,he,$e=0,De=!1,Ue=!1,ze=!0;if(typeof n!="function")throw new Vr(f);o=Yr(o)||0,zt(u)&&(De=!!u.leading,Ue="maxWait"in u,H=Ue?tr(Yr(u.maxWait)||0,o):H,ze="trailing"in u?!!u.trailing:ze);function Je(Xt){var bn=p,ri=N;return p=N=r,$e=Xt,ee=n.apply(ri,bn),ee}function rt(Xt){return $e=Xt,se=xs(wt,o),De?Je(Xt):ee}function gt(Xt){var bn=Xt-he,ri=Xt-$e,q0=o-bn;return Ue?_r(q0,H-ri):q0}function nt(Xt){var bn=Xt-he,ri=Xt-$e;return he===r||bn>=o||bn<0||Ue&&ri>=H}function wt(){var Xt=gu();if(nt(Xt))return vt(Xt);se=xs(wt,gt(Xt))}function vt(Xt){return se=r,ze&&p?Je(Xt):(p=N=r,ee)}function jr(){se!==r&&Bg(se),$e=0,p=he=N=se=r}function Rr(){return se===r?ee:vt(gu())}function qr(){var Xt=gu(),bn=nt(Xt);if(p=arguments,N=this,he=Xt,bn){if(se===r)return rt(he);if(Ue)return Bg(se),se=xs(wt,o),Je(he)}return se===r&&(se=xs(wt,o)),ee}return qr.cancel=jr,qr.flush=Rr,qr}var LS=_t(function(n,o){return dg(n,1,o)}),PS=_t(function(n,o,u){return dg(n,Yr(o)||0,u)});function CS(n){return Xn(n,S)}function pu(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new Vr(f);var u=function(){var p=arguments,N=o?o.apply(this,p):p[0],H=u.cache;if(H.has(N))return H.get(N);var ee=n.apply(this,p);return u.cache=H.set(N,ee)||H,ee};return u.cache=new(pu.Cache||Kn),u}pu.Cache=Kn;function _u(n){if(typeof n!="function")throw new Vr(f);return function(){var o=arguments;switch(o.length){case 0:return!n.call(this);case 1:return!n.call(this,o[0]);case 2:return!n.call(this,o[0],o[1]);case 3:return!n.call(this,o[0],o[1],o[2])}return!n.apply(this,o)}}function BS(n){return w0(2,n)}var xS=m1(function(n,o){o=o.length==1&&at(o[0])?qt(o[0],Ur(tt())):qt(hr(o,1),Ur(tt()));var u=o.length;return _t(function(p){for(var N=-1,H=_r(p.length,u);++N=o}),Yi=bg(function(){return arguments}())?bg:function(n){return Zt(n)&&Lt.call(n,"callee")&&!ng.call(n,"callee")},at=Ie.isArray,KS=To?Ur(To):n1;function Nr(n){return n!=null&&bu(n.length)&&!ei(n)}function Jt(n){return Zt(n)&&Nr(n)}function JS(n){return n===!0||n===!1||Zt(n)&&Er(n)==K}var Ri=cv||Xc,XS=Oo?Ur(Oo):i1;function YS(n){return Zt(n)&&n.nodeType===1&&!$s(n)}function QS(n){if(n==null)return!0;if(Nr(n)&&(at(n)||typeof n=="string"||typeof n.splice=="function"||Ri(n)||Fo(n)||Yi(n)))return!n.length;var o=br(n);if(o==V||o==Xe)return!n.size;if(Bs(n))return!pc(n).length;for(var u in n)if(Lt.call(n,u))return!1;return!0}function eR(n,o){return Ls(n,o)}function tR(n,o,u){u=typeof u=="function"?u:r;var p=u?u(n,o):r;return p===r?Ls(n,o,r,u):!!p}function jc(n){if(!Zt(n))return!1;var o=Er(n);return o==Oe||o==pe||typeof n.message=="string"&&typeof n.name=="string"&&!$s(n)}function rR(n){return typeof n=="number"&&og(n)}function ei(n){if(!zt(n))return!1;var o=Er(n);return o==Le||o==z||o==oe||o==Ze}function A0(n){return typeof n=="number"&&n==ht(n)}function bu(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=x}function zt(n){var o=typeof n;return n!=null&&(o=="object"||o=="function")}function Zt(n){return n!=null&&typeof n=="object"}var I0=ms?Ur(ms):s1;function nR(n,o){return n===o||gc(n,o,Pc(o))}function iR(n,o,u){return u=typeof u=="function"?u:r,gc(n,o,Pc(o),u)}function oR(n){return T0(n)&&n!=+n}function sR(n){if(H1(n))throw new st(a);return yg(n)}function aR(n){return n===null}function uR(n){return n==null}function T0(n){return typeof n=="number"||Zt(n)&&Er(n)==ue}function $s(n){if(!Zt(n)||Er(n)!=Te)return!1;var o=za(n);if(o===null)return!0;var u=Lt.call(o,"constructor")&&o.constructor;return typeof u=="function"&&u instanceof u&&Fa.call(u)==iv}var qc=jh?Ur(jh):a1;function fR(n){return A0(n)&&n>=-x&&n<=x}var O0=qh?Ur(qh):u1;function yu(n){return typeof n=="string"||!at(n)&&Zt(n)&&Er(n)==it}function Fr(n){return typeof n=="symbol"||Zt(n)&&Er(n)==et}var Fo=Hh?Ur(Hh):f1;function cR(n){return n===r}function lR(n){return Zt(n)&&br(n)==I}function dR(n){return Zt(n)&&Er(n)==j}var hR=uu(_c),gR=uu(function(n,o){return n<=o});function N0(n){if(!n)return[];if(Nr(n))return yu(n)?gn(n):Or(n);if(Es&&n[Es])return Gm(n[Es]());var o=br(n),u=o==V?nc:o==Xe?Ma:jo;return u(n)}function ti(n){if(!n)return n===0?n:0;if(n=Yr(n),n===C||n===-C){var o=n<0?-1:1;return o*O}return n===n?n:0}function ht(n){var o=ti(n),u=o%1;return o===o?u?o-u:o:0}function L0(n){return n?Zi(ht(n),0,X):0}function Yr(n){if(typeof n=="number")return n;if(Fr(n))return L;if(zt(n)){var o=typeof n.valueOf=="function"?n.valueOf():n;n=zt(o)?o+"":o}if(typeof n!="string")return n===0?n:+n;n=Kh(n);var u=Mi.test(n);return u||ki.test(n)?Ge(n.slice(2),u?2:8):Tn.test(n)?L:+n}function P0(n){return Ln(n,Lr(n))}function pR(n){return n?Zi(ht(n),-x,x):n===0?n:0}function Tt(n){return n==null?"":kr(n)}var _R=Mo(function(n,o){if(Bs(o)||Nr(o)){Ln(o,or(o),n);return}for(var u in o)Lt.call(o,u)&&Ts(n,u,o[u])}),C0=Mo(function(n,o){Ln(o,Lr(o),n)}),wu=Mo(function(n,o,u,p){Ln(o,Lr(o),n,p)}),bR=Mo(function(n,o,u,p){Ln(o,or(o),n,p)}),yR=Yn(fc);function wR(n,o){var u=Do(n);return o==null?u:cg(u,o)}var mR=_t(function(n,o){n=xt(n);var u=-1,p=o.length,N=p>2?o[2]:r;for(N&&Sr(o[0],o[1],N)&&(p=1);++u1),H}),Ln(n,Nc(n),u),p&&(u=Kr(u,y|A|R,P1));for(var N=o.length;N--;)vc(u,o[N]);return u});function UR(n,o){return x0(n,_u(tt(o)))}var kR=Yn(function(n,o){return n==null?{}:d1(n,o)});function x0(n,o){if(n==null)return{};var u=qt(Nc(n),function(p){return[p]});return o=tt(o),Ag(n,u,function(p,N){return o(p,N[0])})}function FR(n,o,u){o=Ei(o,n);var p=-1,N=o.length;for(N||(N=1,n=r);++po){var p=n;n=o,o=p}if(u||n%1||o%1){var N=sg();return _r(n+N*(o-n+Ae("1e-"+((N+"").length-1))),o)}return yc(n,o)}var XR=Uo(function(n,o,u){return o=o.toLowerCase(),n+(u?M0(o):o)});function M0(n){return Wc(Tt(n).toLowerCase())}function U0(n){return n=Tt(n),n&&n.replace(ji,jm).replace(Pa,"")}function YR(n,o,u){n=Tt(n),o=kr(o);var p=n.length;u=u===r?p:Zi(ht(u),0,p);var N=u;return u-=o.length,u>=0&&n.slice(u,N)==o}function QR(n){return n=Tt(n),n&&ne.test(n)?n.replace(Ee,qm):n}function eA(n){return n=Tt(n),n&&dt.test(n)?n.replace(St,"\\$&"):n}var tA=Uo(function(n,o,u){return n+(u?"-":"")+o.toLowerCase()}),rA=Uo(function(n,o,u){return n+(u?" ":"")+o.toLowerCase()}),nA=jg("toLowerCase");function iA(n,o,u){n=Tt(n),o=ht(o);var p=o?Po(n):0;if(!o||p>=o)return n;var N=(o-p)/2;return au(Za(N),u)+n+au(Va(N),u)}function oA(n,o,u){n=Tt(n),o=ht(o);var p=o?Po(n):0;return o&&p>>0,u?(n=Tt(n),n&&(typeof o=="string"||o!=null&&!qc(o))&&(o=kr(o),!o&&Lo(n))?Si(gn(n),0,u):n.split(o,u)):[]}var dA=Uo(function(n,o,u){return n+(u?" ":"")+Wc(o)});function hA(n,o,u){return n=Tt(n),u=u==null?0:Zi(ht(u),0,n.length),o=kr(o),n.slice(u,u+o.length)==o}function gA(n,o,u){var p=U.templateSettings;u&&Sr(n,o,u)&&(o=r),n=Tt(n),o=wu({},o,p,Zg);var N=wu({},o.imports,p.imports,Zg),H=or(N),ee=rc(N,H),se,he,$e=0,De=o.interpolate||Wr,Ue="__p += '",ze=ic((o.escape||Wr).source+"|"+De.source+"|"+(De===qe?lr:Wr).source+"|"+(o.evaluate||Wr).source+"|$","g"),Je="//# sourceURL="+(Lt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ba+"]")+` +`;n.replace(ze,function(nt,wt,vt,jr,Rr,qr){return vt||(vt=jr),Ue+=n.slice($e,qr).replace(qi,Hm),wt&&(se=!0,Ue+=`' + +__e(`+wt+`) + +'`),Rr&&(he=!0,Ue+=`'; +`+Rr+`; +__p += '`),vt&&(Ue+=`' + +((__t = (`+vt+`)) == null ? '' : __t) + +'`),$e=qr+nt.length,nt}),Ue+=`'; +`;var rt=Lt.call(o,"variable")&&o.variable;if(!rt)Ue=`with (obj) { +`+Ue+` +} +`;else if(Qt.test(rt))throw new st(c);Ue=(he?Ue.replace(Be,""):Ue).replace(We,"$1").replace(g,"$1;"),Ue="function("+(rt||"obj")+`) { +`+(rt?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(se?", __e = _.escape":"")+(he?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+Ue+`return __p +}`;var gt=F0(function(){return It(H,Je+"return "+Ue).apply(r,ee)});if(gt.source=Ue,jc(gt))throw gt;return gt}function pA(n){return Tt(n).toLowerCase()}function _A(n){return Tt(n).toUpperCase()}function bA(n,o,u){if(n=Tt(n),n&&(u||o===r))return Kh(n);if(!n||!(o=kr(o)))return n;var p=gn(n),N=gn(o),H=Jh(p,N),ee=Xh(p,N)+1;return Si(p,H,ee).join("")}function yA(n,o,u){if(n=Tt(n),n&&(u||o===r))return n.slice(0,Qh(n)+1);if(!n||!(o=kr(o)))return n;var p=gn(n),N=Xh(p,gn(o))+1;return Si(p,0,N).join("")}function wA(n,o,u){if(n=Tt(n),n&&(u||o===r))return n.replace(Ot,"");if(!n||!(o=kr(o)))return n;var p=gn(n),N=Jh(p,gn(o));return Si(p,N).join("")}function mA(n,o){var u=w,p=k;if(zt(o)){var N="separator"in o?o.separator:N;u="length"in o?ht(o.length):u,p="omission"in o?kr(o.omission):p}n=Tt(n);var H=n.length;if(Lo(n)){var ee=gn(n);H=ee.length}if(u>=H)return n;var se=u-Po(p);if(se<1)return p;var he=ee?Si(ee,0,se).join(""):n.slice(0,se);if(N===r)return he+p;if(ee&&(se+=he.length-se),qc(N)){if(n.slice(se).search(N)){var $e,De=he;for(N.global||(N=ic(N.source,Tt(jt.exec(N))+"g")),N.lastIndex=0;$e=N.exec(De);)var Ue=$e.index;he=he.slice(0,Ue===r?se:Ue)}}else if(n.indexOf(kr(N),se)!=se){var ze=he.lastIndexOf(N);ze>-1&&(he=he.slice(0,ze))}return he+p}function vA(n){return n=Tt(n),n&&M.test(n)?n.replace(me,Jm):n}var EA=Uo(function(n,o,u){return n+(u?" ":"")+o.toUpperCase()}),Wc=jg("toUpperCase");function k0(n,o,u){return n=Tt(n),o=u?r:o,o===r?Wm(n)?Qm(n):Dm(n):n.match(o)||[]}var F0=_t(function(n,o){try{return Mr(n,r,o)}catch(u){return jc(u)?u:new st(u)}}),SA=Yn(function(n,o){return Gr(o,function(u){u=Pn(u),Jn(n,u,kc(n[u],n))}),n});function RA(n){var o=n==null?0:n.length,u=tt();return n=o?qt(n,function(p){if(typeof p[1]!="function")throw new Vr(f);return[u(p[0]),p[1]]}):[],_t(function(p){for(var N=-1;++Nx)return[];var u=X,p=_r(n,X);o=tt(o),n-=X;for(var N=tc(p,o);++u0||o<0)?new mt(u):(n<0?u=u.takeRight(-n):n&&(u=u.drop(n)),o!==r&&(o=ht(o),u=o<0?u.dropRight(-o):u.take(o-n)),u)},mt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},mt.prototype.toArray=function(){return this.take(X)},Nn(mt.prototype,function(n,o){var u=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),N=U[p?"take"+(o=="last"?"Right":""):o],H=p||/^find/.test(o);N&&(U.prototype[o]=function(){var ee=this.__wrapped__,se=p?[1]:arguments,he=ee instanceof mt,$e=se[0],De=he||at(ee),Ue=function(wt){var vt=N.apply(U,bi([wt],se));return p&&ze?vt[0]:vt};De&&u&&typeof $e=="function"&&$e.length!=1&&(he=De=!1);var ze=this.__chain__,Je=!!this.__actions__.length,rt=H&&!ze,gt=he&&!Je;if(!H&&De){ee=gt?ee:new mt(this);var nt=n.apply(ee,se);return nt.__actions__.push({func:du,args:[Ue],thisArg:r}),new Zr(nt,ze)}return rt&>?n.apply(this,se):(nt=this.thru(Ue),rt?p?nt.value()[0]:nt.value():nt)})}),Gr(["pop","push","shift","sort","splice","unshift"],function(n){var o=Ua[n],u=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",p=/^(?:pop|shift)$/.test(n);U.prototype[n]=function(){var N=arguments;if(p&&!this.__chain__){var H=this.value();return o.apply(at(H)?H:[],N)}return this[u](function(ee){return o.apply(at(ee)?ee:[],N)})}}),Nn(mt.prototype,function(n,o){var u=U[o];if(u){var p=u.name+"";Lt.call($o,p)||($o[p]=[]),$o[p].push({name:o,func:u})}}),$o[ou(r,J).name]=[{name:"wrapper",func:r}],mt.prototype.clone=vv,mt.prototype.reverse=Ev,mt.prototype.value=Sv,U.prototype.at=YE,U.prototype.chain=QE,U.prototype.commit=eS,U.prototype.next=tS,U.prototype.plant=nS,U.prototype.reverse=iS,U.prototype.toJSON=U.prototype.valueOf=U.prototype.value=oS,U.prototype.first=U.prototype.head,Es&&(U.prototype[Es]=rS),U},Co=ev();Rt?((Rt.exports=Co)._=Co,pt._=Co):lt._=Co}).call(ft)})(Ju,Ju.exports);Ju.exports;zB();const Ws={IFRAME_STATUS:"iframe_status",CREATE_WINDOW:"create_window",CLOSE_WINDOW:"close_window",USER_LOGGED_IN:"user_logged_in",USER_LOGGED_OUT:"user_logged_out"},$n={LOGOUT:"logout",WALLET_INSTANCE_ID:"wallet_instance_id",USER_INFO:"user_info",SET_PROVIDER:"set_provider",TOPUP:"topup",IFRAME_STATUS:"iframe_status",OPENED_WINDOW:"opened_window",CLOSED_WINDOW:"closed_window",GET_PROVIDER_STATE:"get_provider_state",LOGIN_WITH_PRIVATE_KEY:"login_with_private_key"},x$={GET_PROVIDER_STATE:"wallet_get_provider_state"},ud={ACCOUNTS_CHANGED:"wallet_accounts_changed",CHAIN_CHANGED:"wallet_chain_changed",UNLOCK_STATE_CHANGED:"wallet_unlock_state_changed"};function $$(e){return function(r,i,s){s(a=>{i.error&&Zu.warn(`Error in RPC response: +`,i),!r.isTorusInternal&&(Zu.info(`RPC (${e.origin}):`,r,"->",i),a())})}}var fb;(function(e){e.approved="approved",e.cancelled="cancelled",e.confirmed="confirmed",e.failed="failed",e.finalized="finalized",e.processed="processed",e.rejected="rejected",e.signed="signed",e.submitted="submitted",e.unapproved="unapproved",e.dropped="dropped",e.expired="expired"})(fb||(fb={}));var D$={exports:{}},Mh={},Uh={};Object.defineProperty(Uh,"__esModule",{value:!0});function M$(e){var t=4,r=e.length,i=r%t;if(!i)return e;var s=r,a=t-i,f=r+a,c=Fe.Buffer.alloc(f);for(c.write(e);a--;)c.write("=",s++);return c.toString()}Uh.default=M$;Object.defineProperty(Mh,"__esModule",{value:!0});var U$=Uh;function Rm(e,t){return t===void 0&&(t="utf8"),Fe.Buffer.isBuffer(e)?Ud(e.toString("base64")):Ud(Fe.Buffer.from(e,t).toString("base64"))}function k$(e,t){return t===void 0&&(t="utf8"),Fe.Buffer.from(kh(e),"base64").toString(t)}function kh(e){return e=e.toString(),U$.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function Ud(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function F$(e){return Fe.Buffer.from(kh(e),"base64")}var ds=Rm;ds.encode=Rm;ds.decode=k$;ds.toBase64=kh;ds.fromBase64=Ud;ds.toBuffer=F$;Mh.default=ds;(function(e){e.exports=Mh.default,e.exports.default=e.exports})(D$);var Am={};const cb=[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];Am.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],y=e[9]^e[19]^e[29]^e[39]^e[49];let A=h^(s<<1|a>>>31),R=y^(a<<1|s>>>31);const D=e[0]^A,ie=e[1]^R,Z=e[10]^A,J=e[11]^R,E=e[20]^A,te=e[21]^R,q=e[30]^A,W=e[31]^R,F=e[40]^A,G=e[41]^R;A=r^(f<<1|c>>>31),R=i^(c<<1|f>>>31);const m=e[2]^A,S=e[3]^R,w=e[12]^A,k=e[13]^R,_=e[22]^A,b=e[23]^R,v=e[32]^A,T=e[33]^R,B=e[42]^A,C=e[43]^R;A=s^(d<<1|l>>>31),R=a^(l<<1|d>>>31);const x=e[4]^A,O=e[5]^R,L=e[14]^A,X=e[15]^R,re=e[24]^A,fe=e[25]^R,_e=e[34]^A,be=e[35]^R,ye=e[44]^A,oe=e[45]^R;A=f^(h<<1|y>>>31),R=c^(y<<1|h>>>31);const K=e[6]^A,Q=e[7]^R,pe=e[16]^A,Oe=e[17]^R,Le=e[26]^A,z=e[27]^R,V=e[36]^A,ue=e[37]^R,xe=e[46]^A,Te=e[47]^R;A=d^(r<<1|i>>>31),R=l^(i<<1|r>>>31);const Me=e[8]^A,Ze=e[9]^R,Qe=e[18]^A,Xe=e[19]^R,it=e[28]^A,et=e[29]^R,ce=e[38]^A,I=e[39]^R,j=e[48]^A,we=e[49]^R,ge=D,Ce=ie,je=J<<4|Z>>>28,$=Z<<4|J>>>28,Se=E<<3|te>>>29,Ne=te<<3|E>>>29,ke=W<<9|q>>>23,ae=q<<9|W>>>23,Re=F<<18|G>>>14,P=G<<18|F>>>14,Be=m<<1|S>>>31,We=S<<1|m>>>31,g=k<<12|w>>>20,me=w<<12|k>>>20,Ee=_<<10|b>>>22,M=b<<10|_>>>22,ne=T<<13|v>>>19,ve=v<<13|T>>>19,Ke=B<<2|C>>>30,qe=C<<2|B>>>30,He=O<<30|x>>>2,ct=x<<30|O>>>2,Ut=L<<6|X>>>26,St=X<<6|L>>>26,dt=fe<<11|re>>>21,Ot=re<<11|fe>>>21,Ft=_e<<15|be>>>17,Vt=be<<15|_e>>>17,cr=oe<<29|ye>>>3,zr=ye<<29|oe>>>3,Pt=K<<28|Q>>>4,Qt=Q<<28|K>>>4,kt=Oe<<23|pe>>>9,lr=pe<<23|Oe>>>9,jt=Le<<25|z>>>7,Tn=z<<25|Le>>>7,Mi=V<<21|ue>>>11,Ui=ue<<21|V>>>11,ki=Te<<24|xe>>>8,Fi=xe<<24|Te>>>8,ji=Me<<27|Ze>>>5,Wr=Ze<<27|Me>>>5,qi=Qe<<20|Xe>>>12,Dr=Xe<<20|Qe>>>12,Wn=et<<7|it>>>25,Hi=it<<7|et>>>25,On=ce<<8|I>>>24,Gn=I<<8|ce>>>24,gi=j<<14|we>>>18,pi=we<<14|j>>>18;e[0]=ge^~g&dt,e[1]=Ce^~me&Ot,e[10]=Pt^~qi&Se,e[11]=Qt^~Dr&Ne,e[20]=Be^~Ut&jt,e[21]=We^~St&Tn,e[30]=ji^~je&Ee,e[31]=Wr^~$&M,e[40]=He^~kt&Wn,e[41]=ct^~lr&Hi,e[2]=g^~dt&Mi,e[3]=me^~Ot&Ui,e[12]=qi^~Se&ne,e[13]=Dr^~Ne&ve,e[22]=Ut^~jt&On,e[23]=St^~Tn&Gn,e[32]=je^~Ee&Ft,e[33]=$^~M&Vt,e[42]=kt^~Wn&ke,e[43]=lr^~Hi&ae,e[4]=dt^~Mi&gi,e[5]=Ot^~Ui&pi,e[14]=Se^~ne&cr,e[15]=Ne^~ve&zr,e[24]=jt^~On&Re,e[25]=Tn^~Gn&P,e[34]=Ee^~Ft&ki,e[35]=M^~Vt&Fi,e[44]=Wn^~ke&Ke,e[45]=Hi^~ae&qe,e[6]=Mi^~gi&ge,e[7]=Ui^~pi&Ce,e[16]=ne^~cr&Pt,e[17]=ve^~zr&Qt,e[26]=On^~Re&Be,e[27]=Gn^~P&We,e[36]=Ft^~ki&ji,e[37]=Vt^~Fi&Wr,e[46]=ke^~Ke&He,e[47]=ae^~qe&ct,e[8]=gi^~ge&g,e[9]=pi^~Ce&me,e[18]=cr^~Pt&qi,e[19]=zr^~Qt&Dr,e[28]=Re^~Be&Ut,e[29]=P^~We&St,e[38]=ki^~ji&je,e[39]=Fi^~Wr&$,e[48]=Ke^~He&kt,e[49]=qe^~ct&lr,e[0]^=cb[t*2],e[1]^=cb[t*2+1]}};const Xu=Am;function pa(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}pa.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};pa.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Xu.p1600(this.state),this.count=0);return t};pa.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};const j$=()=>gI(32).toString("hex");function Cu(){}const lb="SYN",fd="ACK",db="BRK";class hb extends ss.Duplex{constructor(t){let{name:r,target:i,targetWindow:s=window,targetOrigin:a="*"}=t;if(super({objectMode:!0}),Ye(this,"_init",void 0),Ye(this,"_haveSyn",void 0),Ye(this,"_name",void 0),Ye(this,"_target",void 0),Ye(this,"_targetWindow",void 0),Ye(this,"_targetOrigin",void 0),Ye(this,"_onMessage",void 0),Ye(this,"_synIntervalId",void 0),!r||!i)throw new Error("Invalid input.");this._init=!1,this._haveSyn=!1,this._name=r,this._target=i,this._targetWindow=s,this._targetOrigin=a,this._onMessage=this.onMessage.bind(this),this._synIntervalId=null,window.addEventListener("message",this._onMessage,!1),this._handShake()}_break(){this.cork(),this._write(db,null,Cu),this._haveSyn=!1,this._init=!1}_handShake(){this._write(lb,null,Cu),this.cork()}_onData(t){if(!this._init)t===lb?(this._haveSyn=!0,this._write(fd,null,Cu)):t===fd&&(this._init=!0,this._haveSyn||this._write(fd,null,Cu),this.uncork());else if(t===db)this._break();else try{this.push(t)}catch(r){this.emit("error",r)}}_postMessage(t){const r=this._targetOrigin;this._targetWindow.postMessage({target:this._target,data:t},r)}onMessage(t){const r=t.data;this._targetOrigin!=="*"&&t.origin!==this._targetOrigin||t.source!==this._targetWindow||typeof r!="object"||r.target!==this._name||!r.data||this._onData(r.data)}_read(){}_write(t,r,i){this._postMessage(t),i()}_destroy(){window.removeEventListener("message",this._onMessage,!1)}}function gb(e,t,r){try{Reflect.apply(e,t,r)}catch(i){setTimeout(()=>{throw i})}}function q$(e){const t=e.length,r=new Array(t);for(let i=0;i1?s-1:0),f=1;f0&&([d]=a),d instanceof Error)throw d;const l=new Error(`Unhandled error.${d?` (${d.message})`:""}`);throw l.context=d,l}const c=i[t];if(c===void 0)return!1;if(typeof c=="function")gb(c,this,a);else{const d=c.length,l=q$(c);for(let h=0;h2&&arguments[2]!==void 0?arguments[2]:!0;return(i,s)=>{i||s.error?t(i||s.error):!r||Array.isArray(s)?e(s):e(s.result)}};function H$(){const e={};function t(){return!1}const r=new Mf;function i(d){const l=e[d.id];if(!l)throw new Error(`StreamMiddleware - Unknown response id "${d.id}"`);delete e[d.id],Object.assign(l.res,d),setTimeout(l.end)}function s(d){r.emit("notification",d)}function a(d,l,h){let y;try{!d.id?s(d):i(d)}catch(A){y=A}h(y)}const f=new ss.Duplex({objectMode:!0,read:t,write:a});return{events:r,middleware:(d,l,h,y)=>{f.push(d),e[d.id]={req:d,res:l,next:h,end:y}},stream:f}}function z$(){return(e,t,r,i)=>{const s=e.id,a=j$();e.id=a,t.id=a,r(f=>{e.id=s,t.id=s,f()})}}function pb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function W$(e){for(var t=1;t{const f=d=>{const l=d||r.error;l&&(r.error=Rn.serializeError(l)),a([l,!0])},c=d=>{r.error?f(r.error):(d&&(typeof d!="function"&&f(new Gs({code:-32603,message:"JRPCEngine: 'next' return handlers must be functions"})),s.push(d)),a([null,!1]))};try{i(t,r,c,f)}catch(d){f(d)}})}static async _runReturnHandlers(t){for(const r of t)await new Promise((i,s)=>{r(a=>a?s(a):i())})}static _checkForCompletion(t,r,i){if(!("result"in r)&&!("error"in r))throw new Gs({code:-32603,message:"Response has no error or result for request"});if(!i)throw new Gs({code:-32603,message:"Nothing ended request"})}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,i,s)=>{try{const[a,f,c]=await si._runAllMiddleware(t,r,this._middleware);return f?(await si._runReturnHandlers(c),s(a)):i(async d=>{try{await si._runReturnHandlers(c)}catch(l){return d(l)}return d()})}catch(a){return s(a)}}}async _handleBatch(t,r){try{const i=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,i):i}catch(i){if(r)return r(i);throw i}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(i,s)=>{r(s)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const f=new Gs({code:-32603,message:"request must be plain object"});return r(f,{id:void 0,jsonrpc:"2.0",error:f})}if(typeof t.method!="string"){const f=new Gs({code:-32603,message:"method must be string"});return r(f,{id:t.id,jsonrpc:"2.0",error:f})}const i=W$({},t),s={id:i.id,jsonrpc:i.jsonrpc};let a=null;try{await this._processRequest(i,s)}catch(f){a=f}return a&&(delete s.result,s.error||(s.error=Rn.serializeError(a))),r(a,s)}async _processRequest(t,r){const[i,s,a]=await si._runAllMiddleware(t,r,this._middleware);if(si._checkForCompletion(t,r,s),await si._runReturnHandlers(a),i)throw i}}class G$ extends ss.Duplex{constructor(t){let{parent:r,name:i}=t;super({objectMode:!0}),Ye(this,"_parent",void 0),Ye(this,"_name",void 0),this._parent=r,this._name=i}_read(){}_write(t,r,i){this._parent.push({name:this._name,data:t}),i()}}function _b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function bb(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{};super(bb(bb({},t),{},{objectMode:!0})),Ye(this,"_substreams",void 0),Ye(this,"getStream",void 0),this._substreams={}}createStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);const r=new G$({parent:this,name:t});return this._substreams[t]=r,Z$(this,i=>r.destroy(i||void 0)),r}ignoreStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);this._substreams[t]=yb}_read(){}_write(t,r,i){const{name:s,data:a}=t;if(!s)return window.console.warn(`ObjectMultiplex - malformed chunk without name "${t}"`),i();const f=this._substreams[s];return f?(f!==yb&&f.push(a),i()):(window.console.warn(`ObjectMultiplex - orphaned data for stream "${s}"`),i())}}function Z$(e,t){const r=vB(t);A_(e,{readable:!1},r),A_(e,{writable:!1},r)}const jn=e=>e!==null&&typeof e=="object"&&typeof e.pipe=="function";jn.writable=e=>jn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object";jn.readable=e=>jn(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object";jn.duplex=e=>jn.writable(e)&&jn.readable(e);jn.transform=e=>jn.duplex(e)&&typeof e._transform=="function";var K$=jn,J$=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,s,a;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(s=i;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(a=Object.keys(t),i=a.length,i!==Object.keys(r).length)return!1;for(s=i;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[s]))return!1;for(s=i;s--!==0;){var f=a[s];if(!e(t[f],r[f]))return!1}return!0}return t!==t&&r!==r};const X$=po(J$);var Y$="0.3.4",kn={errors:{disconnected:()=>"Torus: Lost connection to Torus.",permanentlyDisconnected:()=>"Torus: Disconnected from iframe. Page reload required.",unsupportedSync:e=>`Torus: The Torus Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidOptions:e=>`Invalid options. Received: { maxEventListeners: ${e}}`,invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`Torus: Connected to chain with ID "${e}".`},warnings:{}};const SD={MOONPAY:"moonpay",WYRE:"wyre",RAMPNETWORK:"rampnetwork",XANPOOL:"xanpool",MERCURYO:"mercuryo",TRANSAK:"transak"},Q$={PRODUCTION:"production",DEVELOPMENT:"development",TESTING:"testing"},Zs={BOTTOM_LEFT:"bottom-left",TOP_LEFT:"top-left",BOTTOM_RIGHT:"bottom-right",TOP_RIGHT:"top-right"},cd={GOOGLE:"google",FACEBOOK:"facebook",REDDIT:"reddit",DISCORD:"discord",TWITCH:"twitch",APPLE:"apple",LINE:"line",GITHUB:"github",KAKAO:"kakao",LINKEDIN:"linkedin",TWITTER:"twitter",WEIBO:"weibo",WECHAT:"wechat",EMAIL_PASSWORDLESS:"email_passwordless"},eD={en:{embed:{continue:"Continue",actionRequired:"Authorization required",pendingAction:"Click continue to proceed with your request in a popup",cookiesRequired:"Cookies Required",enableCookies:"Please enable cookies in your browser preferences to access Torus",clickHere:"More Info"}},de:{embed:{continue:"Fortsetzen",actionRequired:"Autorisierung erforderlich",pendingAction:"Klicken Sie in einem Popup auf Weiter, um mit Ihrer Anfrage fortzufahren",cookiesRequired:"Cookies benötigt",enableCookies:"Bitte aktivieren Sie Cookies in Ihren Browsereinstellungen, um auf Torus zuzugreifen",clickHere:"Mehr Info"}},ja:{embed:{continue:"継続する",actionRequired:"認証が必要です",pendingAction:"続行をクリックして、ポップアップでリクエストを続行します",cookiesRequired:"必要なクッキー",enableCookies:"Torusにアクセスするには、ブラウザの設定でCookieを有効にしてください。",clickHere:"詳しくは"}},ko:{embed:{continue:"계속하다",actionRequired:"승인 필요",pendingAction:"팝업에서 요청을 진행하려면 계속을 클릭하십시오.",cookiesRequired:"쿠키 필요",enableCookies:"브라우저 환경 설정에서 쿠키를 활성화하여 Torus에 액세스하십시오.",clickHere:"더 많은 정보"}},zh:{embed:{continue:"继续",actionRequired:"需要授权",pendingAction:"单击继续以在弹出窗口中继续您的请求",cookiesRequired:"必填Cookie",enableCookies:"请在您的浏览器首选项中启用cookie以访问Torus。",clickHere:"更多信息"}}};var Fh={supportedVerifierList:[cd.GOOGLE,cd.REDDIT,cd.DISCORD],api:"https://api.tor.us",translations:eD,prodTorusUrl:"",localStorageKeyPrefix:"torus-"},$t=Zu.getLogger("solana-embed");function tD(){return(e,t,r)=>{(typeof e.method!="string"||!e.method)&&(t.error=Rn.ethErrors.rpc.invalidRequest({message:"The request 'method' must be a non-empty string.",data:e})),r(i=>{const{error:s}=t;return s&&$t.error(`Torus - RPC Error: ${s.message}`,s),i()})}}function rD(e,t,r){let i=`Torus: Lost connection to "${e}".`;t!=null&&t.stack&&(i+=` +${t.stack}`),$t.warn(i),r&&r.listenerCount("error")>0&&r.emit("error",i)}const Bu=()=>Math.random().toString(36).slice(2),Im=async e=>{let t,r;switch(e){case"testing":t="https://solana-testing.tor.us",r="debug";break;case"development":t="http://localhost:8080",r="debug";break;default:t="https://solana.tor.us",r="error";break}return{torusUrl:t,logLevel:r}},nD=()=>{let e=window.navigator.language||"en-US";const t=e.split("-");return e=Object.prototype.hasOwnProperty.call(Fh.translations,t[0])?t[0]:"en",e},iD={height:660,width:375},oD={height:740,width:1315},sD={height:700,width:1200},Tm={height:600,width:400};function aD(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return r&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}function Qs(e){let{width:t,height:r}=e;const i=window.screenLeft!==void 0?window.screenLeft:window.screenX,s=window.screenTop!==void 0?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,f=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,c=1,d=Math.abs((a-t)/2/c+i),l=Math.abs((f-r)/2/c+s);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${r/c},width=${t/c},top=${l},left=${d}`}class Om extends Mf{constructor(t,r){let{maxEventListeners:i=100,jsonRpcStreamName:s="provider"}=r;if(super(),Ye(this,"isTorus",void 0),Ye(this,"_rpcEngine",void 0),Ye(this,"jsonRpcConnectionEvents",void 0),Ye(this,"_state",void 0),!K$.duplex(t))throw new Error(kn.errors.invalidDuplexStream());this.isTorus=!0,this.setMaxListeners(i),this._handleConnect=this._handleConnect.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this._initializeState=this._initializeState.bind(this),this.request=this.request.bind(this),this.sendAsync=this.sendAsync.bind(this);const a=new V$;T_(t,a,t,this._handleStreamDisconnect.bind(this,"Torus")),a.ignoreStream("phishing");const f=H$();T_(f.stream,a.createStream(s),f.stream,this._handleStreamDisconnect.bind(this,"Torus RpcProvider"));const c=new si;c.push(z$()),c.push(tD()),c.push($$({origin:location.origin})),c.push(f.middleware),this._rpcEngine=c,this.jsonRpcConnectionEvents=f.events}async request(t){if(!t||typeof t!="object"||Array.isArray(t))throw Rn.ethErrors.rpc.invalidRequest({message:kn.errors.invalidRequestArgs(),data:t});const{method:r,params:i}=t;if(typeof r!="string"||r.length===0)throw Rn.ethErrors.rpc.invalidRequest({message:kn.errors.invalidRequestMethod(),data:t});if(i!==void 0&&!Array.isArray(i)&&(typeof i!="object"||i===null))throw Rn.ethErrors.rpc.invalidRequest({message:kn.errors.invalidRequestParams(),data:t});return new Promise((s,a)=>{this._rpcRequest({method:r,params:i},kd(s,a))})}send(t,r){this._rpcRequest(t,r)}sendAsync(t){return new Promise((r,i)=>{this._rpcRequest(t,kd(r,i))})}_handleStreamDisconnect(t,r){rD(t,r,this),this._handleDisconnect(!1,r?r.message:void 0)}}const uD=function(e,t,r){for(var i=arguments.length,s=new Array(i>3?i-3:0),a=3;a{r(...s),e.removeEventListener(t,f)};e.addEventListener(t,f)};async function Nm(){return new Promise(e=>{document.readyState!=="loading"?e():uD(document,"DOMContentLoaded",e)})}const Xo=e=>{const t=window.document.createElement("template"),r=e.trim();return t.innerHTML=r,t.content.firstChild};function xu(e){return e.version===void 0}class Lm extends Mf{constructor(t){let{url:r,target:i,features:s}=t;super(),Ye(this,"url",void 0),Ye(this,"target",void 0),Ye(this,"features",void 0),Ye(this,"window",void 0),Ye(this,"windowTimer",void 0),Ye(this,"iClosedWindow",void 0),this.url=r,this.target=i||"_blank",this.features=s||Qs(sD),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval(()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0),this.window===void 0&&clearInterval(this.windowTimer)},500))}open(){var t;return this.window=window.open(this.url.href,this.target,this.features),(t=this.window)!=null&&t.focus&&this.window.focus(),Promise.resolve()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(t){t?window.location.replace(this.url.href):window.location.href=this.url.href}}function wb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function fD(e){for(var t=1;t{this._state.isConnected=!0});const f=c=>{const{method:d,params:l}=c;if(d===Ws.IFRAME_STATUS){const{isFullScreen:h,rid:y}=l;this._displayIframe({isFull:h,rid:y})}else if(d===Ws.CREATE_WINDOW){const{windowId:h,url:y}=l;this._createPopupBlockAlert(h,y)}else if(d===Ws.CLOSE_WINDOW)this._handleCloseWindow(l);else if(d===Ws.USER_LOGGED_IN){const{currentLoginProvider:h}=l;this._state.isLoggedIn=!0,this._state.currentLoginProvider=h}else d===Ws.USER_LOGGED_OUT&&(this._state.isLoggedIn=!1,this._state.currentLoginProvider=null,this._displayIframe())};this.jsonRpcConnectionEvents.on("notification",f)}get isLoggedIn(){return this._state.isLoggedIn}get isIFrameFullScreen(){return this._state.isIFrameFullScreen}isConnected(){return this._state.isConnected}async _initializeState(t){try{const{torusUrl:r,dappStorageKey:i,torusAlertContainer:s,torusIframe:a}=t;this.torusUrl=r,this.dappStorageKey=i,this.torusAlertContainer=s,this.torusIframe=a,this.torusIframe.addEventListener("load",()=>{this._state.isIFrameFullScreen||this._displayIframe()});const{currentLoginProvider:f,isLoggedIn:c}=await this.request({method:$n.GET_PROVIDER_STATE,params:[]});this._handleConnect(f,c)}catch(r){$t.error("Torus: Failed to get initial state. Please report this bug.",r)}finally{$t.info("initialized communication state"),this._state.initialized=!0,this.emit("_initialized")}}_handleWindow(t){let{url:r,target:i,features:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const a=new URL(r||`${this.torusUrl}/redirect?windowId=${t}`);this.dappStorageKey&&(a.hash?a.hash+=`&dappStorageKey=${this.dappStorageKey}`:a.hash=`#dappStorageKey=${this.dappStorageKey}`);const f=new Lm({url:a,target:i,features:s});if(f.open(),!f.window){this._createPopupBlockAlert(t,a.href);return}this.windowRefs[t]=f,this.request({method:$n.OPENED_WINDOW,params:{windowId:t}}),f.once("close",()=>{delete this.windowRefs[t],this.request({method:$n.CLOSED_WINDOW,params:{windowId:t}})})}_displayIframe(){let{isFull:t=!1,rid:r=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const i={};if(t)i.display="block",i.width="100%",i.height="100%",i.top="0px",i.right="0px",i.left="0px",i.bottom="0px";else switch(i.display=this._state.torusWidgetVisibility?"block":"none",i.height="70px",i.width="70px",this._state.buttonPosition){case Zs.TOP_LEFT:i.top="0px",i.left="0px",i.right="auto",i.bottom="auto";break;case Zs.TOP_RIGHT:i.top="0px",i.right="0px",i.left="auto",i.bottom="auto";break;case Zs.BOTTOM_RIGHT:i.bottom="0px",i.right="0px",i.top="auto",i.left="auto";break;case Zs.BOTTOM_LEFT:default:i.bottom="0px",i.left="0px",i.top="auto",i.right="auto";break}Object.assign(this.torusIframe.style,i),this._state.isIFrameFullScreen=t,this.request({method:$n.IFRAME_STATUS,params:{isIFrameFullScreen:t,rid:r}})}hideTorusButton(){this._state.torusWidgetVisibility=!1,this._displayIframe()}showTorusButton(){this._state.torusWidgetVisibility=!0,this._displayIframe()}_rpcRequest(t,r){const i=r,s=t;Array.isArray(s)||s.jsonrpc||(s.jsonrpc="2.0"),this.tryWindowHandle(s,i)}_handleConnect(t,r){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{currentLoginProvider:t,isLoggedIn:r}),$t.debug(kn.info.connected(t)))}_handleDisconnect(t,r){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){this._state.isConnected=!1;let i;t?(i=new Rn.EthereumRpcError(1013,r||kn.errors.disconnected()),$t.debug(i)):(i=new Rn.EthereumRpcError(1011,r||kn.errors.permanentlyDisconnected()),$t.error(i),this._state.currentLoginProvider=null,this._state.isLoggedIn=!1,this._state.torusWidgetVisibility=!1,this._state.isIFrameFullScreen=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",i)}}_handleCloseWindow(t){const{windowId:r}=t;this.windowRefs[r]&&(this.windowRefs[r].close(),delete this.windowRefs[r])}async _createPopupBlockAlert(t,r){const i=this.getLogoUrl(),s=Xo(`

${this.embedTranslations.actionRequired}

${this.embedTranslations.pendingAction}

`),a=Xo(``),f=Xo('
');f.appendChild(a),s.appendChild(f);const c=()=>{a.addEventListener("click",()=>{this._handleWindow(t,{url:r,target:"_blank",features:Qs(Tm)}),s.remove(),this.torusAlertContainer.children.length===0&&(this.torusAlertContainer.style.display="none")})},d=()=>{this.torusAlertContainer.appendChild(s)};await Nm(),d(),c(),this.torusAlertContainer.style.display="block"}getLogoUrl(){return`${this.torusUrl}/images/torus_icon-blue.svg`}}Ye(Uf,"_defaultState",{buttonPosition:"bottom-left",currentLoginProvider:null,isIFrameFullScreen:!1,hasEmittedConnection:!1,torusWidgetVisibility:!1,initialized:!1,isLoggedIn:!1,isPermanentlyDisconnected:!1,isConnected:!1});function mb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function cD(e){for(var t=1;t{this._state.isConnected=!0});const a=f=>{const{method:c,params:d}=f;c===ud.ACCOUNTS_CHANGED?this._handleAccountsChanged(d):c===ud.UNLOCK_STATE_CHANGED?this._handleUnlockStateChanged(d):c===ud.CHAIN_CHANGED&&this._handleChainChanged(d)};this.jsonRpcConnectionEvents.on("notification",a)}isConnected(){return this._state.isConnected}async _initializeState(){try{const{accounts:t,chainId:r,isUnlocked:i}=await this.request({method:x$.GET_PROVIDER_STATE,params:[]});this.emit("connect",{chainId:r}),this._handleChainChanged({chainId:r}),this._handleUnlockStateChanged({accounts:t,isUnlocked:i}),this._handleAccountsChanged(t)}catch(t){$t.error("Torus: Failed to get initial state. Please report this bug.",t)}finally{$t.info("initialized provider state"),this._state.initialized=!0,this.emit("_initialized")}}_rpcRequest(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=r;const a=t;if(!Array.isArray(a)){if(a.jsonrpc||(a.jsonrpc="2.0"),a.method==="solana_accounts"||a.method==="solana_requestAccounts")s=(f,c)=>{this._handleAccountsChanged(c.result||[],a.method==="solana_accounts",i),r(f,c)};else if(a.method==="wallet_getProviderState"){this._rpcEngine.handle(t,s);return}}this.tryWindowHandle(a,s)}_handleConnect(t){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:t}),$t.debug(kn.info.connected(t)))}_handleDisconnect(t,r){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){this._state.isConnected=!1;let i;t?(i=new Rn.EthereumRpcError(1013,r||kn.errors.disconnected()),$t.debug(i)):(i=new Rn.EthereumRpcError(1011,r||kn.errors.permanentlyDisconnected()),$t.error(i),this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",i)}}_handleAccountsChanged(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=t;Array.isArray(s)||($t.error("Torus: Received non-array accounts parameter. Please report this bug.",s),s=[]);for(const a of t)if(typeof a!="string"){$t.error("Torus: Received non-string account. Please report this bug.",t),s=[];break}X$(this._state.accounts,s)||(r&&Array.isArray(this._state.accounts)&&this._state.accounts.length>0&&!i&&$t.error('Torus: "solana_accounts" unexpectedly updated accounts. Please report this bug.',s),this._state.accounts=s,this.emit("accountsChanged",s)),this.selectedAddress!==s[0]&&(this.selectedAddress=s[0]||null)}_handleChainChanged(){let{chainId:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!t){$t.error("Torus: Received invalid network parameters. Please report this bug.",{chainId:t});return}t==="loading"?this._handleDisconnect(!0):(this._handleConnect(t),t!==this.chainId&&(this.chainId=t,this._state.initialized&&this.emit("chainChanged",this.chainId)))}_handleUnlockStateChanged(){let{accounts:t,isUnlocked:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof r!="boolean"){$t.error("Torus: Received invalid isUnlocked parameter. Please report this bug.",{isUnlocked:r});return}r!==this._state.isUnlocked&&(this._state.isUnlocked=r,this._handleAccountsChanged(t||[]))}}Ye(kf,"_defaultState",{accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1,hasEmittedConnection:!1});function vb(e){return new Promise((t,r)=>{try{const i=document.createElement("img");i.onload=()=>t(!0),i.onerror=()=>t(!1),i.src=e}catch(i){r(i)}})}const lD=e=>{const{document:t}=e,r=t.querySelector('head > meta[property="og:site_name"]');if(r)return r.content;const i=t.querySelector('head > meta[name="title"]');return i?i.content:t.title&&t.title.length>0?t.title:e.location.hostname};async function dD(e){try{const{document:t}=e;let r=t.querySelector('head > link[rel="shortcut icon"]');return r&&await vb(r.href)||(r=Array.from(t.querySelectorAll('head > link[rel="icon"]')).find(i=>!!i.href),r&&await vb(r.href))?r.href:""}catch{return""}}const hD=async()=>({name:lD(window),icon:await dD(window)});function Eb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function ld(e){for(var t=1;t"u")return;const t=document.createElement("link"),{torusUrl:r}=await Im("production");t.href=`${r}/frame`,t.crossOrigin="anonymous",t.type="text/html",t.rel="prefetch",t.relList&&t.relList.supports&&t.relList.supports("prefetch")&&document.head.appendChild(t)}catch(t){$t.warn(t)}})();class RD{constructor(){let{modalZIndex:t=99999}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(this,"isInitialized",void 0),Ye(this,"torusAlert",void 0),Ye(this,"modalZIndex",void 0),Ye(this,"alertZIndex",void 0),Ye(this,"requestedLoginProvider",void 0),Ye(this,"provider",void 0),Ye(this,"communicationProvider",void 0),Ye(this,"dappStorageKey",void 0),Ye(this,"isTopupHidden",!1),Ye(this,"torusAlertContainer",void 0),Ye(this,"torusUrl",void 0),Ye(this,"torusIframe",void 0),Ye(this,"styleLink",void 0),this.torusUrl="",this.isInitialized=!1,this.requestedLoginProvider=null,this.modalZIndex=t,this.alertZIndex=t+1e3,this.dappStorageKey=""}get isLoggedIn(){return this.communicationProvider?this.communicationProvider.isLoggedIn:!1}async init(){let{buildEnv:t=Q$.PRODUCTION,enableLogging:r=!1,network:i,showTorusButton:s=!1,useLocalStorage:a=!1,buttonPosition:f=Zs.BOTTOM_LEFT,apiKey:c="torus-default",extraParams:d={},whiteLabel:l}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.isInitialized)throw new Error("Already initialized");const{torusUrl:h,logLevel:y}=await Im(t);$t.enableAll(),$t.info(h,"url loaded"),$t.info(`Solana Embed Version :${Y$}`),this.torusUrl=h,$t.setDefaultLevel(y),r?$t.enableAll():$t.disableAll();const A=this.handleDappStorageKey(a),R=new URL(h);R.pathname.endsWith("/")?R.pathname+="frame":R.pathname+="/frame";const D=new URLSearchParams;A&&D.append("dappStorageKey",A),D.append("origin",window.location.origin),R.hash=D.toString(),this.torusIframe=Xo(``),this.torusAlertContainer=Xo(``),this.styleLink=Xo(``);const ie=async()=>new Promise((Z,J)=>{try{window.document.head.appendChild(this.styleLink),window.document.body.appendChild(this.torusIframe),window.document.body.appendChild(this.torusAlertContainer),this.torusIframe.addEventListener("load",async()=>{const E=await hD();this.torusIframe.contentWindow.postMessage({buttonPosition:f,apiKey:c,network:i,dappMetadata:E,extraParams:d,whiteLabel:l},R.origin),await this._setupWeb3({torusUrl:h}),s&&this.showTorusButton(),l!=null&&l.topupHide?this.isTopupHidden=l.topupHide:this.hideTorusButton(),this.isInitialized=!0,window.torus=this,Z()})}catch(E){J(E)}});await Nm(),await ie()}async login(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.isInitialized)throw new Error("Call init() first");try{this.requestedLoginProvider=t.loginProvider||null,this.requestedLoginProvider||this.communicationProvider._displayIframe({isFull:!0});const r=await new Promise((i,s)=>{this.provider._rpcRequest({method:"solana_requestAccounts",params:[this.requestedLoginProvider,t.login_hint]},kd(i,s))});if(Array.isArray(r)&&r.length>0)return r;throw new Error("Login failed")}catch(r){throw $t.error("login failed",r),r}finally{this.communicationProvider.isIFrameFullScreen&&this.communicationProvider._displayIframe()}}async loginWithPrivateKey(t){if(!this.isInitialized)throw new Error("Call init() first");const{privateKey:r,userInfo:i}=t,{success:s}=await this.communicationProvider.request({method:"login_with_private_key",params:{privateKey:r,userInfo:i}});if(!s)throw new Error("Login Failed")}async logout(){if(!this.communicationProvider.isLoggedIn)throw new Error("Not logged in");await this.communicationProvider.request({method:$n.LOGOUT,params:[]}),this.requestedLoginProvider=null}async cleanUp(){this.communicationProvider.isLoggedIn&&await this.logout(),this.clearInit()}clearInit(){function t(r){return r instanceof Element||r instanceof Document}t(this.styleLink)&&window.document.body.contains(this.styleLink)&&(this.styleLink.remove(),this.styleLink=void 0),t(this.torusIframe)&&window.document.body.contains(this.torusIframe)&&(this.torusIframe.remove(),this.torusIframe=void 0),t(this.torusAlertContainer)&&window.document.body.contains(this.torusAlertContainer)&&(this.torusAlert=void 0,this.torusAlertContainer.remove(),this.torusAlertContainer=void 0),this.isInitialized=!1}hideTorusButton(){this.communicationProvider.hideTorusButton()}showTorusButton(){this.communicationProvider.showTorusButton()}async setProvider(t){await this.communicationProvider.request({method:$n.SET_PROVIDER,params:ld({},t)})}async showWallet(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=await this.communicationProvider.request({method:$n.WALLET_INSTANCE_ID,params:[]}),s=t?`/${t}`:"",a=new URL(`${this.torusUrl}/wallet${s}`);a.searchParams.append("instanceId",i),Object.keys(r).forEach(c=>{a.searchParams.append(c,r[c])}),this.dappStorageKey&&(a.hash=`#dappStorageKey=${this.dappStorageKey}`),new Lm({url:a,features:Qs(oD)}).open()}async getUserInfo(){return await this.communicationProvider.request({method:$n.USER_INFO,params:[]})}async initiateTopup(t,r){if(!this.isInitialized)throw new Error("Torus is not initialized");const i=Bu();return this.communicationProvider._handleWindow(i),await this.communicationProvider.request({method:$n.TOPUP,params:{provider:t,params:r,windowId:i}})}async getAccounts(){return await this.provider.request({method:"getAccounts",params:[]})}async sendTransaction(t){const r=xu(t),i=r?t.serialize({requireAllSignatures:!1}).toString("hex"):Fe.Buffer.from(t.serialize()).toString("hex");return await this.provider.request({method:"send_transaction",params:{message:i,isLegacyTransaction:r}})}async signAndSendTransaction(t,r){const i=xu(t),s=i?t.serialize({requireAllSignatures:!1}).toString("hex"):Fe.Buffer.from(t.serialize()).toString("hex");return{signature:await this.provider.request({method:"send_transaction",params:{message:s,options:r,isLegacyTransaction:i}})}}async signTransaction(t){const r=xu(t),i=r?t.serializeMessage().toString("hex"):Fe.Buffer.from(t.message.serialize()).toString("hex"),s=await this.provider.request({method:"sign_transaction",params:{message:i,messageOnly:!0,isLegacyTransaction:r}}),a=JSON.parse(s),f={publicKey:new H0(a.publicKey),signature:Fe.Buffer.from(a.signature,"hex")};return t.addSignature(f.publicKey,f.signature),t}async signAllTransactions(t){let r;const i=t.map(f=>(r=xu(f),r?f.serializeMessage().toString("hex"):Fe.Buffer.from(f.message.serialize()).toString("hex"))),a=(await this.provider.request({method:"sign_all_transactions",params:{message:i,messageOnly:!0,isLegacyTransaction:r}})).map(f=>{const c=JSON.parse(f);return{publicKey:new H0(c.publicKey),signature:Fe.Buffer.from(c.signature,"hex")}});return t.forEach((f,c)=>(f.addSignature(a[c].publicKey,a[c].signature),f)),t}async signMessage(t){return await this.provider.request({method:"sign_message",params:{data:t}})}async getGaslessPublicKey(){return await this.provider.request({method:"get_gasless_public_key",params:[]})}handleDappStorageKey(t){const r=`${Fh.localStorageKeyPrefix}${window.location.hostname}`;let i="";if(_D&&t){const s=window.localStorage.getItem(r);if(s)i=s;else{const a=`torus-app-${Bu()}`;window.localStorage.setItem(r,a),i=a}}return this.dappStorageKey=i,i}async _setupWeb3(t){$t.info("setupWeb3 running");const r=new hb({name:"embed_torus",target:"iframe_torus",targetWindow:this.torusIframe.contentWindow}),i=new hb({name:"embed_communication",target:"iframe_communication",targetWindow:this.torusIframe.contentWindow}),s=new kf(r,{}),a=new Uf(i,{});s.tryWindowHandle=(l,h)=>{const y=l;if(!Array.isArray(y)&&gD.includes(y.method)){if(!this.communicationProvider.isLoggedIn)throw new Error("User Not Logged In");const A=Bu();a._handleWindow(A,{target:"_blank",features:Qs(Tm)}),y.windowId=A}s._rpcEngine.handle(y,h)},a.tryWindowHandle=(l,h)=>{const y=l;if(!Array.isArray(y)&&pD.includes(y.method)){const A=Bu();a._handleWindow(A,{target:"_blank",features:Qs(iD)}),y.params.windowId=A}a._rpcEngine.handle(y,h)};const f=l=>{const h=s[l],y=this;s[l]=function(R,D){const{method:ie,params:Z=[]}=R;if(ie==="solana_requestAccounts"){if(!D)return y.login({loginProvider:Z[0]});y.login({loginProvider:Z[0]}).then(J=>D(null,J)).catch(J=>D(J))}return h.apply(this,[R,D])}};f("request"),f("sendAsync"),f("send");const c=new Proxy(s,{deleteProperty:()=>!0}),d=new Proxy(a,{deleteProperty:()=>!0});this.provider=c,this.communicationProvider=d,await Promise.all([s._initializeState(),a._initializeState(ld(ld({},t),{},{dappStorageKey:this.dappStorageKey,torusAlertContainer:this.torusAlertContainer,torusIframe:this.torusIframe}))]),$t.debug("Torus - injected provider")}}export{Zs as BUTTON_POSITION,cd as LOGIN_PROVIDER,SD as PAYMENT_PROVIDER,Q$ as TORUS_BUILD_ENV,kf as TorusInPageProvider,RD as default}; diff --git a/preview-build/assets/solanaEmbed.esm-f41f2732.js b/preview-build/assets/solanaEmbed.esm-f41f2732.js deleted file mode 100644 index 9114f49..0000000 --- a/preview-build/assets/solanaEmbed.esm-f41f2732.js +++ /dev/null @@ -1,110 +0,0 @@ -import{p as Qe,h as Ce,A as Vr,q as Rv,v as vi,K as To,g as rp,P as by}from"./index-fa8ce1ea.js";var np={exports:{}},ua=typeof Reflect=="object"?Reflect:null,vy=ua&&typeof ua.apply=="function"?ua.apply:function(t,r,i){return Function.prototype.apply.call(t,r,i)},iu;ua&&typeof ua.ownKeys=="function"?iu=ua.ownKeys:Object.getOwnPropertySymbols?iu=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:iu=function(t){return Object.getOwnPropertyNames(t)};function DI(e){console&&console.warn&&console.warn(e)}var Av=Number.isNaN||function(t){return t!==t};function xt(){xt.init.call(this)}np.exports=xt;np.exports.once=kI;xt.EventEmitter=xt;xt.prototype._events=void 0;xt.prototype._eventsCount=0;xt.prototype._maxListeners=void 0;var wy=10;function Bu(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(xt,"defaultMaxListeners",{enumerable:!0,get:function(){return wy},set:function(e){if(typeof e!="number"||e<0||Av(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");wy=e}});xt.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};xt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Av(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Tv(e){return e._maxListeners===void 0?xt.defaultMaxListeners:e._maxListeners}xt.prototype.getMaxListeners=function(){return Tv(this)};xt.prototype.emit=function(t){for(var r=[],i=1;i0&&(f=r[0]),f instanceof Error)throw f;var c=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw c.context=f,c}var l=s[t];if(l===void 0)return!1;if(typeof l=="function")vy(l,this,r);else for(var d=l.length,h=Nv(l,d),i=0;i0&&f.length>a&&!f.warned){f.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=f.length,DI(c)}return e}xt.prototype.addListener=function(t,r){return Ov(this,t,r,!1)};xt.prototype.on=xt.prototype.addListener;xt.prototype.prependListener=function(t,r){return Ov(this,t,r,!0)};function jI(){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 Iv(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=jI.bind(i);return a.listener=r,i.wrapFn=a,a}xt.prototype.once=function(t,r){return Bu(r),this.on(t,Iv(this,t,r)),this};xt.prototype.prependOnceListener=function(t,r){return Bu(r),this.prependListener(t,Iv(this,t,r)),this};xt.prototype.removeListener=function(t,r){var i,a,s,f,c;if(Bu(r),a=this._events,a===void 0)return this;if(i=a[t],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,i.listener||r));else if(typeof i!="function"){for(s=-1,f=i.length-1;f>=0;f--)if(i[f]===r||i[f].listener===r){c=i[f].listener,s=f;break}if(s<0)return this;s===0?i.shift():FI(i,s),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,c||r)}return this};xt.prototype.off=xt.prototype.removeListener;xt.prototype.removeAllListeners=function(t){var r,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var s=Object.keys(i),f;for(a=0;a=0;a--)this.removeListener(t,r[a]);return this};function Pv(e,t,r){var i=e._events;if(i===void 0)return[];var a=i[t];return a===void 0?[]:typeof a=="function"?r?[a.listener||a]:[a]:r?UI(a):Nv(a,a.length)}xt.prototype.listeners=function(t){return Pv(this,t,!0)};xt.prototype.rawListeners=function(t){return Pv(this,t,!1)};xt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Lv.call(e,t)};xt.prototype.listenerCount=Lv;function Lv(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}xt.prototype.eventNames=function(){return this._eventsCount>0?iu(this._events):[]};function Nv(e,t){for(var r=new Array(t),i=0;i"u"||!lr?mt:lr(Uint8Array),bo={"%AggregateError%":typeof AggregateError>"u"?mt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?mt:ArrayBuffer,"%ArrayIteratorPrototype%":ea&&lr?lr([][Symbol.iterator]()):mt,"%AsyncFromSyncIteratorPrototype%":mt,"%AsyncFunction%":aa,"%AsyncGenerator%":aa,"%AsyncGeneratorFunction%":aa,"%AsyncIteratorPrototype%":aa,"%Atomics%":typeof Atomics>"u"?mt:Atomics,"%BigInt%":typeof BigInt>"u"?mt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?mt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?mt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?mt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?mt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?mt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?mt:FinalizationRegistry,"%Function%":$v,"%GeneratorFunction%":aa,"%Int8Array%":typeof Int8Array>"u"?mt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?mt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?mt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ea&&lr?lr(lr([][Symbol.iterator]())):mt,"%JSON%":typeof JSON=="object"?JSON:mt,"%Map%":typeof Map>"u"?mt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ea||!lr?mt:lr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?mt:Promise,"%Proxy%":typeof Proxy>"u"?mt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?mt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?mt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ea||!lr?mt:lr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?mt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ea&&lr?lr(""[Symbol.iterator]()):mt,"%Symbol%":ea?Symbol:mt,"%SyntaxError%":ya,"%ThrowTypeError%":a2,"%TypedArray%":f2,"%TypeError%":la,"%Uint8Array%":typeof Uint8Array>"u"?mt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?mt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?mt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?mt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?mt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?mt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?mt:WeakSet};if(lr)try{null.error}catch(e){var u2=lr(lr(e));bo["%Error.prototype%"]=u2}var l2=function e(t){var r;if(t==="%AsyncFunction%")r=Fc("async function () {}");else if(t==="%GeneratorFunction%")r=Fc("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Fc("async function* () {}");else if(t==="%AsyncGenerator%"){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&lr&&(r=lr(a.prototype))}return bo[t]=r,r},Ry={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ps=ap,hu=o2,c2=Ps.call(Function.call,Array.prototype.concat),d2=Ps.call(Function.apply,Array.prototype.splice),Ay=Ps.call(Function.call,String.prototype.replace),pu=Ps.call(Function.call,String.prototype.slice),h2=Ps.call(Function.call,RegExp.prototype.exec),p2=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,g2=/\\(\\)?/g,y2=function(t){var r=pu(t,0,1),i=pu(t,-1);if(r==="%"&&i!=="%")throw new ya("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new ya("invalid intrinsic syntax, expected opening `%`");var a=[];return Ay(t,p2,function(s,f,c,l){a[a.length]=c?Ay(l,g2,"$1"):f||s}),a},_2=function(t,r){var i=t,a;if(hu(Ry,i)&&(a=Ry[i],i="%"+a[0]+"%"),hu(bo,i)){var s=bo[i];if(s===aa&&(s=l2(i)),typeof s>"u"&&!r)throw new la("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:s}}throw new ya("intrinsic "+t+" does not exist!")},Aa=function(t,r){if(typeof t!="string"||t.length===0)throw new la("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new la('"allowMissing" argument must be a boolean');if(h2(/^%?[^%]*%?$/,t)===null)throw new ya("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=y2(t),a=i.length>0?i[0]:"",s=_2("%"+a+"%",r),f=s.name,c=s.value,l=!1,d=s.alias;d&&(a=d[0],d2(i,c2([0,1],d)));for(var h=1,b=!0;h=i.length){var ae=_o(c,R);b=!!ae,b&&"get"in ae&&!("originalValue"in ae.get)?c=ae.get:c=c[R]}else b=hu(c,R),c=c[R];b&&!l&&(bo[f]=c)}}return c},Mv={exports:{}},b2=Aa,bh=b2("%Object.defineProperty%",!0),vh=function(){if(bh)try{return bh({},"a",{value:1}),!0}catch{return!1}return!1};vh.hasArrayLengthDefineBug=function(){if(!vh())return null;try{return bh([],"length",{value:1}).length!==1}catch{return!0}};var sp=vh,v2=Aa,ou=v2("%Object.getOwnPropertyDescriptor%",!0);if(ou)try{ou([],"length")}catch{ou=null}var fp=ou,w2=sp(),up=Aa,gs=w2&&up("%Object.defineProperty%",!0);if(gs)try{gs({},"a",{value:1})}catch{gs=!1}var m2=up("%SyntaxError%"),ta=up("%TypeError%"),Ty=fp,Dv=function(t,r,i){if(!t||typeof t!="object"&&typeof t!="function")throw new ta("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ta("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ta("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ta("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ta("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ta("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,l=!!Ty&&Ty(t,r);if(gs)gs(t,r,{configurable:f===null&&l?l.configurable:!f,enumerable:a===null&&l?l.enumerable:!a,value:i,writable:s===null&&l?l.writable:!s});else if(c||!a&&!s&&!f)t[r]=i;else throw new m2("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},jv=Aa,Oy=Dv,E2=sp(),Iy=fp,Py=jv("%TypeError%"),S2=jv("%Math.floor%"),R2=function(t,r){if(typeof t!="function")throw new Py("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||S2(r)!==r)throw new Py("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],a=!0,s=!0;if("length"in t&&Iy){var f=Iy(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(s=!1)}return(a||s||!i)&&(E2?Oy(t,"length",r,!0,!0):Oy(t,"length",r)),t};(function(e){var t=ap,r=Aa,i=R2,a=r("%TypeError%"),s=r("%Function.prototype.apply%"),f=r("%Function.prototype.call%"),c=r("%Reflect.apply%",!0)||t.call(f,s),l=r("%Object.defineProperty%",!0),d=r("%Math.max%");if(l)try{l({},"a",{value:1})}catch{l=null}e.exports=function(R){if(typeof R!="function")throw new a("a function is required");var A=c(t,f,arguments);return i(A,1+d(0,R.length-(arguments.length-1)),!0)};var h=function(){return c(t,s,arguments)};l?l(e.exports,"apply",{value:h}):e.exports.apply=h})(Mv);var xu=Mv.exports,Fv=Aa,Uv=xu,A2=Uv(Fv("String.prototype.indexOf")),$u=function(t,r){var i=Fv(t,!!r);return typeof i=="function"&&A2(t,".prototype.")>-1?Uv(i):i},T2=op(),O2=$u,wh=O2("Object.prototype.toString"),Mu=function(t){return T2&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:wh(t)==="[object Arguments]"},kv=function(t){return Mu(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&wh(t)!=="[object Array]"&&wh(t.callee)==="[object Function]"},I2=function(){return Mu(arguments)}();Mu.isLegacyArguments=kv;var P2=I2?Mu:kv,L2=Object.prototype.toString,N2=Function.prototype.toString,C2=/^\s*(?:function)?\*/,qv=op(),kc=Object.getPrototypeOf,B2=function(){if(!qv)return!1;try{return Function("return function*() {}")()}catch{}},qc,x2=function(t){if(typeof t!="function")return!1;if(C2.test(N2.call(t)))return!0;if(!qv){var r=L2.call(t);return r==="[object GeneratorFunction]"}if(!kc)return!1;if(typeof qc>"u"){var i=B2();qc=i?kc(i):!1}return kc(t)===qc},Hv=Function.prototype.toString,fa=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,mh,au;if(typeof fa=="function"&&typeof Object.defineProperty=="function")try{mh=Object.defineProperty({},"length",{get:function(){throw au}}),au={},fa(function(){throw 42},null,mh)}catch(e){e!==au&&(fa=null)}else fa=null;var $2=/^\s*class\b/,Eh=function(t){try{var r=Hv.call(t);return $2.test(r)}catch{return!1}},Hc=function(t){try{return Eh(t)?!1:(Hv.call(t),!0)}catch{return!1}},su=Object.prototype.toString,M2="[object Object]",D2="[object Function]",j2="[object GeneratorFunction]",F2="[object HTMLAllCollection]",U2="[object HTML document.all class]",k2="[object HTMLCollection]",q2=typeof Symbol=="function"&&!!Symbol.toStringTag,H2=!(0 in[,]),Sh=function(){return!1};if(typeof document=="object"){var W2=document.all;su.call(W2)===su.call(document.all)&&(Sh=function(t){if((H2||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=su.call(t);return(r===F2||r===U2||r===k2||r===M2)&&t("")==null}catch{}return!1})}var z2=fa?function(t){if(Sh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{fa(t,null,mh)}catch(r){if(r!==au)return!1}return!Eh(t)&&Hc(t)}:function(t){if(Sh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(q2)return Hc(t);if(Eh(t))return!1;var r=su.call(t);return r!==D2&&r!==j2&&!/^\[object HTML/.test(r)?!1:Hc(t)},G2=z2,V2=Object.prototype.toString,Wv=Object.prototype.hasOwnProperty,Z2=function(t,r,i){for(var a=0,s=t.length;a=3&&(a=i),V2.call(t)==="[object Array]"?Z2(t,r,a):typeof t=="string"?K2(t,r,a):J2(t,r,a)},Y2=X2,Wc=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Q2=typeof globalThis>"u"?Qe:globalThis,eP=function(){for(var t=[],r=0;r"u"?Qe:globalThis,Rh=tP(),cp=lp("String.prototype.slice"),zc=Object.getPrototypeOf,nP=lp("Array.prototype.indexOf",!0)||function(t,r){for(var i=0;i-1?r:r!=="Object"?!1:oP(t)}return fu?iP(t):null},aP=Gv,sP=function(t){return!!aP(t)};(function(e){var t=P2,r=x2,i=Gv,a=sP;function s(me){return me.call.bind(me)}var f=typeof BigInt<"u",c=typeof Symbol<"u",l=s(Object.prototype.toString),d=s(Number.prototype.valueOf),h=s(String.prototype.valueOf),b=s(Boolean.prototype.valueOf);if(f)var R=s(BigInt.prototype.valueOf);if(c)var A=s(Symbol.prototype.valueOf);function N(me,Ye){if(typeof me!="object")return!1;try{return Ye(me),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=a;function ae(me){return typeof Promise<"u"&&me instanceof Promise||me!==null&&typeof me=="object"&&typeof me.then=="function"&&typeof me.catch=="function"}e.isPromise=ae;function K(me){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(me):a(me)||Q(me)}e.isArrayBufferView=K;function I(me){return i(me)==="Uint8Array"}e.isUint8Array=I;function y(me){return i(me)==="Uint8ClampedArray"}e.isUint8ClampedArray=y;function ie(me){return i(me)==="Uint16Array"}e.isUint16Array=ie;function F(me){return i(me)==="Uint32Array"}e.isUint32Array=F;function z(me){return i(me)==="Int8Array"}e.isInt8Array=z;function q(me){return i(me)==="Int16Array"}e.isInt16Array=q;function ne(me){return i(me)==="Int32Array"}e.isInt32Array=ne;function v(me){return i(me)==="Float32Array"}e.isFloat32Array=v;function w(me){return i(me)==="Float64Array"}e.isFloat64Array=w;function E(me){return i(me)==="BigInt64Array"}e.isBigInt64Array=E;function J(me){return i(me)==="BigUint64Array"}e.isBigUint64Array=J;function _(me){return l(me)==="[object Map]"}_.working=typeof Map<"u"&&_(new Map);function m(me){return typeof Map>"u"?!1:_.working?_(me):me instanceof Map}e.isMap=m;function S(me){return l(me)==="[object Set]"}S.working=typeof Set<"u"&&S(new Set);function L(me){return typeof Set>"u"?!1:S.working?S(me):me instanceof Set}e.isSet=L;function H(me){return l(me)==="[object WeakMap]"}H.working=typeof WeakMap<"u"&&H(new WeakMap);function M(me){return typeof WeakMap>"u"?!1:H.working?H(me):me instanceof WeakMap}e.isWeakMap=M;function W(me){return l(me)==="[object WeakSet]"}W.working=typeof WeakSet<"u"&&W(new WeakSet);function P(me){return W(me)}e.isWeakSet=P;function T(me){return l(me)==="[object ArrayBuffer]"}T.working=typeof ArrayBuffer<"u"&&T(new ArrayBuffer);function re(me){return typeof ArrayBuffer>"u"?!1:T.working?T(me):me instanceof ArrayBuffer}e.isArrayBuffer=re;function j(me){return l(me)==="[object DataView]"}j.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&j(new DataView(new ArrayBuffer(1),0,1));function Q(me){return typeof DataView>"u"?!1:j.working?j(me):me instanceof DataView}e.isDataView=Q;var se=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function de(me){return l(me)==="[object SharedArrayBuffer]"}function X(me){return typeof se>"u"?!1:(typeof de.working>"u"&&(de.working=de(new se)),de.working?de(me):me instanceof se)}e.isSharedArrayBuffer=X;function D(me){return l(me)==="[object AsyncFunction]"}e.isAsyncFunction=D;function $(me){return l(me)==="[object Map Iterator]"}e.isMapIterator=$;function te(me){return l(me)==="[object Set Iterator]"}e.isSetIterator=te;function ue(me){return l(me)==="[object Generator]"}e.isGeneratorObject=ue;function B(me){return l(me)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=B;function U(me){return N(me,d)}e.isNumberObject=U;function C(me){return N(me,h)}e.isStringObject=C;function G(me){return N(me,b)}e.isBooleanObject=G;function ce(me){return f&&N(me,R)}e.isBigIntObject=ce;function Re(me){return c&&N(me,A)}e.isSymbolObject=Re;function Se(me){return U(me)||C(me)||G(me)||ce(me)||Re(me)}e.isBoxedPrimitive=Se;function De(me){return typeof Uint8Array<"u"&&(re(me)||X(me))}e.isAnyArrayBuffer=De,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(me){Object.defineProperty(e,me,{enumerable:!1,value:function(){throw new Error(me+" is not supported in userland")}})})})(xv);var fP=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"};(function(e){var t=Object.getOwnPropertyDescriptors||function(Q){for(var se=Object.keys(Q),de={},X=0;X=X)return te;switch(te){case"%s":return String(de[se++]);case"%d":return Number(de[se++]);case"%j":try{return JSON.stringify(de[se++])}catch{return"[Circular]"}default:return te}}),$=de[se];se"u")return function(){return e.deprecate(j,Q).apply(this,arguments)};var se=!1;function de(){if(!se){if(Ce.process.throwDeprecation)throw new Error(Q);Ce.process.traceDeprecation?console.trace(Q):console.error(Q),se=!0}return j.apply(this,arguments)}return de};var i={},a=/^$/;if({}.NODE_DEBUG){var s={}.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+s+"$","i")}e.debuglog=function(j){if(j=j.toUpperCase(),!i[j])if(a.test(j)){var Q=Ce.process.pid;i[j]=function(){var se=e.format.apply(e,arguments);console.error("%s %d: %s",j,Q,se)}}else i[j]=function(){};return i[j]};function f(j,Q){var se={seen:[],stylize:l};return arguments.length>=3&&(se.depth=arguments[2]),arguments.length>=4&&(se.colors=arguments[3]),I(Q)?se.showHidden=Q:Q&&e._extend(se,Q),ne(se.showHidden)&&(se.showHidden=!1),ne(se.depth)&&(se.depth=2),ne(se.colors)&&(se.colors=!1),ne(se.customInspect)&&(se.customInspect=!0),se.colors&&(se.stylize=c),h(se,j,se.depth)}e.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function c(j,Q){var se=f.styles[Q];return se?"\x1B["+f.colors[se][0]+"m"+j+"\x1B["+f.colors[se][1]+"m":j}function l(j,Q){return j}function d(j){var Q={};return j.forEach(function(se,de){Q[se]=!0}),Q}function h(j,Q,se){if(j.customInspect&&Q&&_(Q.inspect)&&Q.inspect!==e.inspect&&!(Q.constructor&&Q.constructor.prototype===Q)){var de=Q.inspect(se,j);return z(de)||(de=h(j,de,se)),de}var X=b(j,Q);if(X)return X;var D=Object.keys(Q),$=d(D);if(j.showHidden&&(D=Object.getOwnPropertyNames(Q)),J(Q)&&(D.indexOf("message")>=0||D.indexOf("description")>=0))return R(Q);if(D.length===0){if(_(Q)){var te=Q.name?": "+Q.name:"";return j.stylize("[Function"+te+"]","special")}if(v(Q))return j.stylize(RegExp.prototype.toString.call(Q),"regexp");if(E(Q))return j.stylize(Date.prototype.toString.call(Q),"date");if(J(Q))return R(Q)}var ue="",B=!1,U=["{","}"];if(K(Q)&&(B=!0,U=["[","]"]),_(Q)){var C=Q.name?": "+Q.name:"";ue=" [Function"+C+"]"}if(v(Q)&&(ue=" "+RegExp.prototype.toString.call(Q)),E(Q)&&(ue=" "+Date.prototype.toUTCString.call(Q)),J(Q)&&(ue=" "+R(Q)),D.length===0&&(!B||Q.length==0))return U[0]+ue+U[1];if(se<0)return v(Q)?j.stylize(RegExp.prototype.toString.call(Q),"regexp"):j.stylize("[Object]","special");j.seen.push(Q);var G;return B?G=A(j,Q,se,$,D):G=D.map(function(ce){return N(j,Q,se,$,ce,B)}),j.seen.pop(),ae(G,ue,U)}function b(j,Q){if(ne(Q))return j.stylize("undefined","undefined");if(z(Q)){var se="'"+JSON.stringify(Q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return j.stylize(se,"string")}if(F(Q))return j.stylize(""+Q,"number");if(I(Q))return j.stylize(""+Q,"boolean");if(y(Q))return j.stylize("null","null")}function R(j){return"["+Error.prototype.toString.call(j)+"]"}function A(j,Q,se,de,X){for(var D=[],$=0,te=Q.length;$-1&&(D?te=te.split(` -`).map(function(B){return" "+B}).join(` -`).slice(2):te=` -`+te.split(` -`).map(function(B){return" "+B}).join(` -`))):te=j.stylize("[Circular]","special")),ne($)){if(D&&X.match(/^\d+$/))return te;$=JSON.stringify(""+X),$.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?($=$.slice(1,-1),$=j.stylize($,"name")):($=$.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),$=j.stylize($,"string"))}return $+": "+te}function ae(j,Q,se){var de=j.reduce(function(X,D){return D.indexOf(` -`)>=0,X+D.replace(/\u001b\[\d\d?m/g,"").length+1},0);return de>60?se[0]+(Q===""?"":Q+` - `)+" "+j.join(`, - `)+" "+se[1]:se[0]+Q+" "+j.join(", ")+" "+se[1]}e.types=xv;function K(j){return Array.isArray(j)}e.isArray=K;function I(j){return typeof j=="boolean"}e.isBoolean=I;function y(j){return j===null}e.isNull=y;function ie(j){return j==null}e.isNullOrUndefined=ie;function F(j){return typeof j=="number"}e.isNumber=F;function z(j){return typeof j=="string"}e.isString=z;function q(j){return typeof j=="symbol"}e.isSymbol=q;function ne(j){return j===void 0}e.isUndefined=ne;function v(j){return w(j)&&S(j)==="[object RegExp]"}e.isRegExp=v,e.types.isRegExp=v;function w(j){return typeof j=="object"&&j!==null}e.isObject=w;function E(j){return w(j)&&S(j)==="[object Date]"}e.isDate=E,e.types.isDate=E;function J(j){return w(j)&&(S(j)==="[object Error]"||j instanceof Error)}e.isError=J,e.types.isNativeError=J;function _(j){return typeof j=="function"}e.isFunction=_;function m(j){return j===null||typeof j=="boolean"||typeof j=="number"||typeof j=="string"||typeof j=="symbol"||typeof j>"u"}e.isPrimitive=m,e.isBuffer=fP;function S(j){return Object.prototype.toString.call(j)}function L(j){return j<10?"0"+j.toString(10):j.toString(10)}var H=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var j=new Date,Q=[L(j.getHours()),L(j.getMinutes()),L(j.getSeconds())].join(":");return[j.getDate(),H[j.getMonth()],Q].join(" ")}e.log=function(){console.log("%s - %s",M(),e.format.apply(e,arguments))},e.inherits=wi,e._extend=function(j,Q){if(!Q||!w(Q))return j;for(var se=Object.keys(Q),de=se.length;de--;)j[se[de]]=Q[se[de]];return j};function W(j,Q){return Object.prototype.hasOwnProperty.call(j,Q)}var P=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(Q){if(typeof Q!="function")throw new TypeError('The "original" argument must be of type Function');if(P&&Q[P]){var se=Q[P];if(typeof se!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(se,P,{value:se,enumerable:!1,writable:!1,configurable:!0}),se}function se(){for(var de,X,D=new Promise(function(ue,B){de=ue,X=B}),$=[],te=0;te0?this.tail.next=I:this.head=I,this.tail=I,++this.length}},{key:"unshift",value:function(K){var I={data:K,next:this.head};this.length===0&&(this.tail=I),this.head=I,++this.length}},{key:"shift",value:function(){if(this.length!==0){var K=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,K}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(K){if(this.length===0)return"";for(var I=this.head,y=""+I.data;I=I.next;)y+=K+I.data;return y}},{key:"concat",value:function(K){if(this.length===0)return d.alloc(0);for(var I=d.allocUnsafe(K>>>0),y=this.head,ie=0;y;)A(y.data,I,ie),ie+=y.data.length,y=y.next;return I}},{key:"consume",value:function(K,I){var y;return KF.length?F.length:K;if(z===F.length?ie+=F:ie+=F.slice(0,K),K-=z,K===0){z===F.length?(++y,I.next?this.head=I.next:this.head=this.tail=null):(this.head=I,I.data=F.slice(z));break}++y}return this.length-=y,ie}},{key:"_getBuffer",value:function(K){var I=d.allocUnsafe(K),y=this.head,ie=1;for(y.data.copy(I),K-=y.data.length;y=y.next;){var F=y.data,z=K>F.length?F.length:K;if(F.copy(I,I.length-K,0,z),K-=z,K===0){z===F.length?(++ie,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=F.slice(z));break}++ie}return this.length-=ie,I}},{key:R,value:function(K,I){return b(this,t(t({},I),{},{depth:0,customInspect:!1}))}}]),N}(),Gc}function lP(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ce.process.nextTick(Ah,this,e)):Ce.process.nextTick(Ah,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?Ce.process.nextTick(uu,r):(r._writableState.errorEmitted=!0,Ce.process.nextTick(By,r,s)):Ce.process.nextTick(By,r,s):t?(Ce.process.nextTick(uu,r),t(s)):Ce.process.nextTick(uu,r)}),this)}function By(e,t){Ah(e,t),uu(e)}function uu(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function cP(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Ah(e,t){e.emit("error",t)}function dP(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}var Vv={destroy:lP,undestroy:cP,errorOrDestroy:dP},Oo={};function hP(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Zv={};function _n(e,t,r){r||(r=Error);function i(s,f,c){return typeof t=="string"?t:t(s,f,c)}var a=function(s){hP(f,s);function f(c,l,d){return s.call(this,i(c,l,d))||this}return f}(r);a.prototype.name=r.name,a.prototype.code=e,Zv[e]=a}function xy(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function pP(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function gP(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function yP(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}_n("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);_n("ERR_INVALID_ARG_TYPE",function(e,t,r){var i;typeof t=="string"&&pP(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var a;if(gP(e," argument"))a="The ".concat(e," ").concat(i," ").concat(xy(t,"type"));else{var s=yP(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(s," ").concat(i," ").concat(xy(t,"type"))}return a+=". Received type ".concat(typeof r),a},TypeError);_n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");_n("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});_n("ERR_STREAM_PREMATURE_CLOSE","Premature close");_n("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});_n("ERR_MULTIPLE_CALLBACK","Callback called multiple times");_n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");_n("ERR_STREAM_WRITE_AFTER_END","write after end");_n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);_n("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);_n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Oo.codes=Zv;var _P=Oo.codes.ERR_INVALID_OPT_VALUE;function bP(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function vP(e,t,r,i){var a=bP(t,i,r);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var s=i?r:"highWaterMark";throw new _P(s,a)}return Math.floor(a)}return e.objectMode?16:16*1024}var Kv={getHighWaterMark:vP},wP=mP;function mP(e,t){if(Vc("noDeprecation"))return e;var r=!1;function i(){if(!r){if(Vc("throwDeprecation"))throw new Error(t);Vc("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function Vc(e){try{if(!Qe.localStorage)return!1}catch{return!1}var t=Qe.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Zc,$y;function dp(){if($y)return Zc;$y=1,Zc=v;function e(X){var D=this;this.next=null,this.entry=null,this.finish=function(){de(D,X)}}var t;v.WritableState=q;var r={deprecate:wP},i=Bv,a=Vr.Buffer,s=(typeof Qe<"u"?Qe:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function f(X){return a.from(X)}function c(X){return a.isBuffer(X)||X instanceof s}var l=Vv,d=Kv,h=d.getHighWaterMark,b=Oo.codes,R=b.ERR_INVALID_ARG_TYPE,A=b.ERR_METHOD_NOT_IMPLEMENTED,N=b.ERR_MULTIPLE_CALLBACK,ae=b.ERR_STREAM_CANNOT_PIPE,K=b.ERR_STREAM_DESTROYED,I=b.ERR_STREAM_NULL_VALUES,y=b.ERR_STREAM_WRITE_AFTER_END,ie=b.ERR_UNKNOWN_ENCODING,F=l.errorOrDestroy;wi(v,i);function z(){}function q(X,D,$){t=t||wo(),X=X||{},typeof $!="boolean"&&($=D instanceof t),this.objectMode=!!X.objectMode,$&&(this.objectMode=this.objectMode||!!X.writableObjectMode),this.highWaterMark=h(this,X,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var te=X.decodeStrings===!1;this.decodeStrings=!te,this.defaultEncoding=X.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ue){H(D,ue)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=X.emitClose!==!1,this.autoDestroy=!!X.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}q.prototype.getBuffer=function(){for(var D=this.bufferedRequest,$=[];D;)$.push(D),D=D.next;return $},function(){try{Object.defineProperty(q.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var ne;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ne=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(D){return ne.call(this,D)?!0:this!==v?!1:D&&D._writableState instanceof q}})):ne=function(D){return D instanceof this};function v(X){t=t||wo();var D=this instanceof t;if(!D&&!ne.call(v,this))return new v(X);this._writableState=new q(X,this,D),this.writable=!0,X&&(typeof X.write=="function"&&(this._write=X.write),typeof X.writev=="function"&&(this._writev=X.writev),typeof X.destroy=="function"&&(this._destroy=X.destroy),typeof X.final=="function"&&(this._final=X.final)),i.call(this)}v.prototype.pipe=function(){F(this,new ae)};function w(X,D){var $=new y;F(X,$),Ce.process.nextTick(D,$)}function E(X,D,$,te){var ue;return $===null?ue=new I:typeof $!="string"&&!D.objectMode&&(ue=new R("chunk",["string","Buffer"],$)),ue?(F(X,ue),Ce.process.nextTick(te,ue),!1):!0}v.prototype.write=function(X,D,$){var te=this._writableState,ue=!1,B=!te.objectMode&&c(X);return B&&!a.isBuffer(X)&&(X=f(X)),typeof D=="function"&&($=D,D=null),B?D="buffer":D||(D=te.defaultEncoding),typeof $!="function"&&($=z),te.ending?w(this,$):(B||E(this,te,X,$))&&(te.pendingcb++,ue=_(this,te,B,X,D,$)),ue},v.prototype.cork=function(){this._writableState.corked++},v.prototype.uncork=function(){var X=this._writableState;X.corked&&(X.corked--,!X.writing&&!X.corked&&!X.bufferProcessing&&X.bufferedRequest&&P(this,X))},v.prototype.setDefaultEncoding=function(D){if(typeof D=="string"&&(D=D.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((D+"").toLowerCase())>-1))throw new ie(D);return this._writableState.defaultEncoding=D,this},Object.defineProperty(v.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function J(X,D,$){return!X.objectMode&&X.decodeStrings!==!1&&typeof D=="string"&&(D=a.from(D,$)),D}Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function _(X,D,$,te,ue,B){if(!$){var U=J(D,te,ue);te!==U&&($=!0,ue="buffer",te=U)}var C=D.objectMode?1:te.length;D.length+=C;var G=D.length>5===6?2:I>>4===14?3:I>>3===30?4:I>>6===2?-1:-2}function f(I,y,ie){var F=y.length-1;if(F=0?(z>0&&(I.lastNeed=z-1),z):--F=0?(z>0&&(I.lastNeed=z-2),z):--F=0?(z>0&&(z===2?z=0:I.lastNeed=z-3),z):0))}function c(I,y,ie){if((y[0]&192)!==128)return I.lastNeed=0,"�";if(I.lastNeed>1&&y.length>1){if((y[1]&192)!==128)return I.lastNeed=1,"�";if(I.lastNeed>2&&y.length>2&&(y[2]&192)!==128)return I.lastNeed=2,"�"}}function l(I){var y=this.lastTotal-this.lastNeed,ie=c(this,I);if(ie!==void 0)return ie;if(this.lastNeed<=I.length)return I.copy(this.lastChar,y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);I.copy(this.lastChar,y,0,I.length),this.lastNeed-=I.length}function d(I,y){var ie=f(this,I,y);if(!this.lastNeed)return I.toString("utf8",y);this.lastTotal=ie;var F=I.length-(ie-this.lastNeed);return I.copy(this.lastChar,0,F),I.toString("utf8",y,F)}function h(I){var y=I&&I.length?this.write(I):"";return this.lastNeed?y+"�":y}function b(I,y){if((I.length-y)%2===0){var ie=I.toString("utf16le",y);if(ie){var F=ie.charCodeAt(ie.length-1);if(F>=55296&&F<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=I[I.length-2],this.lastChar[1]=I[I.length-1],ie.slice(0,-1)}return ie}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=I[I.length-1],I.toString("utf16le",y,I.length-1)}function R(I){var y=I&&I.length?this.write(I):"";if(this.lastNeed){var ie=this.lastTotal-this.lastNeed;return y+this.lastChar.toString("utf16le",0,ie)}return y}function A(I,y){var ie=(I.length-y)%3;return ie===0?I.toString("base64",y):(this.lastNeed=3-ie,this.lastTotal=3,ie===1?this.lastChar[0]=I[I.length-1]:(this.lastChar[0]=I[I.length-2],this.lastChar[1]=I[I.length-1]),I.toString("base64",y,I.length-ie))}function N(I){var y=I&&I.length?this.write(I):"";return this.lastNeed?y+this.lastChar.toString("base64",0,3-this.lastNeed):y}function ae(I){return I.toString(this.encoding)}function K(I){return I&&I.length?this.write(I):""}return Jc}var jy=Oo.codes.ERR_STREAM_PREMATURE_CLOSE;function EP(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),a=0;a0)if(typeof U!="string"&&!Re.objectMode&&Object.getPrototypeOf(U)!==i.prototype&&(U=s(U)),G)Re.endEmitted?z(B,new I):J(B,Re,U,!0);else if(Re.ended)z(B,new ae);else{if(Re.destroyed)return!1;Re.reading=!1,Re.decoder&&!C?(U=Re.decoder.write(U),Re.objectMode||U.length!==0?J(B,Re,U,!1):P(B,Re)):J(B,Re,U,!1)}else G||(Re.reading=!1,P(B,Re))}return!Re.ended&&(Re.length=m?B=m:(B--,B|=B>>>1,B|=B>>>2,B|=B>>>4,B|=B>>>8,B|=B>>>16,B++),B}function L(B,U){return B<=0||U.length===0&&U.ended?0:U.objectMode?1:B!==B?U.flowing&&U.length?U.buffer.head.data.length:U.length:(B>U.highWaterMark&&(U.highWaterMark=S(B)),B<=U.length?B:U.ended?U.length:(U.needReadable=!0,0))}w.prototype.read=function(B){l("read",B),B=parseInt(B,10);var U=this._readableState,C=B;if(B!==0&&(U.emittedReadable=!1),B===0&&U.needReadable&&((U.highWaterMark!==0?U.length>=U.highWaterMark:U.length>0)||U.ended))return l("read: emitReadable",U.length,U.ended),U.length===0&&U.ended?$(this):M(this),null;if(B=L(B,U),B===0&&U.ended)return U.length===0&&$(this),null;var G=U.needReadable;l("need readable",G),(U.length===0||U.length-B0?ce=D(B,U):ce=null,ce===null?(U.needReadable=U.length<=U.highWaterMark,B=0):(U.length-=B,U.awaitDrain=0),U.length===0&&(U.ended||(U.needReadable=!0),C!==B&&U.ended&&$(this)),ce!==null&&this.emit("data",ce),ce};function H(B,U){if(l("onEofChunk"),!U.ended){if(U.decoder){var C=U.decoder.end();C&&C.length&&(U.buffer.push(C),U.length+=U.objectMode?1:C.length)}U.ended=!0,U.sync?M(B):(U.needReadable=!1,U.emittedReadable||(U.emittedReadable=!0,W(B)))}}function M(B){var U=B._readableState;l("emitReadable",U.needReadable,U.emittedReadable),U.needReadable=!1,U.emittedReadable||(l("emitReadable",U.flowing),U.emittedReadable=!0,Ce.process.nextTick(W,B))}function W(B){var U=B._readableState;l("emitReadable_",U.destroyed,U.length,U.ended),!U.destroyed&&(U.length||U.ended)&&(B.emit("readable"),U.emittedReadable=!1),U.needReadable=!U.flowing&&!U.ended&&U.length<=U.highWaterMark,X(B)}function P(B,U){U.readingMore||(U.readingMore=!0,Ce.process.nextTick(T,B,U))}function T(B,U){for(;!U.reading&&!U.ended&&(U.length1&&ue(G.pipes,B)!==-1)&&!Ye&&(l("false write response, pause",G.awaitDrain),G.awaitDrain++),C.pause())}function et(Ee){l("onerror",Ee),Y(),B.removeListener("error",et),t(B,"error")===0&&z(B,Ee)}ne(B,"error",et);function ye(){B.removeListener("finish",O),Y()}B.once("close",ye);function O(){l("onfinish"),B.removeListener("close",ye),Y()}B.once("finish",O);function Y(){l("unpipe"),C.unpipe(B)}return B.emit("pipe",C),G.flowing||(l("pipe resume"),C.resume()),B};function re(B){return function(){var C=B._readableState;l("pipeOnDrain",C.awaitDrain),C.awaitDrain&&C.awaitDrain--,C.awaitDrain===0&&t(B,"data")&&(C.flowing=!0,X(B))}}w.prototype.unpipe=function(B){var U=this._readableState,C={hasUnpiped:!1};if(U.pipesCount===0)return this;if(U.pipesCount===1)return B&&B!==U.pipes?this:(B||(B=U.pipes),U.pipes=null,U.pipesCount=0,U.flowing=!1,B&&B.emit("unpipe",this,C),this);if(!B){var G=U.pipes,ce=U.pipesCount;U.pipes=null,U.pipesCount=0,U.flowing=!1;for(var Re=0;Re0,G.flowing!==!1&&this.resume()):B==="readable"&&!G.endEmitted&&!G.readableListening&&(G.readableListening=G.needReadable=!0,G.flowing=!1,G.emittedReadable=!1,l("on readable",G.length,G.reading),G.length?M(this):G.reading||Ce.process.nextTick(Q,this)),C},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(B,U){var C=r.prototype.removeListener.call(this,B,U);return B==="readable"&&Ce.process.nextTick(j,this),C},w.prototype.removeAllListeners=function(B){var U=r.prototype.removeAllListeners.apply(this,arguments);return(B==="readable"||B===void 0)&&Ce.process.nextTick(j,this),U};function j(B){var U=B._readableState;U.readableListening=B.listenerCount("readable")>0,U.resumeScheduled&&!U.paused?U.flowing=!0:B.listenerCount("data")>0&&B.resume()}function Q(B){l("readable nexttick read 0"),B.read(0)}w.prototype.resume=function(){var B=this._readableState;return B.flowing||(l("resume"),B.flowing=!B.readableListening,se(this,B)),B.paused=!1,this};function se(B,U){U.resumeScheduled||(U.resumeScheduled=!0,Ce.process.nextTick(de,B,U))}function de(B,U){l("resume",U.reading),U.reading||B.read(0),U.resumeScheduled=!1,B.emit("resume"),X(B),U.flowing&&!U.reading&&B.read(0)}w.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function X(B){var U=B._readableState;for(l("flow",U.flowing);U.flowing&&B.read()!==null;);}w.prototype.wrap=function(B){var U=this,C=this._readableState,G=!1;B.on("end",function(){if(l("wrapped end"),C.decoder&&!C.ended){var Se=C.decoder.end();Se&&Se.length&&U.push(Se)}U.push(null)}),B.on("data",function(Se){if(l("wrapped data"),C.decoder&&(Se=C.decoder.write(Se)),!(C.objectMode&&Se==null)&&!(!C.objectMode&&(!Se||!Se.length))){var De=U.push(Se);De||(G=!0,B.pause())}});for(var ce in B)this[ce]===void 0&&typeof B[ce]=="function"&&(this[ce]=function(De){return function(){return B[De].apply(B,arguments)}}(ce));for(var Re=0;Re=U.length?(U.decoder?C=U.buffer.join(""):U.buffer.length===1?C=U.buffer.first():C=U.buffer.concat(U.length),U.buffer.clear()):C=U.buffer.consume(B,U.decoder),C}function $(B){var U=B._readableState;l("endReadable",U.endEmitted),U.endEmitted||(U.ended=!0,Ce.process.nextTick(te,U,B))}function te(B,U){if(l("endReadableNT",B.endEmitted,B.length),!B.endEmitted&&B.length===0&&(B.endEmitted=!0,U.readable=!1,U.emit("end"),B.autoDestroy)){var C=U._writableState;(!C||C.autoDestroy&&C.finished)&&U.destroy()}}typeof Symbol=="function"&&(w.from=function(B,U){return F===void 0&&(F=TP()),F(w,B,U)});function ue(B,U){for(var C=0,G=B.length;C0;return DP(f,l,d,function(h){a||(a=h),h&&s.forEach(Wy),!l&&(s.forEach(Wy),i(a))})});return t.reduce(jP)}var ew=UP;(function(e,t){t=e.exports=hp(),t.Stream=t,t.Readable=t,t.Writable=dp(),t.Duplex=wo(),t.Transform=pp,t.PassThrough=Xv,t.finished=Du,t.pipeline=ew})(_h,_h.exports);var Ta=_h.exports,kP=yn,gp=Wi.EventEmitter,qP=wi;qP(yn,gp);yn.Readable=hp();yn.Writable=dp();yn.Duplex=wo();yn.Transform=pp;yn.PassThrough=Xv;yn.finished=Du;yn.pipeline=ew;yn.Stream=yn;function yn(){gp.call(this)}yn.prototype.pipe=function(e,t){var r=this;function i(h){e.writable&&e.write(h)===!1&&r.pause&&r.pause()}r.on("data",i);function a(){r.readable&&r.resume&&r.resume()}e.on("drain",a),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",f),r.on("close",c));var s=!1;function f(){s||(s=!0,e.end())}function c(){s||(s=!0,typeof e.destroy=="function"&&e.destroy())}function l(h){if(d(),gp.listenerCount(this,"error")===0)throw h}r.on("error",l),e.on("error",l);function d(){r.removeListener("data",i),e.removeListener("drain",a),r.removeListener("end",f),r.removeListener("close",c),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d)}return r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e};var td={exports:{}},rd={},zy;function tw(){if(zy)return rd;zy=1;function e(z){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(q){return typeof q}:function(q){return q&&typeof Symbol=="function"&&q.constructor===Symbol&&q!==Symbol.prototype?"symbol":typeof q},e(z)}function t(z,q){for(var ne=0;ne"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function R(z){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},R(z)}var A={},N,ae;function K(z,q,ne){ne||(ne=Error);function v(E,J,_){return typeof q=="string"?q:q(E,J,_)}var w=function(E){f(_,E);var J=l(_);function _(m,S,L){var H;return s(this,_),H=J.call(this,v(m,S,L)),H.code=z,H}return r(_)}(ne);A[z]=w}function I(z,q){if(Array.isArray(z)){var ne=z.length;return z=z.map(function(v){return String(v)}),ne>2?"one of ".concat(q," ").concat(z.slice(0,ne-1).join(", "),", or ")+z[ne-1]:ne===2?"one of ".concat(q," ").concat(z[0]," or ").concat(z[1]):"of ".concat(q," ").concat(z[0])}else return"of ".concat(q," ").concat(String(z))}function y(z,q,ne){return z.substr(!ne||ne<0?0:+ne,q.length)===q}function ie(z,q,ne){return(ne===void 0||ne>z.length)&&(ne=z.length),z.substring(ne-q.length,ne)===q}function F(z,q,ne){return typeof ne!="number"&&(ne=0),ne+q.length>z.length?!1:z.indexOf(q,ne)!==-1}return K("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),K("ERR_INVALID_ARG_TYPE",function(z,q,ne){N===void 0&&(N=_u()),N(typeof z=="string","'name' must be a string");var v;typeof q=="string"&&y(q,"not ")?(v="must not be",q=q.replace(/^not /,"")):v="must be";var w;if(ie(z," argument"))w="The ".concat(z," ").concat(v," ").concat(I(q,"type"));else{var E=F(z,".")?"property":"argument";w='The "'.concat(z,'" ').concat(E," ").concat(v," ").concat(I(q,"type"))}return w+=". Received type ".concat(e(ne)),w},TypeError),K("ERR_INVALID_ARG_VALUE",function(z,q){var ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";ae===void 0&&(ae=Zn);var v=ae.inspect(q);return v.length>128&&(v="".concat(v.slice(0,128),"...")),"The argument '".concat(z,"' ").concat(ne,". Received ").concat(v)},TypeError),K("ERR_INVALID_RETURN_VALUE",function(z,q,ne){var v;return ne&&ne.constructor&&ne.constructor.name?v="instance of ".concat(ne.constructor.name):v="type ".concat(e(ne)),"Expected ".concat(z,' to be returned from the "').concat(q,'"')+" function but got ".concat(v,".")},TypeError),K("ERR_MISSING_ARGS",function(){for(var z=arguments.length,q=new Array(z),ne=0;ne0,"At least one arg needs to be specified");var v="The ",w=q.length;switch(q=q.map(function(E){return'"'.concat(E,'"')}),w){case 1:v+="".concat(q[0]," argument");break;case 2:v+="".concat(q[0]," and ").concat(q[1]," arguments");break;default:v+=q.slice(0,w-1).join(", "),v+=", and ".concat(q[w-1]," arguments");break}return"".concat(v," must be specified")},TypeError),rd.codes=A,rd}var nd,Gy;function HP(){if(Gy)return nd;Gy=1;function e(P,T){var re=Object.keys(P);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(P);T&&(j=j.filter(function(Q){return Object.getOwnPropertyDescriptor(P,Q).enumerable})),re.push.apply(re,j)}return re}function t(P){for(var T=1;T"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ae(P){return Function.toString.call(P).indexOf("[native code]")!==-1}function K(P,T){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,Q){return j.__proto__=Q,j},K(P,T)}function I(P){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(re){return re.__proto__||Object.getPrototypeOf(re)},I(P)}function y(P){"@babel/helpers - typeof";return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(T){return typeof T}:function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},y(P)}var ie=Zn,F=ie.inspect,z=tw(),q=z.codes.ERR_INVALID_ARG_TYPE;function ne(P,T,re){return(re===void 0||re>P.length)&&(re=P.length),P.substring(re-T.length,re)===T}function v(P,T){if(T=Math.floor(T),P.length==0||T==0)return"";var re=P.length*T;for(T=Math.floor(Math.log(T)/Math.log(2));T;)P+=P,T--;return P+=P.substring(0,re-P.length),P}var w="",E="",J="",_="",m={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},S=10;function L(P){var T=Object.keys(P),re=Object.create(Object.getPrototypeOf(P));return T.forEach(function(j){re[j]=P[j]}),Object.defineProperty(re,"message",{value:P.message}),re}function H(P){return F(P,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function M(P,T,re){var j="",Q="",se=0,de="",X=!1,D=H(P),$=D.split(` -`),te=H(T).split(` -`),ue=0,B="";if(re==="strictEqual"&&y(P)==="object"&&y(T)==="object"&&P!==null&&T!==null&&(re="strictEqualObject"),$.length===1&&te.length===1&&$[0]!==te[0]){var U=$[0].length+te[0].length;if(U<=S){if((y(P)!=="object"||P===null)&&(y(T)!=="object"||T===null)&&(P!==0||T!==0))return"".concat(m[re],` - -`)+"".concat($[0]," !== ").concat(te[0],` -`)}else if(re!=="strictEqualObject"){var C=Ce.process.stderr&&Ce.process.stderr.isTTY?Ce.process.stderr.columns:80;if(U2&&(B=` - `.concat(v(" ",ue),"^"),ue=0)}}}for(var G=$[$.length-1],ce=te[te.length-1];G===ce&&(ue++<2?de=` - `.concat(G).concat(de):j=G,$.pop(),te.pop(),!($.length===0||te.length===0));)G=$[$.length-1],ce=te[te.length-1];var Re=Math.max($.length,te.length);if(Re===0){var Se=D.split(` -`);if(Se.length>30)for(Se[26]="".concat(w,"...").concat(_);Se.length>27;)Se.pop();return"".concat(m.notIdentical,` - -`).concat(Se.join(` -`),` -`)}ue>3&&(de=` -`.concat(w,"...").concat(_).concat(de),X=!0),j!==""&&(de=` - `.concat(j).concat(de),j="");var De=0,me=m[re]+` -`.concat(E,"+ actual").concat(_," ").concat(J,"- expected").concat(_),Ye=" ".concat(w,"...").concat(_," Lines skipped");for(ue=0;ue1&&ue>2&&(Je>4?(Q+=` -`.concat(w,"...").concat(_),X=!0):Je>3&&(Q+=` - `.concat(te[ue-2]),De++),Q+=` - `.concat(te[ue-1]),De++),se=ue,j+=` -`.concat(J,"-").concat(_," ").concat(te[ue]),De++;else if(te.length1&&ue>2&&(Je>4?(Q+=` -`.concat(w,"...").concat(_),X=!0):Je>3&&(Q+=` - `.concat($[ue-2]),De++),Q+=` - `.concat($[ue-1]),De++),se=ue,Q+=` -`.concat(E,"+").concat(_," ").concat($[ue]),De++;else{var rt=te[ue],et=$[ue],ye=et!==rt&&(!ne(et,",")||et.slice(0,-1)!==rt);ye&&ne(rt,",")&&rt.slice(0,-1)===et&&(ye=!1,et+=","),ye?(Je>1&&ue>2&&(Je>4?(Q+=` -`.concat(w,"...").concat(_),X=!0):Je>3&&(Q+=` - `.concat($[ue-2]),De++),Q+=` - `.concat($[ue-1]),De++),se=ue,Q+=` -`.concat(E,"+").concat(_," ").concat(et),j+=` -`.concat(J,"-").concat(_," ").concat(rt),De+=2):(Q+=j,j="",(Je===1||ue===0)&&(Q+=` - `.concat(et),De++))}if(De>20&&ue30)for(U[26]="".concat(w,"...").concat(_);U.length>27;)U.pop();U.length===1?se=re.call(this,"".concat(B," ").concat(U[0])):se=re.call(this,"".concat(B,` - -`).concat(U.join(` -`),` -`))}else{var C=H($),G="",ce=m[X];X==="notDeepEqual"||X==="notEqual"?(C="".concat(m[X],` - -`).concat(C),C.length>1024&&(C="".concat(C.slice(0,1021),"..."))):(G="".concat(H(te)),C.length>512&&(C="".concat(C.slice(0,509),"...")),G.length>512&&(G="".concat(G.slice(0,509),"...")),X==="deepEqual"||X==="equal"?C="".concat(ce,` - -`).concat(C,` - -should equal - -`):G=" ".concat(X," ").concat(G)),se=re.call(this,"".concat(C).concat(G))}return Error.stackTraceLimit=ue,se.generatedMessage=!de,Object.defineProperty(b(se),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),se.code="ERR_ASSERTION",se.actual=$,se.expected=te,se.operator=X,Error.captureStackTrace&&Error.captureStackTrace(b(se),D),se.stack,se.name="AssertionError",h(se)}return s(j,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:T,value:function(se,de){return F(this,t(t({},de),{},{customInspect:!1,depth:0}))}}]),j}(R(Error),F.custom);return nd=W,nd}var Vy=Object.prototype.toString,rw=function(t){var r=Vy.call(t),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Vy.call(t.callee)==="[object Function]"),i},id,Zy;function WP(){if(Zy)return id;Zy=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=rw,a=Object.prototype.propertyIsEnumerable,s=!a.call({toString:null},"toString"),f=a.call(function(){},"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(R){var A=R.constructor;return A&&A.prototype===R},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var R in window)try{if(!d["$"+R]&&t.call(window,R)&&window[R]!==null&&typeof window[R]=="object")try{l(window[R])}catch{return!0}}catch{return!0}return!1}(),b=function(R){if(typeof window>"u"||!h)return l(R);try{return l(R)}catch{return!1}};e=function(A){var N=A!==null&&typeof A=="object",ae=r.call(A)==="[object Function]",K=i(A),I=N&&r.call(A)==="[object String]",y=[];if(!N&&!ae&&!K)throw new TypeError("Object.keys called on a non-object");var ie=f&&ae;if(I&&A.length>0&&!t.call(A,0))for(var F=0;F0)for(var z=0;z2?arguments[2]:{},R=e(h);t&&(R=i.call(R,Object.getOwnPropertySymbols(h)));for(var A=0;Aye.length)&&(O=ye.length);for(var Y=0,Ee=new Array(O);Y10)return!0;for(var O=0;O57)return!0}return ye.length===10&&ye>=Math.pow(2,32)}function W(ye){return Object.keys(ye).filter(M).concat(b(ye).filter(Object.prototype.propertyIsEnumerable.bind(ye)))}/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */function P(ye,O){if(ye===O)return 0;for(var Y=ye.length,Ee=O.length,ve=0,$e=Math.min(Y,Ee);ve<$e;++ve)if(ye[ve]!==O[ve]){Y=ye[ve],Ee=O[ve];break}return Y1?te-1:0),B=1;B1?te-1:0),B=1;B1?te-1:0),B=1;B1?te-1:0),B=1;Bb?W.c=W.e=null:v.e=10;S/=10,m++);m>b?W.c=W.e=null:(W.e=m,W.c=[v]);return}M=String(v)}else{if(!aL.test(M=String(v)))return i(W,M,L);W.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}(m=M.indexOf("."))>-1&&(M=M.replace(".","")),(S=M.search(/e/i))>0?(m<0&&(m=S),m+=+M.slice(S+1),M=M.substring(0,S)):m<0&&(m=M.length)}else{if(Vt(w,2,K.length,"Base"),w==10&&I)return W=new y(v),q(W,f+W.e+1,c);if(M=String(v),L=typeof v=="number"){if(v*0!=0)return i(W,M,L,w);if(W.s=1/v<0?(M=M.slice(1),-1):1,y.DEBUG&&M.replace(/^0\.0*|\./,"").length>15)throw Error(u_+v)}else W.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1;for(E=K.slice(0,w),m=S=0,H=M.length;Sm){m=H;continue}}else if(!_&&(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase()))){_=!0,S=-1,m=0;continue}return i(W,String(v),L,w)}L=!1,M=r(M,w,10,W.s),(m=M.indexOf("."))>-1?M=M.replace(".",""):m=M.length}for(S=0;M.charCodeAt(S)===48;S++);for(H=M.length;M.charCodeAt(--H)===48;);if(M=M.slice(S,++H)){if(H-=S,L&&y.DEBUG&&H>15&&(v>gd||v!==fn(v)))throw Error(u_+W.s*v);if((m=m-S-1)>b)W.c=W.e=null;else if(m=-fr&&_<=fr&&_===fn(_)){if(J[0]===0){if(_===0&&J.length===1)return!0;break e}if(w=(_+1)%ut,w<1&&(w+=ut),String(J[0]).length==w){for(w=0;w=Rn||E!==fn(E))break e;if(E!==0)return!0}}}else if(J===null&&_===null&&(m===null||m===1||m===-1))return!0;throw Error($r+"Invalid BigNumber: "+v)},y.maximum=y.max=function(){return F(arguments,-1)},y.minimum=y.min=function(){return F(arguments,1)},y.random=function(){var v=9007199254740992,w=Math.random()*v&2097151?function(){return fn(Math.random()*v)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(E){var J,_,m,S,L,H=0,M=[],W=new y(s);if(E==null?E=f:Vt(E,0,fr),S=pd(E/ut),R)if(crypto.getRandomValues){for(J=crypto.getRandomValues(new Uint32Array(S*=2));H>>11),L>=9e15?(_=crypto.getRandomValues(new Uint32Array(2)),J[H]=_[0],J[H+1]=_[1]):(M.push(L%1e14),H+=2);H=S/2}else if(crypto.randomBytes){for(J=crypto.randomBytes(S*=7);H=9e15?crypto.randomBytes(7).copy(J,H):(M.push(L%1e14),H+=7);H=S/7}else throw R=!1,Error($r+"crypto unavailable");if(!R)for(;H=10;L/=10,H++);H_-1&&(L[S+1]==null&&(L[S+1]=0),L[S+1]+=L[S]/_|0,L[S]%=_)}return L.reverse()}return function(E,J,_,m,S){var L,H,M,W,P,T,re,j,Q=E.indexOf("."),se=f,de=c;for(Q>=0&&(W=N,N=0,E=E.replace(".",""),j=new y(J),T=j.pow(E.length-Q),N=W,j.c=w(ui(nn(T.c),T.e,"0"),10,_,v),j.e=j.c.length),re=w(E,J,_,S?(L=K,v):(L=v,K)),M=W=re.length;re[--W]==0;re.pop());if(!re[0])return L.charAt(0);if(Q<0?--M:(T.c=re,T.e=M,T.s=m,T=t(T,j,se,de,_),re=T.c,P=T.r,M=T.e),H=M+se+1,Q=re[H],W=_/2,P=P||H<0||re[H+1]!=null,P=de<4?(Q!=null||P)&&(de==0||de==(T.s<0?3:2)):Q>W||Q==W&&(de==4||P||de==6&&re[H-1]&1||de==(T.s<0?8:7)),H<1||!re[0])E=P?ui(L.charAt(1),-se,L.charAt(0)):L.charAt(0);else{if(re.length=H,P)for(--_;++re[--H]>_;)re[H]=0,H||(++M,re=[1].concat(re));for(W=re.length;!re[--W];);for(Q=0,E="";Q<=W;E+=L.charAt(re[Q++]));E=ui(E,M,L.charAt(0))}return E}}(),t=function(){function v(J,_,m){var S,L,H,M,W=0,P=J.length,T=_%xi,re=_/xi|0;for(J=J.slice();P--;)H=J[P]%xi,M=J[P]/xi|0,S=re*H+M*T,L=T*H+S%xi*xi+W,W=(L/m|0)+(S/xi|0)+re*M,J[P]=L%m;return W&&(J=[W].concat(J)),J}function w(J,_,m,S){var L,H;if(m!=S)H=m>S?1:-1;else for(L=H=0;L_[L]?1:-1;break}return H}function E(J,_,m,S){for(var L=0;m--;)J[m]-=L,L=J[m]<_[m]?1:0,J[m]=L*S+J[m]-_[m];for(;!J[0]&&J.length>1;J.splice(0,1));}return function(J,_,m,S,L){var H,M,W,P,T,re,j,Q,se,de,X,D,$,te,ue,B,U,C=J.s==_.s?1:-1,G=J.c,ce=_.c;if(!G||!G[0]||!ce||!ce[0])return new y(!J.s||!_.s||(G?ce&&G[0]==ce[0]:!ce)?NaN:G&&G[0]==0||!ce?C*0:C/0);for(Q=new y(C),se=Q.c=[],M=J.e-_.e,C=m+M+1,L||(L=Rn,M=un(J.e/ut)-un(_.e/ut),C=C/ut|0),W=0;ce[W]==(G[W]||0);W++);if(ce[W]>(G[W]||0)&&M--,C<0)se.push(1),P=!0;else{for(te=G.length,B=ce.length,W=0,C+=2,T=fn(L/(ce[0]+1)),T>1&&(ce=v(ce,T,L),G=v(G,T,L),B=ce.length,te=G.length),$=B,de=G.slice(0,B),X=de.length;X=L/2&&ue++;do{if(T=0,H=w(ce,de,B,X),H<0){if(D=de[0],B!=X&&(D=D*L+(de[1]||0)),T=fn(D/ue),T>1)for(T>=L&&(T=L-1),re=v(ce,T,L),j=re.length,X=de.length;w(re,de,j,X)==1;)T--,E(re,B=10;C/=10,W++);q(Q,m+(Q.e=W+M*ut-1)+1,S,P)}else Q.e=M,Q.r=+P;return Q}}();function ie(v,w,E,J){var _,m,S,L,H;if(E==null?E=c:Vt(E,0,8),!v.c)return v.toString();if(_=v.c[0],S=v.e,w==null)H=nn(v.c),H=J==1||J==2&&(S<=l||S>=d)?Wf(H,S):ui(H,S,"0");else if(v=q(new y(v),w,E),m=v.e,H=nn(v.c),L=H.length,J==1||J==2&&(w<=m||m<=l)){for(;LL){if(--w>0)for(H+=".";w--;H+="0");}else if(w+=m-L,w>0)for(m+1==L&&(H+=".");w--;H+="0");return v.s<0&&_?"-"+H:H}function F(v,w){for(var E,J,_=1,m=new y(v[0]);_=10;_/=10,J++);return(E=J+E*ut-1)>b?v.c=v.e=null:E=10;L/=10,_++);if(m=w-_,m<0)m+=ut,S=w,H=P[M=0],W=fn(H/T[_-S-1]%10);else if(M=pd((m+1)/ut),M>=P.length)if(J){for(;P.length<=M;P.push(0));H=W=0,_=1,m%=ut,S=m-ut+1}else break e;else{for(H=L=P[M],_=1;L>=10;L/=10,_++);m%=ut,S=m-ut+_,W=S<0?0:fn(H/T[_-S-1]%10)}if(J=J||w<0||P[M+1]!=null||(S<0?H:H%T[_-S-1]),J=E<4?(W||J)&&(E==0||E==(v.s<0?3:2)):W>5||W==5&&(E==4||J||E==6&&(m>0?S>0?H/T[_-S]:0:P[M-1])%10&1||E==(v.s<0?8:7)),w<1||!P[0])return P.length=0,J?(w-=v.e+1,P[0]=T[(ut-w%ut)%ut],v.e=-w||0):P[0]=v.e=0,v;if(m==0?(P.length=M,L=1,M--):(P.length=M+1,L=T[ut-m],P[M]=S>0?fn(H/T[_-S]%T[S])*L:0),J)for(;;)if(M==0){for(m=1,S=P[0];S>=10;S/=10,m++);for(S=P[0]+=L,L=1;S>=10;S/=10,L++);m!=L&&(v.e++,P[0]==Rn&&(P[0]=1));break}else{if(P[M]+=L,P[M]!=Rn)break;P[M--]=0,L=1}for(m=P.length;P[--m]===0;P.pop());}v.e>b?v.c=v.e=null:v.e=d?Wf(w,E):ui(w,E,"0"),v.s<0?"-"+w:w)}return a.absoluteValue=a.abs=function(){var v=new y(this);return v.s<0&&(v.s=1),v},a.comparedTo=function(v,w){return uo(this,new y(v,w))},a.decimalPlaces=a.dp=function(v,w){var E,J,_,m=this;if(v!=null)return Vt(v,0,fr),w==null?w=c:Vt(w,0,8),q(new y(m),v+m.e+1,w);if(!(E=m.c))return null;if(J=((_=E.length-1)-un(this.e/ut))*ut,_=E[_])for(;_%10==0;_/=10,J--);return J<0&&(J=0),J},a.dividedBy=a.div=function(v,w){return t(this,new y(v,w),f,c)},a.dividedToIntegerBy=a.idiv=function(v,w){return t(this,new y(v,w),0,1)},a.exponentiatedBy=a.pow=function(v,w){var E,J,_,m,S,L,H,M,W,P=this;if(v=new y(v),v.c&&!v.isInteger())throw Error($r+"Exponent not an integer: "+ne(v));if(w!=null&&(w=new y(w)),L=v.e>14,!P.c||!P.c[0]||P.c[0]==1&&!P.e&&P.c.length==1||!v.c||!v.c[0])return W=new y(Math.pow(+ne(P),L?v.s*(2-Hf(v)):+ne(v))),w?W.mod(w):W;if(H=v.s<0,w){if(w.c?!w.c[0]:!w.s)return new y(NaN);J=!H&&P.isInteger()&&w.isInteger(),J&&(P=P.mod(w))}else{if(v.e>9&&(P.e>0||P.e<-1||(P.e==0?P.c[0]>1||L&&P.c[1]>=24e7:P.c[0]<8e13||L&&P.c[0]<=9999975e7)))return m=P.s<0&&Hf(v)?-0:0,P.e>-1&&(m=1/m),new y(H?1/m:m);N&&(m=pd(N/ut+2))}for(L?(E=new y(.5),H&&(v.s=1),M=Hf(v)):(_=Math.abs(+ne(v)),M=_%2),W=new y(s);;){if(M){if(W=W.times(P),!W.c)break;m?W.c.length>m&&(W.c.length=m):J&&(W=W.mod(w))}if(_){if(_=fn(_/2),_===0)break;M=_%2}else if(v=v.times(E),q(v,v.e+1,1),v.e>14)M=Hf(v);else{if(_=+ne(v),_===0)break;M=_%2}P=P.times(P),m?P.c&&P.c.length>m&&(P.c.length=m):J&&(P=P.mod(w))}return J?W:(H&&(W=s.div(W)),w?W.mod(w):m?q(W,N,c,S):W)},a.integerValue=function(v){var w=new y(this);return v==null?v=c:Vt(v,0,8),q(w,w.e+1,v)},a.isEqualTo=a.eq=function(v,w){return uo(this,new y(v,w))===0},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(v,w){return uo(this,new y(v,w))>0},a.isGreaterThanOrEqualTo=a.gte=function(v,w){return(w=uo(this,new y(v,w)))===1||w===0},a.isInteger=function(){return!!this.c&&un(this.e/ut)>this.c.length-2},a.isLessThan=a.lt=function(v,w){return uo(this,new y(v,w))<0},a.isLessThanOrEqualTo=a.lte=function(v,w){return(w=uo(this,new y(v,w)))===-1||w===0},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&this.c[0]==0},a.minus=function(v,w){var E,J,_,m,S=this,L=S.s;if(v=new y(v,w),w=v.s,!L||!w)return new y(NaN);if(L!=w)return v.s=-w,S.plus(v);var H=S.e/ut,M=v.e/ut,W=S.c,P=v.c;if(!H||!M){if(!W||!P)return W?(v.s=-w,v):new y(P?S:NaN);if(!W[0]||!P[0])return P[0]?(v.s=-w,v):new y(W[0]?S:c==3?-0:0)}if(H=un(H),M=un(M),W=W.slice(),L=H-M){for((m=L<0)?(L=-L,_=W):(M=H,_=P),_.reverse(),w=L;w--;_.push(0));_.reverse()}else for(J=(m=(L=W.length)<(w=P.length))?L:w,L=w=0;w0)for(;w--;W[E++]=0);for(w=Rn-1;J>L;){if(W[--J]=0;){for(E=0,T=D[_]%se,re=D[_]/se|0,S=H,m=_+S;m>_;)M=X[--S]%se,W=X[S]/se|0,L=re*M+W*T,M=T*M+L%se*se+j[m]+E,E=(M/Q|0)+(L/se|0)+re*W,j[m--]=M%Q;j[m]=E}return E?++J:j.splice(0,1),z(v,j,J)},a.negated=function(){var v=new y(this);return v.s=-v.s||null,v},a.plus=function(v,w){var E,J=this,_=J.s;if(v=new y(v,w),w=v.s,!_||!w)return new y(NaN);if(_!=w)return v.s=-w,J.minus(v);var m=J.e/ut,S=v.e/ut,L=J.c,H=v.c;if(!m||!S){if(!L||!H)return new y(_/0);if(!L[0]||!H[0])return H[0]?v:new y(L[0]?J:_*0)}if(m=un(m),S=un(S),L=L.slice(),_=m-S){for(_>0?(S=m,E=H):(_=-_,E=L),E.reverse();_--;E.push(0));E.reverse()}for(_=L.length,w=H.length,_-w<0&&(E=H,H=L,L=E,w=_),_=0;w;)_=(L[--w]=L[w]+H[w]+_)/Rn|0,L[w]=Rn===L[w]?0:L[w]%Rn;return _&&(L=[_].concat(L),++S),z(v,L,S)},a.precision=a.sd=function(v,w){var E,J,_,m=this;if(v!=null&&v!==!!v)return Vt(v,1,fr),w==null?w=c:Vt(w,0,8),q(new y(m),v,w);if(!(E=m.c))return null;if(_=E.length-1,J=_*ut+1,_=E[_]){for(;_%10==0;_/=10,J--);for(_=E[0];_>=10;_/=10,J++);}return v&&m.e+1>J&&(J=m.e+1),J},a.shiftedBy=function(v){return Vt(v,-gd,gd),this.times("1e"+v)},a.squareRoot=a.sqrt=function(){var v,w,E,J,_,m=this,S=m.c,L=m.s,H=m.e,M=f+4,W=new y("0.5");if(L!==1||!S||!S[0])return new y(!L||L<0&&(!S||S[0])?NaN:S?m:1/0);if(L=Math.sqrt(+ne(m)),L==0||L==1/0?(w=nn(S),(w.length+H)%2==0&&(w+="0"),L=Math.sqrt(+w),H=un((H+1)/2)-(H<0||H%2),L==1/0?w="5e"+H:(w=L.toExponential(),w=w.slice(0,w.indexOf("e")+1)+H),E=new y(w)):E=new y(L+""),E.c[0]){for(H=E.e,L=H+M,L<3&&(L=0);;)if(_=E,E=W.times(_.plus(t(m,_,M,1))),nn(_.c).slice(0,L)===(w=nn(E.c)).slice(0,L))if(E.e0&&j>0){for(m=j%L||L,W=re.substr(0,m);m0&&(W+=M+re.slice(m)),T&&(W="-"+W)}J=P?W+(E.decimalSeparator||"")+((H=+E.fractionGroupSize)?P.replace(new RegExp("\\d{"+H+"}\\B","g"),"$&"+(E.fractionGroupSeparator||"")):P):W}return(E.prefix||"")+J+(E.suffix||"")},a.toFraction=function(v){var w,E,J,_,m,S,L,H,M,W,P,T,re=this,j=re.c;if(v!=null&&(L=new y(v),!L.isInteger()&&(L.c||L.s!==1)||L.lt(s)))throw Error($r+"Argument "+(L.isInteger()?"out of range: ":"not an integer: ")+ne(L));if(!j)return new y(re);for(w=new y(s),M=E=new y(s),J=H=new y(s),T=nn(j),m=w.e=T.length-re.e-1,w.c[0]=yd[(S=m%ut)<0?ut+S:S],v=!v||L.comparedTo(w)>0?m>0?w:M:L,S=b,b=1/0,L=new y(T),H.c[0]=0;W=t(L,w,0,1),_=E.plus(W.times(J)),_.comparedTo(v)!=1;)E=J,J=_,M=H.plus(W.times(_=M)),H=_,w=L.minus(W.times(_=w)),L=_;return _=t(v.minus(E),J,0,1),H=H.plus(_.times(M)),E=E.plus(_.times(J)),H.s=M.s=re.s,m=m*2,P=t(M,J,m,c).minus(re).abs().comparedTo(t(H,E,m,c).minus(re).abs())<1?[M,J]:[H,E],b=S,P},a.toNumber=function(){return+ne(this)},a.toPrecision=function(v,w){return v!=null&&Vt(v,1,fr),ie(this,v,w,2)},a.toString=function(v){var w,E=this,J=E.s,_=E.e;return _===null?J?(w="Infinity",J<0&&(w="-"+w)):w="NaN":(v==null?w=_<=l||_>=d?Wf(nn(E.c),_):ui(nn(E.c),_,"0"):v===10&&I?(E=q(new y(E),f+_+1,c),w=ui(nn(E.c),E.e,"0")):(Vt(v,2,K.length,"Base"),w=r(ui(nn(E.c),_,"0"),10,v,J,!0)),J<0&&E.c[0]&&(w="-"+w)),w},a.valueOf=a.toJSON=function(){return ne(this)},a._isBigNumber=!0,a[Symbol.toStringTag]="BigNumber",a[Symbol.for("nodejs.util.inspect.custom")]=a.valueOf,e!=null&&y.set(e),y}function un(e){var t=e|0;return e>0||e===t?t:t-1}function nn(e){for(var t,r,i=1,a=e.length,s=e[0]+"";id^r?1:-1;for(c=(l=a.length)<(d=s.length)?l:d,f=0;fs[f]^r?1:-1;return l==d?0:l>d^r?1:-1}function Vt(e,t,r,i){if(er||e!==fn(e))throw Error($r+(i||"Argument")+(typeof e=="number"?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Hf(e){var t=e.c.length-1;return un(e.e/ut)==t&&e.c[t]%2!=0}function Wf(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ui(e,t,r){var i,a;if(t<0){for(a=r+".";++t;a+=r);e=a+e}else if(i=e.length,++t>i){for(a=r,t-=i;--t;a+=r);e+=a}else tconsole.error("SEMVER",...e):()=>{};var qu=dL;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:a}=ku,s=qu;t=e.exports={};const f=t.re=[],c=t.safeRe=[],l=t.src=[],d=t.t={};let h=0;const b="[a-zA-Z0-9-]",R=[["\\s",1],["\\d",a],[b,i]],A=ae=>{for(const[K,I]of R)ae=ae.split(`${K}*`).join(`${K}{0,${I}}`).split(`${K}+`).join(`${K}{1,${I}}`);return ae},N=(ae,K,I)=>{const y=A(K),ie=h++;s(ae,ie,K),d[ae]=ie,l[ie]=K,f[ie]=new RegExp(K,I?"g":void 0),c[ie]=new RegExp(y,I?"g":void 0)};N("NUMERICIDENTIFIER","0|[1-9]\\d*"),N("NUMERICIDENTIFIERLOOSE","\\d+"),N("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${b}*`),N("MAINVERSION",`(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})\\.(${l[d.NUMERICIDENTIFIER]})`),N("MAINVERSIONLOOSE",`(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})\\.(${l[d.NUMERICIDENTIFIERLOOSE]})`),N("PRERELEASEIDENTIFIER",`(?:${l[d.NUMERICIDENTIFIER]}|${l[d.NONNUMERICIDENTIFIER]})`),N("PRERELEASEIDENTIFIERLOOSE",`(?:${l[d.NUMERICIDENTIFIERLOOSE]}|${l[d.NONNUMERICIDENTIFIER]})`),N("PRERELEASE",`(?:-(${l[d.PRERELEASEIDENTIFIER]}(?:\\.${l[d.PRERELEASEIDENTIFIER]})*))`),N("PRERELEASELOOSE",`(?:-?(${l[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[d.PRERELEASEIDENTIFIERLOOSE]})*))`),N("BUILDIDENTIFIER",`${b}+`),N("BUILD",`(?:\\+(${l[d.BUILDIDENTIFIER]}(?:\\.${l[d.BUILDIDENTIFIER]})*))`),N("FULLPLAIN",`v?${l[d.MAINVERSION]}${l[d.PRERELEASE]}?${l[d.BUILD]}?`),N("FULL",`^${l[d.FULLPLAIN]}$`),N("LOOSEPLAIN",`[v=\\s]*${l[d.MAINVERSIONLOOSE]}${l[d.PRERELEASELOOSE]}?${l[d.BUILD]}?`),N("LOOSE",`^${l[d.LOOSEPLAIN]}$`),N("GTLT","((?:<|>)?=?)"),N("XRANGEIDENTIFIERLOOSE",`${l[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),N("XRANGEIDENTIFIER",`${l[d.NUMERICIDENTIFIER]}|x|X|\\*`),N("XRANGEPLAIN",`[v=\\s]*(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:\\.(${l[d.XRANGEIDENTIFIER]})(?:${l[d.PRERELEASE]})?${l[d.BUILD]}?)?)?`),N("XRANGEPLAINLOOSE",`[v=\\s]*(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[d.XRANGEIDENTIFIERLOOSE]})(?:${l[d.PRERELEASELOOSE]})?${l[d.BUILD]}?)?)?`),N("XRANGE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAIN]}$`),N("XRANGELOOSE",`^${l[d.GTLT]}\\s*${l[d.XRANGEPLAINLOOSE]}$`),N("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),N("COERCERTL",l[d.COERCE],!0),N("LONETILDE","(?:~>?)"),N("TILDETRIM",`(\\s*)${l[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",N("TILDE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAIN]}$`),N("TILDELOOSE",`^${l[d.LONETILDE]}${l[d.XRANGEPLAINLOOSE]}$`),N("LONECARET","(?:\\^)"),N("CARETTRIM",`(\\s*)${l[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",N("CARET",`^${l[d.LONECARET]}${l[d.XRANGEPLAIN]}$`),N("CARETLOOSE",`^${l[d.LONECARET]}${l[d.XRANGEPLAINLOOSE]}$`),N("COMPARATORLOOSE",`^${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]})$|^$`),N("COMPARATOR",`^${l[d.GTLT]}\\s*(${l[d.FULLPLAIN]})$|^$`),N("COMPARATORTRIM",`(\\s*)${l[d.GTLT]}\\s*(${l[d.LOOSEPLAIN]}|${l[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",N("HYPHENRANGE",`^\\s*(${l[d.XRANGEPLAIN]})\\s+-\\s+(${l[d.XRANGEPLAIN]})\\s*$`),N("HYPHENRANGELOOSE",`^\\s*(${l[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[d.XRANGEPLAINLOOSE]})\\s*$`),N("STAR","(<|>)?=?\\s*\\*"),N("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),N("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Oh,Oh.exports);var Ls=Oh.exports;const hL=Object.freeze({loose:!0}),pL=Object.freeze({}),gL=e=>e?typeof e!="object"?hL:e:pL;var _p=gL;const l_=/^[0-9]+$/,cw=(e,t)=>{const r=l_.test(e),i=l_.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:ecw(t,e);var dw={compareIdentifiers:cw,rcompareIdentifiers:yL};const zf=qu,{MAX_LENGTH:c_,MAX_SAFE_INTEGER:Gf}=ku,{safeRe:d_,t:h_}=Ls,_L=_p,{compareIdentifiers:ra}=dw;let bL=class Fn{constructor(t,r){if(r=_L(r),t instanceof Fn){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>c_)throw new TypeError(`version is longer than ${c_} characters`);zf("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const i=t.trim().match(r.loose?d_[h_.LOOSE]:d_[h_.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>Gf||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Gf||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Gf||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(a=>{if(/^[0-9]+$/.test(a)){const s=+a;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(a)}}if(r){let s=[r,a];i===!1&&(s=[r]),ra(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Pr=bL;const p_=Pr,vL=(e,t,r=!1)=>{if(e instanceof p_)return e;try{return new p_(e,t)}catch(i){if(!r)return null;throw i}};var Oa=vL;const wL=Oa,mL=(e,t)=>{const r=wL(e,t);return r?r.version:null};var EL=mL;const SL=Oa,RL=(e,t)=>{const r=SL(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var AL=RL;const g_=Pr,TL=(e,t,r,i,a)=>{typeof r=="string"&&(a=i,i=r,r=void 0);try{return new g_(e instanceof g_?e.version:e,r).inc(t,i,a).version}catch{return null}};var OL=TL;const y_=Oa,IL=(e,t)=>{const r=y_(e,null,!0),i=y_(t,null,!0),a=r.compare(i);if(a===0)return null;const s=a>0,f=s?r:i,c=s?i:r,l=!!f.prerelease.length;if(!!c.prerelease.length&&!l)return!c.patch&&!c.minor?"major":f.patch?"patch":f.minor?"minor":"major";const h=l?"pre":"";return r.major!==i.major?h+"major":r.minor!==i.minor?h+"minor":r.patch!==i.patch?h+"patch":"prerelease"};var PL=IL;const LL=Pr,NL=(e,t)=>new LL(e,t).major;var CL=NL;const BL=Pr,xL=(e,t)=>new BL(e,t).minor;var $L=xL;const ML=Pr,DL=(e,t)=>new ML(e,t).patch;var jL=DL;const FL=Oa,UL=(e,t)=>{const r=FL(e,t);return r&&r.prerelease.length?r.prerelease:null};var kL=UL;const __=Pr,qL=(e,t,r)=>new __(e,r).compare(new __(t,r));var Nn=qL;const HL=Nn,WL=(e,t,r)=>HL(t,e,r);var zL=WL;const GL=Nn,VL=(e,t)=>GL(e,t,!0);var ZL=VL;const b_=Pr,KL=(e,t,r)=>{const i=new b_(e,r),a=new b_(t,r);return i.compare(a)||i.compareBuild(a)};var bp=KL;const JL=bp,XL=(e,t)=>e.sort((r,i)=>JL(r,i,t));var YL=XL;const QL=bp,eN=(e,t)=>e.sort((r,i)=>QL(i,r,t));var tN=eN;const rN=Nn,nN=(e,t,r)=>rN(e,t,r)>0;var Hu=nN;const iN=Nn,oN=(e,t,r)=>iN(e,t,r)<0;var vp=oN;const aN=Nn,sN=(e,t,r)=>aN(e,t,r)===0;var hw=sN;const fN=Nn,uN=(e,t,r)=>fN(e,t,r)!==0;var pw=uN;const lN=Nn,cN=(e,t,r)=>lN(e,t,r)>=0;var wp=cN;const dN=Nn,hN=(e,t,r)=>dN(e,t,r)<=0;var mp=hN;const pN=hw,gN=pw,yN=Hu,_N=wp,bN=vp,vN=mp,wN=(e,t,r,i)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return pN(e,r,i);case"!=":return gN(e,r,i);case">":return yN(e,r,i);case">=":return _N(e,r,i);case"<":return bN(e,r,i);case"<=":return vN(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};var gw=wN;const mN=Pr,EN=Oa,{safeRe:Vf,t:Zf}=Ls,SN=(e,t)=>{if(e instanceof mN)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(Vf[Zf.COERCE]);else{let i;for(;(i=Vf[Zf.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||i.index+i[0].length!==r.index+r[0].length)&&(r=i),Vf[Zf.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;Vf[Zf.COERCERTL].lastIndex=-1}return r===null?null:EN(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};var RN=SN,_d,v_;function AN(){return v_||(v_=1,_d=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),_d}var TN=Tt;Tt.Node=mo;Tt.create=Tt;function Tt(e){var t=this;if(t instanceof Tt||(t=new Tt),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(a){t.push(a)});else if(arguments.length>0)for(var r=0,i=arguments.length;r1)r=t;else if(this.head)i=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;i!==null;a++)r=e(r,i.value,a),i=i.next;return r};Tt.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else if(this.tail)i=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;i!==null;a--)r=e(r,i.value,a),i=i.prev;return r};Tt.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};Tt.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};Tt.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new Tt;if(tthis.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&ithis.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r};Tt.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i1;class NN{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");this[po]=t.max||1/0;const r=t.length||bd;if(this[na]=typeof r!="function"?bd:r,this[ys]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[go]=t.maxAge||0,this[li]=t.dispose,this[w_]=t.noDisposeOnSet||!1,this[yw]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[po]=t||1/0,rs(this)}get max(){return this[po]}set allowStale(t){this[ys]=!!t}get allowStale(){return this[ys]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[go]=t,rs(this)}get maxAge(){return this[go]}set lengthCalculator(t){typeof t!="function"&&(t=bd),t!==this[na]&&(this[na]=t,this[hi]=0,this[ur].forEach(r=>{r.length=this[na](r.value,r.key),this[hi]+=r.length})),rs(this)}get lengthCalculator(){return this[na]}get length(){return this[hi]}get itemCount(){return this[ur].length}rforEach(t,r){r=r||this;for(let i=this[ur].tail;i!==null;){const a=i.prev;m_(this,t,i,r),i=a}}forEach(t,r){r=r||this;for(let i=this[ur].head;i!==null;){const a=i.next;m_(this,t,i,r),i=a}}keys(){return this[ur].toArray().map(t=>t.key)}values(){return this[ur].toArray().map(t=>t.value)}reset(){this[li]&&this[ur]&&this[ur].length&&this[ur].forEach(t=>this[li](t.key,t.value)),this[On]=new Map,this[ur]=new LN,this[hi]=0}dump(){return this[ur].map(t=>bu(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[ur]}set(t,r,i){if(i=i||this[go],i&&typeof i!="number")throw new TypeError("maxAge must be a number");const a=i?Date.now():0,s=this[na](r,t);if(this[On].has(t)){if(s>this[po])return ca(this,this[On].get(t)),!1;const l=this[On].get(t).value;return this[li]&&(this[w_]||this[li](t,l.value)),l.now=a,l.maxAge=i,l.value=r,this[hi]+=s-l.length,l.length=s,this.get(t),rs(this),!0}const f=new CN(t,r,s,a,i);return f.length>this[po]?(this[li]&&this[li](t,r),!1):(this[hi]+=f.length,this[ur].unshift(f),this[On].set(t,this[ur].head),rs(this),!0)}has(t){if(!this[On].has(t))return!1;const r=this[On].get(t).value;return!bu(this,r)}get(t){return vd(this,t,!0)}peek(t){return vd(this,t,!1)}pop(){const t=this[ur].tail;return t?(ca(this,t),t.value):null}del(t){ca(this,this[On].get(t))}load(t){this.reset();const r=Date.now();for(let i=t.length-1;i>=0;i--){const a=t[i],s=a.e||0;if(s===0)this.set(a.k,a.v);else{const f=s-r;f>0&&this.set(a.k,a.v,f)}}}prune(){this[On].forEach((t,r)=>vd(this,r,!1))}}const vd=(e,t,r)=>{const i=e[On].get(t);if(i){const a=i.value;if(bu(e,a)){if(ca(e,i),!e[ys])return}else r&&(e[yw]&&(i.value.now=Date.now()),e[ur].unshiftNode(i));return a.value}},bu=(e,t)=>{if(!t||!t.maxAge&&!e[go])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[go]&&r>e[go]},rs=e=>{if(e[hi]>e[po])for(let t=e[ur].tail;e[hi]>e[po]&&t!==null;){const r=t.prev;ca(e,t),t=r}},ca=(e,t)=>{if(t){const r=t.value;e[li]&&e[li](r.key,r.value),e[hi]-=r.length,e[On].delete(r.key),e[ur].removeNode(t)}};class CN{constructor(t,r,i,a,s){this.key=t,this.value=r,this.length=i,this.now=a,this.maxAge=s||0}}const m_=(e,t,r,i)=>{let a=r.value;bu(e,a)&&(ca(e,r),e[ys]||(a=void 0)),a&&t.call(i,a.value,a.key,e)};var BN=NN,wd,E_;function Cn(){if(E_)return wd;E_=1;class e{constructor(S,L){if(L=i(L),S instanceof e)return S.loose===!!L.loose&&S.includePrerelease===!!L.includePrerelease?S:new e(S.raw,L);if(S instanceof a)return this.raw=S.value,this.set=[[S]],this.format(),this;if(this.options=L,this.loose=!!L.loose,this.includePrerelease=!!L.includePrerelease,this.raw=S.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(H=>this.parseRange(H.trim())).filter(H=>H.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const H=this.set[0];if(this.set=this.set.filter(M=>!N(M[0])),this.set.length===0)this.set=[H];else if(this.set.length>1){for(const M of this.set)if(M.length===1&&ae(M[0])){this.set=[M];break}}}this.format()}format(){return this.range=this.set.map(S=>S.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(S){const H=((this.options.includePrerelease&&R)|(this.options.loose&&A))+":"+S,M=r.get(H);if(M)return M;const W=this.options.loose,P=W?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];S=S.replace(P,J(this.options.includePrerelease)),s("hyphen replace",S),S=S.replace(c[l.COMPARATORTRIM],d),s("comparator trim",S),S=S.replace(c[l.TILDETRIM],h),s("tilde trim",S),S=S.replace(c[l.CARETTRIM],b),s("caret trim",S);let T=S.split(" ").map(se=>I(se,this.options)).join(" ").split(/\s+/).map(se=>E(se,this.options));W&&(T=T.filter(se=>(s("loose invalid filter",se,this.options),!!se.match(c[l.COMPARATORLOOSE])))),s("range list",T);const re=new Map,j=T.map(se=>new a(se,this.options));for(const se of j){if(N(se))return[se];re.set(se.value,se)}re.size>1&&re.has("")&&re.delete("");const Q=[...re.values()];return r.set(H,Q),Q}intersects(S,L){if(!(S instanceof e))throw new TypeError("a Range is required");return this.set.some(H=>K(H,L)&&S.set.some(M=>K(M,L)&&H.every(W=>M.every(P=>W.intersects(P,L)))))}test(S){if(!S)return!1;if(typeof S=="string")try{S=new f(S,this.options)}catch{return!1}for(let L=0;Lm.value==="<0.0.0-0",ae=m=>m.value==="",K=(m,S)=>{let L=!0;const H=m.slice();let M=H.pop();for(;L&&H.length;)L=H.every(W=>M.intersects(W,S)),M=H.pop();return L},I=(m,S)=>(s("comp",m,S),m=z(m,S),s("caret",m),m=ie(m,S),s("tildes",m),m=ne(m,S),s("xrange",m),m=w(m,S),s("stars",m),m),y=m=>!m||m.toLowerCase()==="x"||m==="*",ie=(m,S)=>m.trim().split(/\s+/).map(L=>F(L,S)).join(" "),F=(m,S)=>{const L=S.loose?c[l.TILDELOOSE]:c[l.TILDE];return m.replace(L,(H,M,W,P,T)=>{s("tilde",m,H,M,W,P,T);let re;return y(M)?re="":y(W)?re=`>=${M}.0.0 <${+M+1}.0.0-0`:y(P)?re=`>=${M}.${W}.0 <${M}.${+W+1}.0-0`:T?(s("replaceTilde pr",T),re=`>=${M}.${W}.${P}-${T} <${M}.${+W+1}.0-0`):re=`>=${M}.${W}.${P} <${M}.${+W+1}.0-0`,s("tilde return",re),re})},z=(m,S)=>m.trim().split(/\s+/).map(L=>q(L,S)).join(" "),q=(m,S)=>{s("caret",m,S);const L=S.loose?c[l.CARETLOOSE]:c[l.CARET],H=S.includePrerelease?"-0":"";return m.replace(L,(M,W,P,T,re)=>{s("caret",m,M,W,P,T,re);let j;return y(W)?j="":y(P)?j=`>=${W}.0.0${H} <${+W+1}.0.0-0`:y(T)?W==="0"?j=`>=${W}.${P}.0${H} <${W}.${+P+1}.0-0`:j=`>=${W}.${P}.0${H} <${+W+1}.0.0-0`:re?(s("replaceCaret pr",re),W==="0"?P==="0"?j=`>=${W}.${P}.${T}-${re} <${W}.${P}.${+T+1}-0`:j=`>=${W}.${P}.${T}-${re} <${W}.${+P+1}.0-0`:j=`>=${W}.${P}.${T}-${re} <${+W+1}.0.0-0`):(s("no pr"),W==="0"?P==="0"?j=`>=${W}.${P}.${T}${H} <${W}.${P}.${+T+1}-0`:j=`>=${W}.${P}.${T}${H} <${W}.${+P+1}.0-0`:j=`>=${W}.${P}.${T} <${+W+1}.0.0-0`),s("caret return",j),j})},ne=(m,S)=>(s("replaceXRanges",m,S),m.split(/\s+/).map(L=>v(L,S)).join(" ")),v=(m,S)=>{m=m.trim();const L=S.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return m.replace(L,(H,M,W,P,T,re)=>{s("xRange",m,H,M,W,P,T,re);const j=y(W),Q=j||y(P),se=Q||y(T),de=se;return M==="="&&de&&(M=""),re=S.includePrerelease?"-0":"",j?M===">"||M==="<"?H="<0.0.0-0":H="*":M&&de?(Q&&(P=0),T=0,M===">"?(M=">=",Q?(W=+W+1,P=0,T=0):(P=+P+1,T=0)):M==="<="&&(M="<",Q?W=+W+1:P=+P+1),M==="<"&&(re="-0"),H=`${M+W}.${P}.${T}${re}`):Q?H=`>=${W}.0.0${re} <${+W+1}.0.0-0`:se&&(H=`>=${W}.${P}.0${re} <${W}.${+P+1}.0-0`),s("xRange return",H),H})},w=(m,S)=>(s("replaceStars",m,S),m.trim().replace(c[l.STAR],"")),E=(m,S)=>(s("replaceGTE0",m,S),m.trim().replace(c[S.includePrerelease?l.GTE0PRE:l.GTE0],"")),J=m=>(S,L,H,M,W,P,T,re,j,Q,se,de,X)=>(y(H)?L="":y(M)?L=`>=${H}.0.0${m?"-0":""}`:y(W)?L=`>=${H}.${M}.0${m?"-0":""}`:P?L=`>=${L}`:L=`>=${L}${m?"-0":""}`,y(j)?re="":y(Q)?re=`<${+j+1}.0.0-0`:y(se)?re=`<${j}.${+Q+1}.0-0`:de?re=`<=${j}.${Q}.${se}-${de}`:m?re=`<${j}.${Q}.${+se+1}-0`:re=`<=${re}`,`${L} ${re}`.trim()),_=(m,S,L)=>{for(let H=0;H0){const M=m[H].semver;if(M.major===S.major&&M.minor===S.minor&&M.patch===S.patch)return!0}return!1}return!0};return wd}var md,S_;function Wu(){if(S_)return md;S_=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(h,b){if(b=r(b),h instanceof t){if(h.loose===!!b.loose)return h;h=h.value}h=h.trim().split(/\s+/).join(" "),f("comparator",h,b),this.options=b,this.loose=!!b.loose,this.parse(h),this.semver===e?this.value="":this.value=this.operator+this.semver.version,f("comp",this)}parse(h){const b=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],R=h.match(b);if(!R)throw new TypeError(`Invalid comparator: ${h}`);this.operator=R[1]!==void 0?R[1]:"",this.operator==="="&&(this.operator=""),R[2]?this.semver=new c(R[2],this.options.loose):this.semver=e}toString(){return this.value}test(h){if(f("Comparator.test",h,this.options.loose),this.semver===e||h===e)return!0;if(typeof h=="string")try{h=new c(h,this.options)}catch{return!1}return s(h,this.operator,this.semver,this.options)}intersects(h,b){if(!(h instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(h.value,b).test(this.value):h.operator===""?h.value===""?!0:new l(this.value,b).test(h.semver):(b=r(b),b.includePrerelease&&(this.value==="<0.0.0-0"||h.value==="<0.0.0-0")||!b.includePrerelease&&(this.value.startsWith("<0.0.0")||h.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&h.operator.startsWith(">")||this.operator.startsWith("<")&&h.operator.startsWith("<")||this.semver.version===h.semver.version&&this.operator.includes("=")&&h.operator.includes("=")||s(this.semver,"<",h.semver,b)&&this.operator.startsWith(">")&&h.operator.startsWith("<")||s(this.semver,">",h.semver,b)&&this.operator.startsWith("<")&&h.operator.startsWith(">")))}}md=t;const r=_p,{safeRe:i,t:a}=Ls,s=gw,f=qu,c=Pr,l=Cn();return md}const xN=Cn(),$N=(e,t,r)=>{try{t=new xN(t,r)}catch{return!1}return t.test(e)};var zu=$N;const MN=Cn(),DN=(e,t)=>new MN(e,t).set.map(r=>r.map(i=>i.value).join(" ").trim().split(" "));var jN=DN;const FN=Pr,UN=Cn(),kN=(e,t,r)=>{let i=null,a=null,s=null;try{s=new UN(t,r)}catch{return null}return e.forEach(f=>{s.test(f)&&(!i||a.compare(f)===-1)&&(i=f,a=new FN(i,r))}),i};var qN=kN;const HN=Pr,WN=Cn(),zN=(e,t,r)=>{let i=null,a=null,s=null;try{s=new WN(t,r)}catch{return null}return e.forEach(f=>{s.test(f)&&(!i||a.compare(f)===1)&&(i=f,a=new HN(i,r))}),i};var GN=zN;const Ed=Pr,VN=Cn(),R_=Hu,ZN=(e,t)=>{e=new VN(e,t);let r=new Ed("0.0.0");if(e.test(r)||(r=new Ed("0.0.0-0"),e.test(r)))return r;r=null;for(let i=0;i{const c=new Ed(f.semver.version);switch(f.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!s||R_(c,s))&&(s=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${f.operator}`)}}),s&&(!r||R_(r,s))&&(r=s)}return r&&e.test(r)?r:null};var KN=ZN;const JN=Cn(),XN=(e,t)=>{try{return new JN(e,t).range||"*"}catch{return null}};var YN=XN;const QN=Pr,_w=Wu(),{ANY:eC}=_w,tC=Cn(),rC=zu,A_=Hu,T_=vp,nC=mp,iC=wp,oC=(e,t,r,i)=>{e=new QN(e,i),t=new tC(t,i);let a,s,f,c,l;switch(r){case">":a=A_,s=nC,f=T_,c=">",l=">=";break;case"<":a=T_,s=iC,f=A_,c="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(rC(e,t,i))return!1;for(let d=0;d{A.semver===eC&&(A=new _w(">=0.0.0")),b=b||A,R=R||A,a(A.semver,b.semver,i)?b=A:f(A.semver,R.semver,i)&&(R=A)}),b.operator===c||b.operator===l||(!R.operator||R.operator===c)&&s(e,R.semver))return!1;if(R.operator===l&&f(e,R.semver))return!1}return!0};var Ep=oC;const aC=Ep,sC=(e,t,r)=>aC(e,t,">",r);var fC=sC;const uC=Ep,lC=(e,t,r)=>uC(e,t,"<",r);var cC=lC;const O_=Cn(),dC=(e,t,r)=>(e=new O_(e,r),t=new O_(t,r),e.intersects(t,r));var hC=dC;const pC=zu,gC=Nn;var yC=(e,t,r)=>{const i=[];let a=null,s=null;const f=e.sort((h,b)=>gC(h,b,r));for(const h of f)pC(h,t,r)?(s=h,a||(a=h)):(s&&i.push([a,s]),s=null,a=null);a&&i.push([a,null]);const c=[];for(const[h,b]of i)h===b?c.push(h):!b&&h===f[0]?c.push("*"):b?h===f[0]?c.push(`<=${b}`):c.push(`${h} - ${b}`):c.push(`>=${h}`);const l=c.join(" || "),d=typeof t.raw=="string"?t.raw:String(t);return l.length{if(e===t)return!0;e=new I_(e,r),t=new I_(t,r);let i=!1;e:for(const a of e.set){for(const s of t.set){const f=vC(a,s,r);if(i=i||f!==null,f)continue e}if(i)return!1}return!0},bC=[new Sp(">=0.0.0-0")],P_=[new Sp(">=0.0.0")],vC=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Sd){if(t.length===1&&t[0].semver===Sd)return!0;r.includePrerelease?e=bC:e=P_}if(t.length===1&&t[0].semver===Sd){if(r.includePrerelease)return!0;t=P_}const i=new Set;let a,s;for(const A of e)A.operator===">"||A.operator===">="?a=L_(a,A,r):A.operator==="<"||A.operator==="<="?s=N_(s,A,r):i.add(A.semver);if(i.size>1)return null;let f;if(a&&s){if(f=Rp(a.semver,s.semver,r),f>0)return null;if(f===0&&(a.operator!==">="||s.operator!=="<="))return null}for(const A of i){if(a&&!ns(A,String(a),r)||s&&!ns(A,String(s),r))return null;for(const N of t)if(!ns(A,String(N),r))return!1;return!0}let c,l,d,h,b=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,R=a&&!r.includePrerelease&&a.semver.prerelease.length?a.semver:!1;b&&b.prerelease.length===1&&s.operator==="<"&&b.prerelease[0]===0&&(b=!1);for(const A of t){if(h=h||A.operator===">"||A.operator===">=",d=d||A.operator==="<"||A.operator==="<=",a){if(R&&A.semver.prerelease&&A.semver.prerelease.length&&A.semver.major===R.major&&A.semver.minor===R.minor&&A.semver.patch===R.patch&&(R=!1),A.operator===">"||A.operator===">="){if(c=L_(a,A,r),c===A&&c!==a)return!1}else if(a.operator===">="&&!ns(a.semver,String(A),r))return!1}if(s){if(b&&A.semver.prerelease&&A.semver.prerelease.length&&A.semver.major===b.major&&A.semver.minor===b.minor&&A.semver.patch===b.patch&&(b=!1),A.operator==="<"||A.operator==="<="){if(l=N_(s,A,r),l===A&&l!==s)return!1}else if(s.operator==="<="&&!ns(s.semver,String(A),r))return!1}if(!A.operator&&(s||a)&&f!==0)return!1}return!(a&&d&&!s&&f!==0||s&&h&&!a&&f!==0||R||b)},L_=(e,t,r)=>{if(!e)return t;const i=Rp(e.semver,t.semver,r);return i>0?e:i<0||t.operator===">"&&e.operator===">="?t:e},N_=(e,t,r)=>{if(!e)return t;const i=Rp(e.semver,t.semver,r);return i<0?e:i>0||t.operator==="<"&&e.operator==="<="?t:e};var wC=_C;const Rd=Ls,C_=ku,mC=Pr,B_=dw,EC=Oa,SC=EL,RC=AL,AC=OL,TC=PL,OC=CL,IC=$L,PC=jL,LC=kL,NC=Nn,CC=zL,BC=ZL,xC=bp,$C=YL,MC=tN,DC=Hu,jC=vp,FC=hw,UC=pw,kC=wp,qC=mp,HC=gw,WC=RN,zC=Wu(),GC=Cn(),VC=zu,ZC=jN,KC=qN,JC=GN,XC=KN,YC=YN,QC=Ep,eB=fC,tB=cC,rB=hC,nB=yC,iB=wC;var oB={parse:EC,valid:SC,clean:RC,inc:AC,diff:TC,major:OC,minor:IC,patch:PC,prerelease:LC,compare:NC,rcompare:CC,compareLoose:BC,compareBuild:xC,sort:$C,rsort:MC,gt:DC,lt:jC,eq:FC,neq:UC,gte:kC,lte:qC,cmp:HC,coerce:WC,Comparator:zC,Range:GC,satisfies:VC,toComparators:ZC,maxSatisfying:KC,minSatisfying:JC,minVersion:XC,validRange:YC,outside:QC,gtr:eB,ltr:tB,intersects:rB,simplifyRange:nB,subset:iB,SemVer:mC,re:Rd.re,src:Rd.src,tokens:Rd.t,SEMVER_SPEC_VERSION:C_.SEMVER_SPEC_VERSION,RELEASE_TYPES:C_.RELEASE_TYPES,compareIdentifiers:B_.compareIdentifiers,rcompareIdentifiers:B_.rcompareIdentifiers};function x_(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ih={exports:{}},Ad=65536,aB=4294967295;function sB(){throw new Error(`Secure random number generation is not supported by this browser. -Use Chrome, Firefox or Internet Explorer 11`)}var fB=Rv.Buffer,vu=Qe.crypto||Qe.msCrypto;vu&&vu.getRandomValues?Ih.exports=uB:Ih.exports=sB;function uB(e,t){if(e>aB)throw new RangeError("requested too many random bytes");var r=fB.allocUnsafe(e);if(e>0)if(e>Ad)for(var i=0;i{f=d,c=h}),resolve:f,reject:c}},promisify(f){return new Promise((c,l)=>{f((d,...h)=>d?l(d):c(...h))})},debuglog(){return function(){}},format(f,...c){return f.replace(/%([sdifj])/g,function(...[l,d]){const h=c.shift();return d==="f"?h.toFixed(6):d==="j"?JSON.stringify(h):d==="s"&&typeof h=="object"?`${h.constructor!==Object?h.constructor.name:""} {}`.trim():h.toString()})},inspect(f){switch(typeof f){case"string":if(f.includes("'"))if(f.includes('"')){if(!f.includes("`")&&!f.includes("${"))return`\`${f}\``}else return`"${f}"`;return`'${f}'`;case"number":return isNaN(f)?"NaN":Object.is(f,-0)?String(f):f;case"bigint":return`${String(f)}n`;case"boolean":case"undefined":return String(f);case"object":return"{}"}},types:{isAsyncFunction(f){return f instanceof r},isArrayBufferView(f){return ArrayBuffer.isView(f)}},isBlob:a},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(bw);var mi=bw.exports,Ap={},is={exports:{}},$_;function Tp(){if($_)return is.exports;$_=1;const{AbortController:e,AbortSignal:t}=typeof self<"u"?self:typeof window<"u"?window:void 0;return is.exports=e,is.exports.AbortSignal=t,is.exports.default=e,is.exports}const{format:gB,inspect:wu,AggregateError:yB}=mi,_B=globalThis.AggregateError||yB,bB=Symbol("kIsNodeError"),vB=["string","function","number","object","Function","Object","boolean","bigint","symbol"],wB=/^([A-Z][a-z0-9]*)+$/,mB="__node_internal_",Gu={};function vo(e,t){if(!e)throw new Gu.ERR_INTERNAL_ASSERTION(t)}function M_(e){let t="",r=e.length;const i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function EB(e,t,r){if(typeof t=="function")return vo(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return vo(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:gB(t,...r)}function br(e,t,r){r||(r=Error);class i extends r{constructor(...s){super(EB(e,t,s))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[bB]=!0,Gu[e]=i}function D_(e){const t=mB+e.name;return Object.defineProperty(e,"name",{value:t}),e}function SB(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new _B([t,e],t.message);return r.code=t.code,r}return e||t}let RB=class extends Error{constructor(t="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Gu.ERR_INVALID_ARG_TYPE("options","Object",r);super(t,r),this.code="ABORT_ERR",this.name="AbortError"}};br("ERR_ASSERTION","%s",Error);br("ERR_INVALID_ARG_TYPE",(e,t,r)=>{vo(typeof e=="string","'name' must be a string"),Array.isArray(t)||(t=[t]);let i="The ";e.endsWith(" argument")?i+=`${e} `:i+=`"${e}" ${e.includes(".")?"property":"argument"} `,i+="must be ";const a=[],s=[],f=[];for(const l of t)vo(typeof l=="string","All expected entries have to be of type string"),vB.includes(l)?a.push(l.toLowerCase()):wB.test(l)?s.push(l):(vo(l!=="object",'The value "object" should be written as "Object"'),f.push(l));if(s.length>0){const l=a.indexOf("object");l!==-1&&(a.splice(a,l,1),s.push("Object"))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{const l=a.pop();i+=`one of type ${a.join(", ")}, or ${l}`}}(s.length>0||f.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{const l=s.pop();i+=`an instance of ${s.join(", ")}, or ${l}`}}f.length>0&&(i+=" or ")}switch(f.length){case 0:break;case 1:f[0].toLowerCase()!==f[0]&&(i+="an "),i+=`${f[0]}`;break;case 2:i+=`one of ${f[0]} or ${f[1]}`;break;default:{const l=f.pop();i+=`one of ${f.join(", ")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var c;if((c=r.constructor)!==null&&c!==void 0&&c.name)i+=`. Received an instance of ${r.constructor.name}`;else{const l=wu(r,{depth:-1});i+=`. Received ${l}`}}else{let l=wu(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);br("ERR_INVALID_ARG_VALUE",(e,t,r="is invalid")=>{let i=wu(t);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${i}`},TypeError);br("ERR_INVALID_RETURN_VALUE",(e,t,r)=>{var i;const a=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${e} to be returned from the "${t}" function but got ${a}.`},TypeError);br("ERR_MISSING_ARGS",(...e)=>{vo(e.length>0,"At least one arg needs to be specified");let t;const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map(i=>`"${i}"`).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const i=e.pop();t+=`The ${e.join(", ")}, and ${i} arguments`}break}return`${t} must be specified`},TypeError);br("ERR_OUT_OF_RANGE",(e,t,r)=>{vo(t,'Missing "range" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=M_(String(r)):typeof r=="bigint"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=M_(i)),i+="n"):i=wu(r),`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError);br("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);br("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);br("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);br("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);br("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);br("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);br("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);br("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);br("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);br("ERR_STREAM_WRITE_AFTER_END","write after end",Error);br("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var Dr={AbortError:RB,aggregateTwoErrors:D_(SB),hideStackFrames:D_,codes:Gu};const{ArrayIsArray:Op,ArrayPrototypeIncludes:vw,ArrayPrototypeJoin:ww,ArrayPrototypeMap:AB,NumberIsInteger:Ip,NumberIsNaN:TB,NumberMAX_SAFE_INTEGER:OB,NumberMIN_SAFE_INTEGER:IB,NumberParseInt:PB,ObjectPrototypeHasOwnProperty:LB,RegExpPrototypeExec:mw,String:NB,StringPrototypeToUpperCase:CB,StringPrototypeTrim:BB}=or,{hideStackFrames:bn,codes:{ERR_SOCKET_BAD_PORT:xB,ERR_INVALID_ARG_TYPE:Lr,ERR_INVALID_ARG_VALUE:Ia,ERR_OUT_OF_RANGE:Eo,ERR_UNKNOWN_SIGNAL:j_}}=Dr,{normalizeEncoding:$B}=mi,{isAsyncFunction:MB,isArrayBufferView:DB}=mi.types,F_={};function jB(e){return e===(e|0)}function FB(e){return e===e>>>0}const UB=/^[0-7]+$/,kB="must be a 32-bit unsigned integer or an octal string";function qB(e,t,r){if(typeof e>"u"&&(e=r),typeof e=="string"){if(mw(UB,e)===null)throw new Ia(t,e,kB);e=PB(e,8)}return Ew(e,t),e}const HB=bn((e,t,r=IB,i=OB)=>{if(typeof e!="number")throw new Lr(t,"number",e);if(!Ip(e))throw new Eo(t,"an integer",e);if(ei)throw new Eo(t,`>= ${r} && <= ${i}`,e)}),WB=bn((e,t,r=-2147483648,i=2147483647)=>{if(typeof e!="number")throw new Lr(t,"number",e);if(!Ip(e))throw new Eo(t,"an integer",e);if(ei)throw new Eo(t,`>= ${r} && <= ${i}`,e)}),Ew=bn((e,t,r=!1)=>{if(typeof e!="number")throw new Lr(t,"number",e);if(!Ip(e))throw new Eo(t,"an integer",e);const i=r?1:0,a=4294967295;if(ea)throw new Eo(t,`>= ${i} && <= ${a}`,e)});function Pp(e,t){if(typeof e!="string")throw new Lr(t,"string",e)}function zB(e,t,r=void 0,i){if(typeof e!="number")throw new Lr(t,"number",e);if(r!=null&&ei||(r!=null||i!=null)&&TB(e))throw new Eo(t,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,e)}const GB=bn((e,t,r)=>{if(!vw(r,e)){const a="must be one of: "+ww(AB(r,s=>typeof s=="string"?`'${s}'`:NB(s)),", ");throw new Ia(t,e,a)}});function Sw(e,t){if(typeof e!="boolean")throw new Lr(t,"boolean",e)}function Od(e,t,r){return e==null||!LB(e,t)?r:e[t]}const VB=bn((e,t,r=null)=>{const i=Od(r,"allowArray",!1),a=Od(r,"allowFunction",!1);if(!Od(r,"nullable",!1)&&e===null||!i&&Op(e)||typeof e!="object"&&(!a||typeof e!="function"))throw new Lr(t,"Object",e)}),ZB=bn((e,t)=>{if(e!=null&&typeof e!="object"&&typeof e!="function")throw new Lr(t,"a dictionary",e)}),Lp=bn((e,t,r=0)=>{if(!Op(e))throw new Lr(t,"Array",e);if(e.length{if(!DB(e))throw new Lr(t,["Buffer","TypedArray","DataView"],e)});function QB(e,t){const r=$B(t),i=e.length;if(r==="hex"&&i%2!==0)throw new Ia("encoding",t,`is invalid for data of length ${i}`)}function ex(e,t="Port",r=!0){if(typeof e!="number"&&typeof e!="string"||typeof e=="string"&&BB(e).length===0||+e!==+e>>>0||e>65535||e===0&&!r)throw new xB(t,e,r);return e|0}const tx=bn((e,t)=>{if(e!==void 0&&(e===null||typeof e!="object"||!("aborted"in e)))throw new Lr(t,"AbortSignal",e)}),rx=bn((e,t)=>{if(typeof e!="function")throw new Lr(t,"Function",e)}),nx=bn((e,t)=>{if(typeof e!="function"||MB(e))throw new Lr(t,"Function",e)}),ix=bn((e,t)=>{if(e!==void 0)throw new Lr(t,"undefined",e)});function ox(e,t,r){if(!vw(r,e))throw new Lr(t,`('${ww(r,"|")}')`,e)}const ax=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function U_(e,t){if(typeof e>"u"||!mw(ax,e))throw new Ia(t,e,'must be an array or string of format "; rel=preload; as=style"')}function sx(e){if(typeof e=="string")return U_(e,"hints"),e;if(Op(e)){const t=e.length;let r="";if(t===0)return r;for(let i=0;i; rel=preload; as=style"')}var Vu={isInt32:jB,isUint32:FB,parseFileMode:qB,validateArray:Lp,validateStringArray:KB,validateBooleanArray:JB,validateBoolean:Sw,validateBuffer:YB,validateDictionary:ZB,validateEncoding:QB,validateFunction:rx,validateInt32:WB,validateInteger:HB,validateNumber:zB,validateObject:VB,validateOneOf:GB,validatePlainFunction:nx,validatePort:ex,validateSignalName:XB,validateString:Pp,validateUint32:Ew,validateUndefined:ix,validateUnion:ox,validateAbortSignal:tx,validateLinkHeaderValue:sx},Np={exports:{}};const{Symbol:Zu,SymbolAsyncIterator:k_,SymbolIterator:q_,SymbolFor:Rw}=or,Aw=Zu("kDestroyed"),Tw=Zu("kIsErrored"),Ph=Zu("kIsReadable"),Ow=Zu("kIsDisturbed"),fx=Rw("nodejs.webstream.isClosedPromise"),ux=Rw("nodejs.webstream.controllerErrorFunction");function Ku(e,t=!1){var r;return!!(e&&typeof e.pipe=="function"&&typeof e.on=="function"&&(!t||typeof e.pause=="function"&&typeof e.resume=="function")&&(!e._writableState||((r=e._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!e._writableState||e._readableState))}function Ju(e){var t;return!!(e&&typeof e.write=="function"&&typeof e.on=="function"&&(!e._readableState||((t=e._writableState)===null||t===void 0?void 0:t.writable)!==!1))}function lx(e){return!!(e&&typeof e.pipe=="function"&&e._readableState&&typeof e.on=="function"&&typeof e.write=="function")}function Jn(e){return e&&(e._readableState||e._writableState||typeof e.write=="function"&&typeof e.on=="function"||typeof e.pipe=="function"&&typeof e.on=="function")}function Iw(e){return!!(e&&!Jn(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"&&typeof e.cancel=="function")}function Pw(e){return!!(e&&!Jn(e)&&typeof e.getWriter=="function"&&typeof e.abort=="function")}function Lw(e){return!!(e&&!Jn(e)&&typeof e.readable=="object"&&typeof e.writable=="object")}function cx(e){return Iw(e)||Pw(e)||Lw(e)}function dx(e,t){return e==null?!1:t===!0?typeof e[k_]=="function":t===!1?typeof e[q_]=="function":typeof e[k_]=="function"||typeof e[q_]=="function"}function Xu(e){if(!Jn(e))return null;const t=e._writableState,r=e._readableState,i=t||r;return!!(e.destroyed||e[Aw]||i!=null&&i.destroyed)}function Nw(e){if(!Ju(e))return null;if(e.writableEnded===!0)return!0;const t=e._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.ended)!="boolean"?null:t.ended}function hx(e,t){if(!Ju(e))return null;if(e.writableFinished===!0)return!0;const r=e._writableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.finished)!="boolean"?null:!!(r.finished||t===!1&&r.ended===!0&&r.length===0)}function px(e){if(!Ku(e))return null;if(e.readableEnded===!0)return!0;const t=e._readableState;return!t||t.errored?!1:typeof(t==null?void 0:t.ended)!="boolean"?null:t.ended}function Cw(e,t){if(!Ku(e))return null;const r=e._readableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.endEmitted)!="boolean"?null:!!(r.endEmitted||t===!1&&r.ended===!0&&r.length===0)}function Bw(e){return e&&e[Ph]!=null?e[Ph]:typeof(e==null?void 0:e.readable)!="boolean"?null:Xu(e)?!1:Ku(e)&&e.readable&&!Cw(e)}function xw(e){return typeof(e==null?void 0:e.writable)!="boolean"?null:Xu(e)?!1:Ju(e)&&e.writable&&!Nw(e)}function gx(e,t){return Jn(e)?Xu(e)?!0:!((t==null?void 0:t.readable)!==!1&&Bw(e)||(t==null?void 0:t.writable)!==!1&&xw(e)):null}function yx(e){var t,r;return Jn(e)?e.writableErrored?e.writableErrored:(t=(r=e._writableState)===null||r===void 0?void 0:r.errored)!==null&&t!==void 0?t:null:null}function _x(e){var t,r;return Jn(e)?e.readableErrored?e.readableErrored:(t=(r=e._readableState)===null||r===void 0?void 0:r.errored)!==null&&t!==void 0?t:null:null}function bx(e){if(!Jn(e))return null;if(typeof e.closed=="boolean")return e.closed;const t=e._writableState,r=e._readableState;return typeof(t==null?void 0:t.closed)=="boolean"||typeof(r==null?void 0:r.closed)=="boolean"?(t==null?void 0:t.closed)||(r==null?void 0:r.closed):typeof e._closed=="boolean"&&$w(e)?e._closed:null}function $w(e){return typeof e._closed=="boolean"&&typeof e._defaultKeepAlive=="boolean"&&typeof e._removedConnection=="boolean"&&typeof e._removedContLen=="boolean"}function Mw(e){return typeof e._sent100=="boolean"&&$w(e)}function vx(e){var t;return typeof e._consuming=="boolean"&&typeof e._dumped=="boolean"&&((t=e.req)===null||t===void 0?void 0:t.upgradeOrConnect)===void 0}function wx(e){if(!Jn(e))return null;const t=e._writableState,r=e._readableState,i=t||r;return!i&&Mw(e)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function mx(e){var t;return!!(e&&((t=e[Ow])!==null&&t!==void 0?t:e.readableDidRead||e.readableAborted))}function Ex(e){var t,r,i,a,s,f,c,l,d,h;return!!(e&&((t=(r=(i=(a=(s=(f=e[Tw])!==null&&f!==void 0?f:e.readableErrored)!==null&&s!==void 0?s:e.writableErrored)!==null&&a!==void 0?a:(c=e._readableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&i!==void 0?i:(l=e._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(d=e._readableState)===null||d===void 0?void 0:d.errored)!==null&&t!==void 0?t:!((h=e._writableState)===null||h===void 0)&&h.errored))}var Ei={kDestroyed:Aw,isDisturbed:mx,kIsDisturbed:Ow,isErrored:Ex,kIsErrored:Tw,isReadable:Bw,kIsReadable:Ph,kIsClosedPromise:fx,kControllerErrorFunction:ux,isClosed:bx,isDestroyed:Xu,isDuplexNodeStream:lx,isFinished:gx,isIterable:dx,isReadableNodeStream:Ku,isReadableStream:Iw,isReadableEnded:px,isReadableFinished:Cw,isReadableErrored:_x,isNodeStream:Jn,isWebStream:cx,isWritable:xw,isWritableNodeStream:Ju,isWritableStream:Pw,isWritableEnded:Nw,isWritableFinished:hx,isWritableErrored:yx,isServerRequest:vx,isServerResponse:Mw,willEmitClose:wx,isTransformStream:Lw};const Di=To,{AbortError:Dw,codes:Sx}=Dr,{ERR_INVALID_ARG_TYPE:Rx,ERR_STREAM_PREMATURE_CLOSE:H_}=Sx,{kEmptyObject:Lh,once:Nh}=mi,{validateAbortSignal:Ax,validateFunction:Tx,validateObject:Ox,validateBoolean:Ix}=Vu,{Promise:Px,PromisePrototypeThen:Lx}=or,{isClosed:Nx,isReadable:W_,isReadableNodeStream:Id,isReadableStream:Cx,isReadableFinished:z_,isReadableErrored:G_,isWritable:V_,isWritableNodeStream:Z_,isWritableStream:Bx,isWritableFinished:K_,isWritableErrored:J_,isNodeStream:xx,willEmitClose:$x,kIsClosedPromise:Mx}=Ei;function Dx(e){return e.setHeader&&typeof e.abort=="function"}const Ch=()=>{};function jw(e,t,r){var i,a;if(arguments.length===2?(r=t,t=Lh):t==null?t=Lh:Ox(t,"options"),Tx(r,"callback"),Ax(t.signal,"options.signal"),r=Nh(r),Cx(e)||Bx(e))return jx(e,t,r);if(!xx(e))throw new Rx("stream",["ReadableStream","WritableStream","Stream"],e);const s=(i=t.readable)!==null&&i!==void 0?i:Id(e),f=(a=t.writable)!==null&&a!==void 0?a:Z_(e),c=e._writableState,l=e._readableState,d=()=>{e.writable||R()};let h=$x(e)&&Id(e)===s&&Z_(e)===f,b=K_(e,!1);const R=()=>{b=!0,e.destroyed&&(h=!1),!(h&&(!e.readable||s))&&(!s||A)&&r.call(e)};let A=z_(e,!1);const N=()=>{A=!0,e.destroyed&&(h=!1),!(h&&(!e.writable||f))&&(!f||b)&&r.call(e)},ae=z=>{r.call(e,z)};let K=Nx(e);const I=()=>{K=!0;const z=J_(e)||G_(e);if(z&&typeof z!="boolean")return r.call(e,z);if(s&&!A&&Id(e,!0)&&!z_(e,!1))return r.call(e,new H_);if(f&&!b&&!K_(e,!1))return r.call(e,new H_);r.call(e)},y=()=>{K=!0;const z=J_(e)||G_(e);if(z&&typeof z!="boolean")return r.call(e,z);r.call(e)},ie=()=>{e.req.on("finish",R)};Dx(e)?(e.on("complete",R),h||e.on("abort",I),e.req?ie():e.on("request",ie)):f&&!c&&(e.on("end",d),e.on("close",d)),!h&&typeof e.aborted=="boolean"&&e.on("aborted",I),e.on("end",N),e.on("finish",R),t.error!==!1&&e.on("error",ae),e.on("close",I),K?Di.nextTick(I):c!=null&&c.errorEmitted||l!=null&&l.errorEmitted?h||Di.nextTick(y):(!s&&(!h||W_(e))&&(b||V_(e)===!1)||!f&&(!h||V_(e))&&(A||W_(e)===!1)||l&&e.req&&e.aborted)&&Di.nextTick(y);const F=()=>{r=Ch,e.removeListener("aborted",I),e.removeListener("complete",R),e.removeListener("abort",I),e.removeListener("request",ie),e.req&&e.req.removeListener("finish",R),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",R),e.removeListener("end",N),e.removeListener("error",ae),e.removeListener("close",I)};if(t.signal&&!K){const z=()=>{const q=r;F(),q.call(e,new Dw(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)Di.nextTick(z);else{const q=r;r=Nh((...ne)=>{t.signal.removeEventListener("abort",z),q.apply(e,ne)}),t.signal.addEventListener("abort",z)}}return F}function jx(e,t,r){let i=!1,a=Ch;if(t.signal)if(a=()=>{i=!0,r.call(e,new Dw(void 0,{cause:t.signal.reason}))},t.signal.aborted)Di.nextTick(a);else{const f=r;r=Nh((...c)=>{t.signal.removeEventListener("abort",a),f.apply(e,c)}),t.signal.addEventListener("abort",a)}const s=(...f)=>{i||Di.nextTick(()=>r.apply(e,f))};return Lx(e[Mx].promise,s,s),Ch}function Fx(e,t){var r;let i=!1;return t===null&&(t=Lh),(r=t)!==null&&r!==void 0&&r.cleanup&&(Ix(t.cleanup,"cleanup"),i=t.cleanup),new Px((a,s)=>{const f=jw(e,t,c=>{i&&f(),c?s(c):a()})})}Np.exports=jw;Np.exports.finished=Fx;var zi=Np.exports;const Gn=To,{aggregateTwoErrors:Ux,codes:{ERR_MULTIPLE_CALLBACK:kx},AbortError:qx}=Dr,{Symbol:Fw}=or,{kDestroyed:Hx,isDestroyed:Wx,isFinished:zx,isServerRequest:Gx}=Ei,Uw=Fw("kDestroy"),Bh=Fw("kConstruct");function kw(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function Vx(e,t){const r=this._readableState,i=this._writableState,a=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof t=="function"&&t(),this):(kw(e,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),a.constructed?X_(this,e,t):this.once(Uw,function(s){X_(this,Ux(s,e),t)}),this)}function X_(e,t,r){let i=!1;function a(s){if(i)return;i=!0;const f=e._readableState,c=e._writableState;kw(s,c,f),c&&(c.closed=!0),f&&(f.closed=!0),typeof r=="function"&&r(s),s?Gn.nextTick(Zx,e,s):Gn.nextTick(qw,e)}try{e._destroy(t||null,a)}catch(s){a(s)}}function Zx(e,t){xh(e,t),qw(e)}function qw(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(r!=null&&r.emitClose||t!=null&&t.emitClose)&&e.emit("close")}function xh(e,t){const r=e._readableState,i=e._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function Kx(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function $h(e,t,r){const i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?Gn.nextTick(xh,e,t):xh(e,t))}function Jx(e,t){if(typeof e._construct!="function")return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(Bh,t),!(e.listenerCount(Bh)>1)&&Gn.nextTick(Xx,e)}function Xx(e){let t=!1;function r(i){if(t){$h(e,i??new kx);return}t=!0;const a=e._readableState,s=e._writableState,f=s||a;a&&(a.constructed=!0),s&&(s.constructed=!0),f.destroyed?e.emit(Uw,i):i?$h(e,i,!0):Gn.nextTick(Yx,e)}try{e._construct(i=>{Gn.nextTick(r,i)})}catch(i){Gn.nextTick(r,i)}}function Yx(e){e.emit(Bh)}function Y_(e){return(e==null?void 0:e.setHeader)&&typeof e.abort=="function"}function Hw(e){e.emit("close")}function Qx(e,t){e.emit("error",t),Gn.nextTick(Hw,e)}function e$(e,t){!e||Wx(e)||(!t&&!zx(e)&&(t=new qx),Gx(e)?(e.socket=null,e.destroy(t)):Y_(e)?e.abort():Y_(e.req)?e.req.abort():typeof e.destroy=="function"?e.destroy(t):typeof e.close=="function"?e.close():t?Gn.nextTick(Qx,e,t):Gn.nextTick(Hw,e),e.destroyed||(e[Hx]=!0))}var Pa={construct:Jx,destroyer:e$,destroy:Vx,undestroy:Kx,errorOrDestroy:$h};const{ArrayIsArray:t$,ObjectSetPrototypeOf:Ww}=or,{EventEmitter:Yu}=Wi;function Qu(e){Yu.call(this,e)}Ww(Qu.prototype,Yu.prototype);Ww(Qu,Yu);Qu.prototype.pipe=function(e,t){const r=this;function i(h){e.writable&&e.write(h)===!1&&r.pause&&r.pause()}r.on("data",i);function a(){r.readable&&r.resume&&r.resume()}e.on("drain",a),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",f),r.on("close",c));let s=!1;function f(){s||(s=!0,e.end())}function c(){s||(s=!0,typeof e.destroy=="function"&&e.destroy())}function l(h){d(),Yu.listenerCount(this,"error")===0&&this.emit("error",h)}Mh(r,"error",l),Mh(e,"error",l);function d(){r.removeListener("data",i),e.removeListener("drain",a),r.removeListener("end",f),r.removeListener("close",c),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d)}return r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e};function Mh(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):t$(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}var Cp={Stream:Qu,prependListener:Mh},zw={exports:{}};(function(e){const{AbortError:t,codes:r}=Dr,{isNodeStream:i,isWebStream:a,kControllerErrorFunction:s}=Ei,f=zi,{ERR_INVALID_ARG_TYPE:c}=r,l=(d,h)=>{if(typeof d!="object"||!("aborted"in d))throw new c(h,"AbortSignal",d)};e.exports.addAbortSignal=function(h,b){if(l(h,"signal"),!i(b)&&!a(b))throw new c("stream",["ReadableStream","WritableStream","Stream"],b);return e.exports.addAbortSignalNoValidate(h,b)},e.exports.addAbortSignalNoValidate=function(d,h){if(typeof d!="object"||!("aborted"in d))return h;const b=i(h)?()=>{h.destroy(new t(void 0,{cause:d.reason}))}:()=>{h[s](new t(void 0,{cause:d.reason}))};return d.aborted?b():(d.addEventListener("abort",b),f(h,()=>d.removeEventListener("abort",b))),h}})(zw);var el=zw.exports;const{StringPrototypeSlice:Q_,SymbolIterator:r$,TypedArrayPrototypeSet:Kf,Uint8Array:n$}=or,{Buffer:Pd}=Vr,{inspect:i$}=mi;var o$=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){const r={data:t,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(t){const r={data:t,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;const t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=t+r.data;return i}concat(t){if(this.length===0)return Pd.alloc(0);const r=Pd.allocUnsafe(t>>>0);let i=this.head,a=0;for(;i;)Kf(r,i.data,a),a+=i.data.length,i=i.next;return r}consume(t,r){const i=this.head.data;if(ts.length)r+=s,t-=s.length;else{t===s.length?(r+=s,++a,i.next?this.head=i.next:this.head=this.tail=null):(r+=Q_(s,0,t),this.head=i,i.data=Q_(s,t));break}++a}while((i=i.next)!==null);return this.length-=a,r}_getBuffer(t){const r=Pd.allocUnsafe(t),i=t;let a=this.head,s=0;do{const f=a.data;if(t>f.length)Kf(r,f,i-t),t-=f.length;else{t===f.length?(Kf(r,f,i-t),++s,a.next?this.head=a.next:this.head=this.tail=null):(Kf(r,new n$(f.buffer,f.byteOffset,t),i-t),this.head=a,a.data=f.slice(t));break}++s}while((a=a.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](t,r){return i$(this,{...r,depth:0,customInspect:!1})}};const{MathFloor:a$,NumberIsInteger:s$}=or,{ERR_INVALID_ARG_VALUE:f$}=Dr.codes;function u$(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function Gw(e){return e?16:16*1024}function l$(e,t,r,i){const a=u$(t,i,r);if(a!=null){if(!s$(a)||a<0){const s=i?`options.${r}`:"options.highWaterMark";throw new f$(s,a)}return a$(a)}return Gw(e.objectMode)}var Bp={getHighWaterMark:l$,getDefaultHighWaterMark:Gw};const eb=To,{PromisePrototypeThen:c$,SymbolAsyncIterator:tb,SymbolIterator:rb}=or,{Buffer:d$}=Vr,{ERR_INVALID_ARG_TYPE:h$,ERR_STREAM_NULL_VALUES:p$}=Dr.codes;function g$(e,t,r){let i;if(typeof t=="string"||t instanceof d$)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});let a;if(t&&t[tb])a=!0,i=t[tb]();else if(t&&t[rb])a=!1,i=t[rb]();else throw new h$("iterable",["Iterable"],t);const s=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;s._read=function(){f||(f=!0,l())},s._destroy=function(d,h){c$(c(d),()=>eb.nextTick(h,d),b=>eb.nextTick(h,b||d))};async function c(d){const h=d!=null,b=typeof i.throw=="function";if(h&&b){const{value:R,done:A}=await i.throw(d);if(await R,A)return}if(typeof i.return=="function"){const{value:R}=await i.return();await R}}async function l(){for(;;){try{const{value:d,done:h}=a?await i.next():i.next();if(h)s.push(null);else{const b=d&&typeof d.then=="function"?await d:d;if(b===null)throw f=!1,new p$;if(s.push(b))continue;f=!1}}catch(d){s.destroy(d)}break}}return s}var Vw=g$,Ld,nb;function tl(){if(nb)return Ld;nb=1;const e=To,{ArrayPrototypeIndexOf:t,NumberIsInteger:r,NumberIsNaN:i,NumberParseInt:a,ObjectDefineProperties:s,ObjectKeys:f,ObjectSetPrototypeOf:c,Promise:l,SafeSet:d,SymbolAsyncIterator:h,Symbol:b}=or;Ld=T,T.ReadableState=P;const{EventEmitter:R}=Wi,{Stream:A,prependListener:N}=Cp,{Buffer:ae}=Vr,{addAbortSignal:K}=el,I=zi;let y=mi.debuglog("stream",O=>{y=O});const ie=o$,F=Pa,{getHighWaterMark:z,getDefaultHighWaterMark:q}=Bp,{aggregateTwoErrors:ne,codes:{ERR_INVALID_ARG_TYPE:v,ERR_METHOD_NOT_IMPLEMENTED:w,ERR_OUT_OF_RANGE:E,ERR_STREAM_PUSH_AFTER_EOF:J,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:_}}=Dr,{validateObject:m}=Vu,S=b("kPaused"),{StringDecoder:L}=Th(),H=Vw;c(T.prototype,A.prototype),c(T,A);const M=()=>{},{errorOrDestroy:W}=F;function P(O,Y,Ee){typeof Ee!="boolean"&&(Ee=Y instanceof yi()),this.objectMode=!!(O&&O.objectMode),Ee&&(this.objectMode=this.objectMode||!!(O&&O.readableObjectMode)),this.highWaterMark=O?z(this,O,"readableHighWaterMark",Ee):q(!1),this.buffer=new ie,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[S]=null,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,O&&O.encoding&&(this.decoder=new L(O.encoding),this.encoding=O.encoding)}function T(O){if(!(this instanceof T))return new T(O);const Y=this instanceof yi();this._readableState=new P(O,this,Y),O&&(typeof O.read=="function"&&(this._read=O.read),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&!Y&&K(O.signal,this)),A.call(this,O),F.construct(this,()=>{this._readableState.needReadable&&te(this,this._readableState)})}T.prototype.destroy=F.destroy,T.prototype._undestroy=F.undestroy,T.prototype._destroy=function(O,Y){Y(O)},T.prototype[R.captureRejectionSymbol]=function(O){this.destroy(O)},T.prototype.push=function(O,Y){return re(this,O,Y,!1)},T.prototype.unshift=function(O,Y){return re(this,O,Y,!0)};function re(O,Y,Ee,ve){y("readableAddChunk",Y);const $e=O._readableState;let qe;if($e.objectMode||(typeof Y=="string"?(Ee=Ee||$e.defaultEncoding,$e.encoding!==Ee&&(ve&&$e.encoding?Y=ae.from(Y,Ee).toString($e.encoding):(Y=ae.from(Y,Ee),Ee=""))):Y instanceof ae?Ee="":A._isUint8Array(Y)?(Y=A._uint8ArrayToBuffer(Y),Ee=""):Y!=null&&(qe=new v("chunk",["string","Buffer","Uint8Array"],Y))),qe)W(O,qe);else if(Y===null)$e.reading=!1,X(O,$e);else if($e.objectMode||Y&&Y.length>0)if(ve)if($e.endEmitted)W(O,new _);else{if($e.destroyed||$e.errored)return!1;j(O,$e,Y,!0)}else if($e.ended)W(O,new J);else{if($e.destroyed||$e.errored)return!1;$e.reading=!1,$e.decoder&&!Ee?(Y=$e.decoder.write(Y),$e.objectMode||Y.length!==0?j(O,$e,Y,!1):te(O,$e)):j(O,$e,Y,!1)}else ve||($e.reading=!1,te(O,$e));return!$e.ended&&($e.length<$e.highWaterMark||$e.length===0)}function j(O,Y,Ee,ve){Y.flowing&&Y.length===0&&!Y.sync&&O.listenerCount("data")>0?(Y.multiAwaitDrain?Y.awaitDrainWriters.clear():Y.awaitDrainWriters=null,Y.dataEmitted=!0,O.emit("data",Ee)):(Y.length+=Y.objectMode?1:Ee.length,ve?Y.buffer.unshift(Ee):Y.buffer.push(Ee),Y.needReadable&&D(O)),te(O,Y)}T.prototype.isPaused=function(){const O=this._readableState;return O[S]===!0||O.flowing===!1},T.prototype.setEncoding=function(O){const Y=new L(O);this._readableState.decoder=Y,this._readableState.encoding=this._readableState.decoder.encoding;const Ee=this._readableState.buffer;let ve="";for(const $e of Ee)ve+=Y.write($e);return Ee.clear(),ve!==""&&Ee.push(ve),this._readableState.length=ve.length,this};const Q=1073741824;function se(O){if(O>Q)throw new E("size","<= 1GiB",O);return O--,O|=O>>>1,O|=O>>>2,O|=O>>>4,O|=O>>>8,O|=O>>>16,O++,O}function de(O,Y){return O<=0||Y.length===0&&Y.ended?0:Y.objectMode?1:i(O)?Y.flowing&&Y.length?Y.buffer.first().length:Y.length:O<=Y.length?O:Y.ended?Y.length:0}T.prototype.read=function(O){y("read",O),O===void 0?O=NaN:r(O)||(O=a(O,10));const Y=this._readableState,Ee=O;if(O>Y.highWaterMark&&(Y.highWaterMark=se(O)),O!==0&&(Y.emittedReadable=!1),O===0&&Y.needReadable&&((Y.highWaterMark!==0?Y.length>=Y.highWaterMark:Y.length>0)||Y.ended))return y("read: emitReadable",Y.length,Y.ended),Y.length===0&&Y.ended?Ye(this):D(this),null;if(O=de(O,Y),O===0&&Y.ended)return Y.length===0&&Ye(this),null;let ve=Y.needReadable;if(y("need readable",ve),(Y.length===0||Y.length-O0?$e=me(O,Y):$e=null,$e===null?(Y.needReadable=Y.length<=Y.highWaterMark,O=0):(Y.length-=O,Y.multiAwaitDrain?Y.awaitDrainWriters.clear():Y.awaitDrainWriters=null),Y.length===0&&(Y.ended||(Y.needReadable=!0),Ee!==O&&Y.ended&&Ye(this)),$e!==null&&!Y.errorEmitted&&!Y.closeEmitted&&(Y.dataEmitted=!0,this.emit("data",$e)),$e};function X(O,Y){if(y("onEofChunk"),!Y.ended){if(Y.decoder){const Ee=Y.decoder.end();Ee&&Ee.length&&(Y.buffer.push(Ee),Y.length+=Y.objectMode?1:Ee.length)}Y.ended=!0,Y.sync?D(O):(Y.needReadable=!1,Y.emittedReadable=!0,$(O))}}function D(O){const Y=O._readableState;y("emitReadable",Y.needReadable,Y.emittedReadable),Y.needReadable=!1,Y.emittedReadable||(y("emitReadable",Y.flowing),Y.emittedReadable=!0,e.nextTick($,O))}function $(O){const Y=O._readableState;y("emitReadable_",Y.destroyed,Y.length,Y.ended),!Y.destroyed&&!Y.errored&&(Y.length||Y.ended)&&(O.emit("readable"),Y.emittedReadable=!1),Y.needReadable=!Y.flowing&&!Y.ended&&Y.length<=Y.highWaterMark,Re(O)}function te(O,Y){!Y.readingMore&&Y.constructed&&(Y.readingMore=!0,e.nextTick(ue,O,Y))}function ue(O,Y){for(;!Y.reading&&!Y.ended&&(Y.length1&&ve.pipes.includes(O)&&(y("false write response, pause",ve.awaitDrainWriters.size),ve.awaitDrainWriters.add(O)),Ee.pause()),Be||(Be=B(Ee,O),O.on("drain",Be))}Ee.on("data",k);function k(Oe){y("ondata");const Z=O.write(Oe);y("dest.write",Z),Z===!1&&Pe()}function Me(Oe){if(y("onerror",Oe),Ae(),O.removeListener("error",Me),O.listenerCount("error")===0){const Z=O._writableState||O._readableState;Z&&!Z.errorEmitted?W(O,Oe):O.emit("error",Oe)}}N(O,"error",Me);function Ge(){O.removeListener("finish",p),Ae()}O.once("close",Ge);function p(){y("onfinish"),O.removeListener("close",Ge),Ae()}O.once("finish",p);function Ae(){y("unpipe"),Ee.unpipe(O)}return O.emit("pipe",Ee),O.writableNeedDrain===!0?ve.flowing&&Pe():ve.flowing||(y("pipe resume"),Ee.resume()),O};function B(O,Y){return function(){const ve=O._readableState;ve.awaitDrainWriters===Y?(y("pipeOnDrain",1),ve.awaitDrainWriters=null):ve.multiAwaitDrain&&(y("pipeOnDrain",ve.awaitDrainWriters.size),ve.awaitDrainWriters.delete(Y)),(!ve.awaitDrainWriters||ve.awaitDrainWriters.size===0)&&O.listenerCount("data")&&O.resume()}}T.prototype.unpipe=function(O){const Y=this._readableState,Ee={hasUnpiped:!1};if(Y.pipes.length===0)return this;if(!O){const $e=Y.pipes;Y.pipes=[],this.pause();for(let qe=0;qe<$e.length;qe++)$e[qe].emit("unpipe",this,{hasUnpiped:!1});return this}const ve=t(Y.pipes,O);return ve===-1?this:(Y.pipes.splice(ve,1),Y.pipes.length===0&&this.pause(),O.emit("unpipe",this,Ee),this)},T.prototype.on=function(O,Y){const Ee=A.prototype.on.call(this,O,Y),ve=this._readableState;return O==="data"?(ve.readableListening=this.listenerCount("readable")>0,ve.flowing!==!1&&this.resume()):O==="readable"&&!ve.endEmitted&&!ve.readableListening&&(ve.readableListening=ve.needReadable=!0,ve.flowing=!1,ve.emittedReadable=!1,y("on readable",ve.length,ve.reading),ve.length?D(this):ve.reading||e.nextTick(C,this)),Ee},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(O,Y){const Ee=A.prototype.removeListener.call(this,O,Y);return O==="readable"&&e.nextTick(U,this),Ee},T.prototype.off=T.prototype.removeListener,T.prototype.removeAllListeners=function(O){const Y=A.prototype.removeAllListeners.apply(this,arguments);return(O==="readable"||O===void 0)&&e.nextTick(U,this),Y};function U(O){const Y=O._readableState;Y.readableListening=O.listenerCount("readable")>0,Y.resumeScheduled&&Y[S]===!1?Y.flowing=!0:O.listenerCount("data")>0?O.resume():Y.readableListening||(Y.flowing=null)}function C(O){y("readable nexttick read 0"),O.read(0)}T.prototype.resume=function(){const O=this._readableState;return O.flowing||(y("resume"),O.flowing=!O.readableListening,G(this,O)),O[S]=!1,this};function G(O,Y){Y.resumeScheduled||(Y.resumeScheduled=!0,e.nextTick(ce,O,Y))}function ce(O,Y){y("resume",Y.reading),Y.reading||O.read(0),Y.resumeScheduled=!1,O.emit("resume"),Re(O),Y.flowing&&!Y.reading&&O.read(0)}T.prototype.pause=function(){return y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(y("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[S]=!0,this};function Re(O){const Y=O._readableState;for(y("flow",Y.flowing);Y.flowing&&O.read()!==null;);}T.prototype.wrap=function(O){let Y=!1;O.on("data",ve=>{!this.push(ve)&&O.pause&&(Y=!0,O.pause())}),O.on("end",()=>{this.push(null)}),O.on("error",ve=>{W(this,ve)}),O.on("close",()=>{this.destroy()}),O.on("destroy",()=>{this.destroy()}),this._read=()=>{Y&&O.resume&&(Y=!1,O.resume())};const Ee=f(O);for(let ve=1;ve{$e=V?ne($e,V):null,Ee(),Ee=M});try{for(;;){const V=O.destroyed?null:O.read();if(V!==null)yield V;else{if($e)throw $e;if($e===null)return;await new l(ve)}}}catch(V){throw $e=ne($e,V),$e}finally{($e||(Y==null?void 0:Y.destroyOnReturn)!==!1)&&($e===void 0||O._readableState.autoDestroy)?F.destroyer(O,null):(O.off("readable",ve),qe())}}s(T.prototype,{readable:{__proto__:null,get(){const O=this._readableState;return!!O&&O.readable!==!1&&!O.destroyed&&!O.errorEmitted&&!O.endEmitted},set(O){this._readableState&&(this._readableState.readable=!!O)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(O){this._readableState&&(this._readableState.flowing=O)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(O){this._readableState&&(this._readableState.destroyed=O)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(P.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[S]!==!1},set(O){this[S]=!!O}}}),T._fromList=me;function me(O,Y){if(Y.length===0)return null;let Ee;return Y.objectMode?Ee=Y.buffer.shift():!O||O>=Y.length?(Y.decoder?Ee=Y.buffer.join(""):Y.buffer.length===1?Ee=Y.buffer.first():Ee=Y.buffer.concat(Y.length),Y.buffer.clear()):Ee=Y.buffer.consume(O,Y.decoder),Ee}function Ye(O){const Y=O._readableState;y("endReadable",Y.endEmitted),Y.endEmitted||(Y.ended=!0,e.nextTick(Je,Y,O))}function Je(O,Y){if(y("endReadableNT",O.endEmitted,O.length),!O.errored&&!O.closeEmitted&&!O.endEmitted&&O.length===0){if(O.endEmitted=!0,Y.emit("end"),Y.writable&&Y.allowHalfOpen===!1)e.nextTick(rt,Y);else if(O.autoDestroy){const Ee=Y._writableState;(!Ee||Ee.autoDestroy&&(Ee.finished||Ee.writable===!1))&&Y.destroy()}}}function rt(O){O.writable&&!O.writableEnded&&!O.destroyed&&O.end()}T.from=function(O,Y){return H(T,O,Y)};let et;function ye(){return et===void 0&&(et={}),et}return T.fromWeb=function(O,Y){return ye().newStreamReadableFromReadableStream(O,Y)},T.toWeb=function(O,Y){return ye().newReadableStreamFromStreamReadable(O,Y)},T.wrap=function(O,Y){var Ee,ve;return new T({objectMode:(Ee=(ve=O.readableObjectMode)!==null&&ve!==void 0?ve:O.objectMode)!==null&&Ee!==void 0?Ee:!0,...Y,destroy($e,qe){F.destroyer(O,$e),qe($e)}}).wrap(O)},Ld}var Nd,ib;function Zw(){if(ib)return Nd;ib=1;const e=To,{ArrayPrototypeSlice:t,Error:r,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:a,ObjectDefineProperties:s,ObjectSetPrototypeOf:f,StringPrototypeToLowerCase:c,Symbol:l,SymbolHasInstance:d}=or;Nd=L,L.WritableState=m;const{EventEmitter:h}=Wi,b=Cp.Stream,{Buffer:R}=Vr,A=Pa,{addAbortSignal:N}=el,{getHighWaterMark:ae,getDefaultHighWaterMark:K}=Bp,{ERR_INVALID_ARG_TYPE:I,ERR_METHOD_NOT_IMPLEMENTED:y,ERR_MULTIPLE_CALLBACK:ie,ERR_STREAM_CANNOT_PIPE:F,ERR_STREAM_DESTROYED:z,ERR_STREAM_ALREADY_FINISHED:q,ERR_STREAM_NULL_VALUES:ne,ERR_STREAM_WRITE_AFTER_END:v,ERR_UNKNOWN_ENCODING:w}=Dr.codes,{errorOrDestroy:E}=A;f(L.prototype,b.prototype),f(L,b);function J(){}const _=l("kOnFinished");function m(C,G,ce){typeof ce!="boolean"&&(ce=G instanceof yi()),this.objectMode=!!(C&&C.objectMode),ce&&(this.objectMode=this.objectMode||!!(C&&C.writableObjectMode)),this.highWaterMark=C?ae(this,C,"writableHighWaterMark",ce):K(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const Re=!!(C&&C.decodeStrings===!1);this.decodeStrings=!Re,this.defaultEncoding=C&&C.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=T.bind(void 0,G),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,S(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!C||C.emitClose!==!1,this.autoDestroy=!C||C.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[_]=[]}function S(C){C.buffered=[],C.bufferedIndex=0,C.allBuffers=!0,C.allNoop=!0}m.prototype.getBuffer=function(){return t(this.buffered,this.bufferedIndex)},a(m.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function L(C){const G=this instanceof yi();if(!G&&!i(L,this))return new L(C);this._writableState=new m(C,this,G),C&&(typeof C.write=="function"&&(this._write=C.write),typeof C.writev=="function"&&(this._writev=C.writev),typeof C.destroy=="function"&&(this._destroy=C.destroy),typeof C.final=="function"&&(this._final=C.final),typeof C.construct=="function"&&(this._construct=C.construct),C.signal&&N(C.signal,this)),b.call(this,C),A.construct(this,()=>{const ce=this._writableState;ce.writing||se(this,ce),$(this,ce)})}a(L,d,{__proto__:null,value:function(C){return i(this,C)?!0:this!==L?!1:C&&C._writableState instanceof m}}),L.prototype.pipe=function(){E(this,new F)};function H(C,G,ce,Re){const Se=C._writableState;if(typeof ce=="function")Re=ce,ce=Se.defaultEncoding;else{if(!ce)ce=Se.defaultEncoding;else if(ce!=="buffer"&&!R.isEncoding(ce))throw new w(ce);typeof Re!="function"&&(Re=J)}if(G===null)throw new ne;if(!Se.objectMode)if(typeof G=="string")Se.decodeStrings!==!1&&(G=R.from(G,ce),ce="buffer");else if(G instanceof R)ce="buffer";else if(b._isUint8Array(G))G=b._uint8ArrayToBuffer(G),ce="buffer";else throw new I("chunk",["string","Buffer","Uint8Array"],G);let De;return Se.ending?De=new v:Se.destroyed&&(De=new z("write")),De?(e.nextTick(Re,De),E(C,De,!0),De):(Se.pendingcb++,M(C,Se,G,ce,Re))}L.prototype.write=function(C,G,ce){return H(this,C,G,ce)===!0},L.prototype.cork=function(){this._writableState.corked++},L.prototype.uncork=function(){const C=this._writableState;C.corked&&(C.corked--,C.writing||se(this,C))},L.prototype.setDefaultEncoding=function(G){if(typeof G=="string"&&(G=c(G)),!R.isEncoding(G))throw new w(G);return this._writableState.defaultEncoding=G,this};function M(C,G,ce,Re,Se){const De=G.objectMode?1:ce.length;G.length+=De;const me=G.lengthce.bufferedIndex&&se(C,ce),Re?ce.afterWriteTickInfo!==null&&ce.afterWriteTickInfo.cb===Se?ce.afterWriteTickInfo.count++:(ce.afterWriteTickInfo={count:1,cb:Se,stream:C,state:ce},e.nextTick(re,ce.afterWriteTickInfo)):j(C,ce,1,Se))}function re({stream:C,state:G,count:ce,cb:Re}){return G.afterWriteTickInfo=null,j(C,G,ce,Re)}function j(C,G,ce,Re){for(!G.ending&&!C.destroyed&&G.length===0&&G.needDrain&&(G.needDrain=!1,C.emit("drain"));ce-- >0;)G.pendingcb--,Re();G.destroyed&&Q(G),$(C,G)}function Q(C){if(C.writing)return;for(let Se=C.bufferedIndex;Se1&&C._writev){G.pendingcb-=De-1;const Ye=G.allNoop?J:rt=>{for(let et=me;et256?(ce.splice(0,me),G.bufferedIndex=0):G.bufferedIndex=me}G.bufferProcessing=!1}L.prototype._write=function(C,G,ce){if(this._writev)this._writev([{chunk:C,encoding:G}],ce);else throw new y("_write()")},L.prototype._writev=null,L.prototype.end=function(C,G,ce){const Re=this._writableState;typeof C=="function"?(ce=C,C=null,G=null):typeof G=="function"&&(ce=G,G=null);let Se;if(C!=null){const De=H(this,C,G);De instanceof r&&(Se=De)}return Re.corked&&(Re.corked=1,this.uncork()),Se||(!Re.errored&&!Re.ending?(Re.ending=!0,$(this,Re,!0),Re.ended=!0):Re.finished?Se=new q("end"):Re.destroyed&&(Se=new z("end"))),typeof ce=="function"&&(Se||Re.finished?e.nextTick(ce,Se):Re[_].push(ce)),this};function de(C){return C.ending&&!C.destroyed&&C.constructed&&C.length===0&&!C.errored&&C.buffered.length===0&&!C.finished&&!C.writing&&!C.errorEmitted&&!C.closeEmitted}function X(C,G){let ce=!1;function Re(Se){if(ce){E(C,Se??ie());return}if(ce=!0,G.pendingcb--,Se){const De=G[_].splice(0);for(let me=0;me{de(Se)?te(Re,Se):Se.pendingcb--},C,G)):de(G)&&(G.pendingcb++,te(C,G))))}function te(C,G){G.pendingcb--,G.finished=!0;const ce=G[_].splice(0);for(let Re=0;Re{if(T!=null)throw new R("nully","body",T)},T=>{A(W,T)});return W=new q({objectMode:!0,readable:!1,write:S,final(T){L(async()=>{try{await P,e.nextTick(T,null)}catch(re){e.nextTick(T,re)}})},destroy:H})}throw new R("Iterable, AsyncIterable or AsyncFunction",J,m)}if(ie(E))return w(E.arrayBuffer());if(a(E))return I(q,E,{objectMode:!0,writable:!1});if(typeof(E==null?void 0:E.writable)=="object"||typeof(E==null?void 0:E.readable)=="object"){const m=E!=null&&E.readable?f(E==null?void 0:E.readable)?E==null?void 0:E.readable:w(E.readable):void 0,S=E!=null&&E.writable?c(E==null?void 0:E.writable)?E==null?void 0:E.writable:w(E.writable):void 0;return v({readable:m,writable:S})}const _=E==null?void 0:E.then;if(typeof _=="function"){let m;return z(_,E,S=>{S!=null&&m.push(S),m.push(null)},S=>{A(m,S)}),m=new q({objectMode:!0,writable:!1,read(){}})}throw new b(J,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],E)};function ne(w){let{promise:E,resolve:J}=K();const _=new F,m=_.signal;return{value:w(async function*(){for(;;){const L=E;E=null;const{chunk:H,done:M,cb:W}=await L;if(e.nextTick(W),M)return;if(m.aborted)throw new h(void 0,{cause:m.reason});({promise:E,resolve:J}=K()),yield H}}(),{signal:m}),write(L,H,M){const W=J;J=null,W({chunk:L,done:!1,cb:M})},final(L){const H=J;J=null,H({done:!0,cb:L})},destroy(L,H){_.abort(),H(L)}}}function v(w){const E=w.readable&&typeof w.readable.read!="function"?ae.wrap(w.readable):w.readable,J=w.writable;let _=!!r(E),m=!!i(J),S,L,H,M,W;function P(T){const re=M;M=null,re?re(T):T&&W.destroy(T)}return W=new q({readableObjectMode:!!(E!=null&&E.readableObjectMode),writableObjectMode:!!(J!=null&&J.writableObjectMode),readable:_,writable:m}),m&&(d(J,T=>{m=!1,T&&A(E,T),P(T)}),W._write=function(T,re,j){J.write(T,re)?j():S=j},W._final=function(T){J.end(),L=T},J.on("drain",function(){if(S){const T=S;S=null,T()}}),J.on("finish",function(){if(L){const T=L;L=null,T()}})),_&&(d(E,T=>{_=!1,T&&A(E,T),P(T)}),E.on("readable",function(){if(H){const T=H;H=null,T()}}),E.on("end",function(){W.push(null)}),W._read=function(){for(;;){const T=E.read();if(T===null){H=W._read;return}if(!W.push(T))return}}),W._destroy=function(T,re){!T&&M!==null&&(T=new h),H=null,S=null,L=null,M===null?re(T):(M=re,A(J,T),A(E,T))},W}return Cd}var Bd,ab;function yi(){if(ab)return Bd;ab=1;const{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:t,ObjectKeys:r,ObjectSetPrototypeOf:i}=or;Bd=f;const a=tl(),s=Zw();i(f.prototype,a.prototype),i(f,a);{const h=r(s.prototype);for(let b=0;b{if(t){e?e(t):this.destroy(t);return}r!=null&&this.push(r),this.push(null),e&&e()}):(this.push(null),e&&e())}function w$(){this._final!==Dh&&Dh.call(this)}_i.prototype._final=Dh;_i.prototype._transform=function(e,t,r){throw new b$("_transform()")};_i.prototype._write=function(e,t,r){const i=this._readableState,a=this._writableState,s=i.length;this._transform(e,t,(f,c)=>{if(f){r(f);return}c!=null&&this.push(c),a.ended||s===i.length||i.length{i=!0});const a=mu(e,{readable:t,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,A$.destroyer(e,s||new I$("pipe")))},cleanup:a}}function M$(e){return N$(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function Fd(e){if(ho(e))return e;if(cu(e))return D$(e);throw new jh("val",["Readable","Iterable","AsyncIterable"],e)}async function*D$(e){jd||(jd=tl()),yield*jd.prototype[S$].call(e)}async function Jf(e,t,r,{end:i}){let a,s=null;const f=d=>{if(d&&(a=d),s){const h=s;s=null,h()}},c=()=>new E$((d,h)=>{a?h(a):s=()=>{a?h(a):d()}});t.on("drain",f);const l=mu(t,{readable:!1},f);try{t.writableNeedDrain&&await c();for await(const d of e)t.write(d)||await c();i&&t.end(),await c(),r()}catch(d){r(a!==d?T$(a,d):d)}finally{l(),t.off("drain",f)}}async function Ud(e,t,r,{end:i}){sa(t)&&(t=t.writable);const a=t.getWriter();try{for await(const s of e)await a.ready,a.write(s).catch(()=>{});await a.ready,i&&await a.close(),r()}catch(s){try{await a.abort(s),r(s)}catch(f){r(f)}}}function j$(...e){return Qw(e,R$(M$(e)))}function Qw(e,t,r){if(e.length===1&&m$(e[0])&&(e=e[0]),e.length<2)throw new O$("streams");const i=new $$,a=i.signal,s=r==null?void 0:r.signal,f=[];C$(s,"options.signal");function c(){A(new L$)}s==null||s.addEventListener("abort",c);let l,d;const h=[];let b=0;function R(I){A(I,--b===0)}function A(I,y){if(I&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=I),!(!l&&!y)){for(;h.length;)h.shift()(l);s==null||s.removeEventListener("abort",c),i.abort(),y&&(l||f.forEach(ie=>ie()),hs.nextTick(t,l,d))}}let N;for(let I=0;I0,z=ie||(r==null?void 0:r.end)!==!1,q=I===e.length-1;if(fb(y)){let ne=function(v){v&&v.name!=="AbortError"&&v.code!=="ERR_STREAM_PREMATURE_CLOSE"&&R(v)};if(z){const{destroy:v,cleanup:w}=ub(y,ie,F);h.push(v),$d(y)&&q&&f.push(w)}y.on("error",ne),$d(y)&&q&&f.push(()=>{y.removeListener("error",ne)})}if(I===0)if(typeof y=="function"){if(N=y({signal:a}),!ho(N))throw new xd("Iterable, AsyncIterable or Stream","source",N)}else ho(y)||cu(y)||sa(y)?N=y:N=sb.from(y);else if(typeof y=="function"){if(sa(N)){var ae;N=Fd((ae=N)===null||ae===void 0?void 0:ae.readable)}else N=Fd(N);if(N=y(N,{signal:a}),ie){if(!ho(N,!0))throw new xd("AsyncIterable",`transform[${I-1}]`,N)}else{var K;Dd||(Dd=Yw);const ne=new Dd({objectMode:!0}),v=(K=N)===null||K===void 0?void 0:K.then;if(typeof v=="function")b++,v.call(N,J=>{d=J,J!=null&&ne.write(J),z&&ne.end(),hs.nextTick(R)},J=>{ne.destroy(J),hs.nextTick(R,J)});else if(ho(N,!0))b++,Jf(N,ne,R,{end:z});else if(Md(N)||sa(N)){const J=N.readable||N;b++,Jf(J,ne,R,{end:z})}else throw new xd("AsyncIterable or Promise","destination",N);N=ne;const{destroy:w,cleanup:E}=ub(N,!1,!0);h.push(w),q&&f.push(E)}}else if(fb(y)){if(cu(N)){b+=2;const ne=F$(N,y,R,{end:z});$d(y)&&q&&f.push(ne)}else if(sa(N)||Md(N)){const ne=N.readable||N;b++,Jf(ne,y,R,{end:z})}else if(ho(N))b++,Jf(N,y,R,{end:z});else throw new jh("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],N);N=y}else if(B$(y)){if(cu(N))b++,Ud(Fd(N),y,R,{end:z});else if(Md(N)||ho(N))b++,Ud(N,y,R,{end:z});else if(sa(N))b++,Ud(N.readable,y,R,{end:z});else throw new jh("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],N);N=y}else N=sb.from(y)}return(a!=null&&a.aborted||s!=null&&s.aborted)&&hs.nextTick(c),N}function F$(e,t,r,{end:i}){let a=!1;if(t.on("close",()=>{a||r(new P$)}),e.pipe(t,{end:!1}),i){let s=function(){a=!0,t.end()};x$(e)?hs.nextTick(s):e.once("end",s)}else r();return mu(e,{readable:!0,writable:!1},s=>{const f=e._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&f&&f.ended&&!f.errored&&!f.errorEmitted?e.once("end",r).once("error",r):r(s)}),mu(t,{readable:!1,writable:!0},r)}var Mp={pipelineImpl:Qw,pipeline:j$};const{pipeline:U$}=Mp,Xf=yi(),{destroyer:k$}=Pa,{isNodeStream:Yf,isReadable:lb,isWritable:cb,isWebStream:kd,isTransformStream:lo,isWritableStream:db,isReadableStream:hb}=Ei,{AbortError:q$,codes:{ERR_INVALID_ARG_VALUE:pb,ERR_MISSING_ARGS:H$}}=Dr,W$=zi;var em=function(...t){if(t.length===0)throw new H$("streams");if(t.length===1)return Xf.from(t[0]);const r=[...t];if(typeof t[0]=="function"&&(t[0]=Xf.from(t[0])),typeof t[t.length-1]=="function"){const A=t.length-1;t[A]=Xf.from(t[A])}for(let A=0;A0&&!(cb(t[A])||db(t[A])||lo(t[A])))throw new pb(`streams[${A}]`,r[A],"must be writable")}let i,a,s,f,c;function l(A){const N=f;f=null,N?N(A):A?c.destroy(A):!R&&!b&&c.destroy()}const d=t[0],h=U$(t,l),b=!!(cb(d)||db(d)||lo(d)),R=!!(lb(h)||hb(h)||lo(h));if(c=new Xf({writableObjectMode:!!(d!=null&&d.writableObjectMode),readableObjectMode:!!(h!=null&&h.writableObjectMode),writable:b,readable:R}),b){if(Yf(d))c._write=function(N,ae,K){d.write(N,ae)?K():i=K},c._final=function(N){d.end(),a=N},d.on("drain",function(){if(i){const N=i;i=null,N()}});else if(kd(d)){const ae=(lo(d)?d.writable:d).getWriter();c._write=async function(K,I,y){try{await ae.ready,ae.write(K).catch(()=>{}),y()}catch(ie){y(ie)}},c._final=async function(K){try{await ae.ready,ae.close().catch(()=>{}),a=K}catch(I){K(I)}}}const A=lo(h)?h.readable:h;W$(A,()=>{if(a){const N=a;a=null,N()}})}if(R){if(Yf(h))h.on("readable",function(){if(s){const A=s;s=null,A()}}),h.on("end",function(){c.push(null)}),c._read=function(){for(;;){const A=h.read();if(A===null){s=c._read;return}if(!c.push(A))return}};else if(kd(h)){const N=(lo(h)?h.readable:h).getReader();c._read=async function(){for(;;)try{const{value:ae,done:K}=await N.read();if(!c.push(ae))return;if(K){c.push(null);return}}catch{return}}}}return c._destroy=function(A,N){!A&&f!==null&&(A=new q$),s=null,i=null,a=null,f===null?N(A):(f=N,Yf(h)&&k$(h,A))},c};const tm=globalThis.AbortController||Tp().AbortController,{codes:{ERR_INVALID_ARG_VALUE:z$,ERR_INVALID_ARG_TYPE:Ns,ERR_MISSING_ARGS:G$,ERR_OUT_OF_RANGE:V$},AbortError:Kn}=Dr,{validateAbortSignal:Io,validateInteger:Z$,validateObject:Po}=Vu,K$=or.Symbol("kWeak"),{finished:J$}=zi,X$=em,{addAbortSignalNoValidate:Y$}=el,{isWritable:Q$,isNodeStream:e3}=Ei,{ArrayPrototypePush:t3,MathFloor:r3,Number:n3,NumberIsNaN:i3,Promise:gb,PromiseReject:yb,PromisePrototypeThen:o3,Symbol:rm}=or,Eu=rm("kEmpty"),_b=rm("kEof");function a3(e,t){if(t!=null&&Po(t,"options"),(t==null?void 0:t.signal)!=null&&Io(t.signal,"options.signal"),e3(e)&&!Q$(e))throw new z$("stream",e,"must be writable");const r=X$(this,e);return t!=null&&t.signal&&Y$(t.signal,r),r}function rl(e,t){if(typeof e!="function")throw new Ns("fn",["Function","AsyncFunction"],e);t!=null&&Po(t,"options"),(t==null?void 0:t.signal)!=null&&Io(t.signal,"options.signal");let r=1;return(t==null?void 0:t.concurrency)!=null&&(r=r3(t.concurrency)),Z$(r,"concurrency",1),(async function*(){var a,s;const f=new tm,c=this,l=[],d=f.signal,h={signal:d},b=()=>f.abort();t!=null&&(a=t.signal)!==null&&a!==void 0&&a.aborted&&b(),t==null||(s=t.signal)===null||s===void 0||s.addEventListener("abort",b);let R,A,N=!1;function ae(){N=!0}async function K(){try{for await(let ie of c){var I;if(N)return;if(d.aborted)throw new Kn;try{ie=e(ie,h)}catch(F){ie=yb(F)}ie!==Eu&&(typeof((I=ie)===null||I===void 0?void 0:I.catch)=="function"&&ie.catch(ae),l.push(ie),R&&(R(),R=null),!N&&l.length&&l.length>=r&&await new gb(F=>{A=F}))}l.push(_b)}catch(ie){const F=yb(ie);o3(F,void 0,ae),l.push(F)}finally{var y;N=!0,R&&(R(),R=null),t==null||(y=t.signal)===null||y===void 0||y.removeEventListener("abort",b)}}K();try{for(;;){for(;l.length>0;){const I=await l[0];if(I===_b)return;if(d.aborted)throw new Kn;I!==Eu&&(yield I),l.shift(),A&&(A(),A=null)}await new gb(I=>{R=I})}}finally{f.abort(),N=!0,A&&(A(),A=null)}}).call(this)}function s3(e=void 0){return e!=null&&Po(e,"options"),(e==null?void 0:e.signal)!=null&&Io(e.signal,"options.signal"),(async function*(){let r=0;for await(const a of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Kn({cause:e.signal.reason});yield[r++,a]}}).call(this)}async function nm(e,t=void 0){for await(const r of Dp.call(this,e,t))return!0;return!1}async function f3(e,t=void 0){if(typeof e!="function")throw new Ns("fn",["Function","AsyncFunction"],e);return!await nm.call(this,async(...r)=>!await e(...r),t)}async function u3(e,t){for await(const r of Dp.call(this,e,t))return r}async function l3(e,t){if(typeof e!="function")throw new Ns("fn",["Function","AsyncFunction"],e);async function r(i,a){return await e(i,a),Eu}for await(const i of rl.call(this,r,t));}function Dp(e,t){if(typeof e!="function")throw new Ns("fn",["Function","AsyncFunction"],e);async function r(i,a){return await e(i,a)?i:Eu}return rl.call(this,r,t)}class c3 extends G${constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function d3(e,t,r){var i;if(typeof e!="function")throw new Ns("reducer",["Function","AsyncFunction"],e);r!=null&&Po(r,"options"),(r==null?void 0:r.signal)!=null&&Io(r.signal,"options.signal");let a=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){const d=new Kn(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await J$(this.destroy(d)),d}const s=new tm,f=s.signal;if(r!=null&&r.signal){const d={once:!0,[K$]:this};r.signal.addEventListener("abort",()=>s.abort(),d)}let c=!1;try{for await(const d of this){var l;if(c=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new Kn;a?t=await e(t,d,{signal:f}):(t=d,a=!0)}if(!c&&!a)throw new c3}finally{s.abort()}return t}async function h3(e){e!=null&&Po(e,"options"),(e==null?void 0:e.signal)!=null&&Io(e.signal,"options.signal");const t=[];for await(const i of this){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Kn(void 0,{cause:e.signal.reason});t3(t,i)}return t}function p3(e,t){const r=rl.call(this,e,t);return(async function*(){for await(const a of r)yield*a}).call(this)}function im(e){if(e=n3(e),i3(e))return 0;if(e<0)throw new V$("number",">= 0",e);return e}function g3(e,t=void 0){return t!=null&&Po(t,"options"),(t==null?void 0:t.signal)!=null&&Io(t.signal,"options.signal"),e=im(e),(async function*(){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Kn;for await(const s of this){var a;if(t!=null&&(a=t.signal)!==null&&a!==void 0&&a.aborted)throw new Kn;e--<=0&&(yield s)}}).call(this)}function y3(e,t=void 0){return t!=null&&Po(t,"options"),(t==null?void 0:t.signal)!=null&&Io(t.signal,"options.signal"),e=im(e),(async function*(){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Kn;for await(const s of this){var a;if(t!=null&&(a=t.signal)!==null&&a!==void 0&&a.aborted)throw new Kn;if(e-- >0)yield s;else return}}).call(this)}Ap.streamReturningOperators={asIndexedPairs:s3,drop:g3,filter:Dp,flatMap:p3,map:rl,take:y3,compose:a3};Ap.promiseReturningOperators={every:f3,forEach:l3,reduce:d3,toArray:h3,some:nm,find:u3};var qd,bb;function om(){if(bb)return qd;bb=1;const{ArrayPrototypePop:e,Promise:t}=or,{isIterable:r,isNodeStream:i,isWebStream:a}=Ei,{pipelineImpl:s}=Mp,{finished:f}=zi;am();function c(...l){return new t((d,h)=>{let b,R;const A=l[l.length-1];if(A&&typeof A=="object"&&!i(A)&&!r(A)&&!a(A)){const N=e(l);b=N.signal,R=N.end}s(l,(N,ae)=>{N?h(N):d(ae)},{signal:b,end:R})})}return qd={finished:f,pipeline:c},qd}var vb;function am(){if(vb)return Td.exports;vb=1;const{Buffer:e}=Vr,{ObjectDefineProperty:t,ObjectKeys:r,ReflectApply:i}=or,{promisify:{custom:a}}=mi,{streamReturningOperators:s,promiseReturningOperators:f}=Ap,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=Dr,l=em,{pipeline:d}=Mp,{destroyer:h}=Pa,b=zi,R=om(),A=Ei,N=Td.exports=Cp.Stream;N.isDisturbed=A.isDisturbed,N.isErrored=A.isErrored,N.isReadable=A.isReadable,N.Readable=tl();for(const K of r(s)){let y=function(...ie){if(new.target)throw c();return N.Readable.from(i(I,this,ie))};const I=s[K];t(y,"name",{__proto__:null,value:I.name}),t(y,"length",{__proto__:null,value:I.length}),t(N.Readable.prototype,K,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}for(const K of r(f)){let y=function(...ie){if(new.target)throw c();return i(I,this,ie)};const I=f[K];t(y,"name",{__proto__:null,value:I.name}),t(y,"length",{__proto__:null,value:I.length}),t(N.Readable.prototype,K,{__proto__:null,value:y,enumerable:!1,configurable:!0,writable:!0})}N.Writable=Zw(),N.Duplex=yi(),N.Transform=Jw,N.PassThrough=Yw,N.pipeline=d;const{addAbortSignal:ae}=el;return N.addAbortSignal=ae,N.finished=b,N.destroy=h,N.compose=l,t(N,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return R}}),t(d,a,{__proto__:null,enumerable:!0,get(){return R.pipeline}}),t(b,a,{__proto__:null,enumerable:!0,get(){return R.finished}}),N.Stream=N,N._isUint8Array=function(I){return I instanceof Uint8Array},N._uint8ArrayToBuffer=function(I){return e.from(I.buffer,I.byteOffset,I.byteLength)},Td.exports}(function(e){const t=am(),r=om(),i=t.Readable.destroy;e.exports=t.Readable,e.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,e.exports._isUint8Array=t._isUint8Array,e.exports.isDisturbed=t.isDisturbed,e.exports.isErrored=t.isErrored,e.exports.isReadable=t.isReadable,e.exports.Readable=t.Readable,e.exports.Writable=t.Writable,e.exports.Duplex=t.Duplex,e.exports.Transform=t.Transform,e.exports.PassThrough=t.PassThrough,e.exports.addAbortSignal=t.addAbortSignal,e.exports.finished=t.finished,e.exports.destroy=t.destroy,e.exports.destroy=i,e.exports.pipeline=t.pipeline,e.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return r}}),e.exports.Stream=t.Stream,e.exports.default=e.exports})(pB);var jp=Ss;Ss.default=Ss;Ss.stable=um;Ss.stableStringify=um;var Su="[...]",sm="[Circular]",So=[],yo=[];function fm(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Ss(e,t,r,i){typeof i>"u"&&(i=fm()),Fh(e,"",0,[],void 0,0,i);var a;try{yo.length===0?a=JSON.stringify(e,t,r):a=JSON.stringify(e,lm(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;So.length!==0;){var s=So.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return a}function da(e,t,r,i){var a=Object.getOwnPropertyDescriptor(i,r);a.get!==void 0?a.configurable?(Object.defineProperty(i,r,{value:e}),So.push([i,r,t,a])):yo.push([t,r,e]):(i[r]=e,So.push([i,r,t]))}function Fh(e,t,r,i,a,s,f){s+=1;var c;if(typeof e=="object"&&e!==null){for(c=0;cf.depthLimit){da(Su,e,t,a);return}if(typeof f.edgesLimit<"u"&&r+1>f.edgesLimit){da(Su,e,t,a);return}if(i.push(e),Array.isArray(e))for(c=0;ct?1:0}function um(e,t,r,i){typeof i>"u"&&(i=fm());var a=Uh(e,"",0,[],void 0,0,i)||e,s;try{yo.length===0?s=JSON.stringify(a,t,r):s=JSON.stringify(a,lm(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;So.length!==0;){var f=So.pop();f.length===4?Object.defineProperty(f[0],f[1],f[3]):f[0][f[1]]=f[2]}}return s}function Uh(e,t,r,i,a,s,f){s+=1;var c;if(typeof e=="object"&&e!==null){for(c=0;cf.depthLimit){da(Su,e,t,a);return}if(typeof f.edgesLimit<"u"&&r+1>f.edgesLimit){da(Su,e,t,a);return}if(i.push(e),Array.isArray(e))for(c=0;c0)for(var i=0;ii??(i=[t,...r()])}}function w3(e){return pn(e)&&typeof e[Symbol.iterator]=="function"}function pn(e){return typeof e=="object"&&e!=null}function wb(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ir(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function m3(e){const{done:t,value:r}=e.next();return t?void 0:r}function E3(e,t,r,i){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:a,branch:s}=t,{type:f}=r,{refinement:c,message:l=`Expected a value of type \`${f}\`${c?` with refinement \`${c}\``:""}, but received: \`${ir(i)}\``}=e;return{value:i,type:f,refinement:c,key:a[a.length-1],path:a,branch:s,...e,message:l}}function*kh(e,t,r,i){w3(e)||(e=[e]);for(const a of e){const s=E3(a,t,r,i);s&&(yield s)}}function*Up(e,t,r={}){const{path:i=[],branch:a=[e],coerce:s=!1,mask:f=!1}=r,c={path:i,branch:a};if(s&&(e=t.coercer(e,c),f&&t.type!=="type"&&pn(t.schema)&&pn(e)&&!Array.isArray(e)))for(const d in e)t.schema[d]===void 0&&delete e[d];let l="valid";for(const d of t.validator(e,c))d.explanation=r.message,l="not_valid",yield[d,void 0];for(let[d,h,b]of t.entries(e,c)){const R=Up(h,b,{path:d===void 0?i:[...i,d],branch:d===void 0?a:[...a,h],coerce:s,mask:f,message:r.message});for(const A of R)A[0]?(l=A[0].refinement!=null?"not_refined":"not_valid",yield[A[0],void 0]):s&&(h=A[1],d===void 0?e=h:e instanceof Map?e.set(d,h):e instanceof Set?e.add(h):pn(e)&&(h!==void 0||d in e)&&(e[d]=h))}if(l!=="not_valid")for(const d of t.refiner(e,c))d.explanation=r.message,l="not_refined",yield[d,void 0];l==="valid"&&(yield[void 0,e])}class er{constructor(t){const{type:r,schema:i,validator:a,refiner:s,coercer:f=l=>l,entries:c=function*(){}}=t;this.type=r,this.schema=i,this.entries=c,this.coercer=f,a?this.validator=(l,d)=>{const h=a(l,d);return kh(h,d,this,l)}:this.validator=()=>[],s?this.refiner=(l,d)=>{const h=s(l,d);return kh(h,d,this,l)}:this.refiner=()=>[]}assert(t,r){return dm(t,this,r)}create(t,r){return hm(t,this,r)}is(t){return kp(t,this)}mask(t,r){return pm(t,this,r)}validate(t,r={}){return La(t,this,r)}}function dm(e,t,r){const i=La(e,t,{message:r});if(i[0])throw i[0]}function hm(e,t,r){const i=La(e,t,{coerce:!0,message:r});if(i[0])throw i[0];return i[1]}function pm(e,t,r){const i=La(e,t,{coerce:!0,mask:!0,message:r});if(i[0])throw i[0];return i[1]}function kp(e,t){return!La(e,t)[0]}function La(e,t,r={}){const i=Up(e,t,r),a=m3(i);return a[0]?[new cm(a[0],function*(){for(const f of i)f[0]&&(yield f[0])}),void 0]:[void 0,a[1]]}function S3(...e){const t=e[0].type==="type",r=e.map(a=>a.schema),i=Object.assign({},...r);return t?Hp(i):Cs(i)}function jr(e,t){return new er({type:e,schema:null,validator:t})}function R3(e,t){return new er({...e,refiner:(r,i)=>r===void 0||e.refiner(r,i),validator(r,i){return r===void 0?!0:(t(r,i),e.validator(r,i))}})}function A3(e){return new er({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function T3(e){let t;return new er({type:"lazy",schema:null,*entries(r,i){t??(t=e()),yield*t.entries(r,i)},validator(r,i){return t??(t=e()),t.validator(r,i)},coercer(r,i){return t??(t=e()),t.coercer(r,i)},refiner(r,i){return t??(t=e()),t.refiner(r,i)}})}function O3(e,t){const{schema:r}=e,i={...r};for(const a of t)delete i[a];switch(e.type){case"type":return Hp(i);default:return Cs(i)}}function I3(e){const t=e instanceof er?{...e.schema}:{...e};for(const r in t)t[r]=gm(t[r]);return Cs(t)}function P3(e,t){const{schema:r}=e,i={};for(const a of t)i[a]=r[a];return Cs(i)}function L3(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),jr(e,t)}function N3(){return jr("any",()=>!0)}function C3(e){return new er({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,i]of t.entries())yield[r,i,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${ir(t)}`}})}function B3(){return jr("bigint",e=>typeof e=="bigint")}function x3(){return jr("boolean",e=>typeof e=="boolean")}function $3(){return jr("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ir(e)}`)}function M3(e){const t={},r=e.map(i=>ir(i)).join();for(const i of e)t[i]=i;return new er({type:"enums",schema:t,validator(i){return e.includes(i)||`Expected one of \`${r}\`, but received: ${ir(i)}`}})}function D3(){return jr("func",e=>typeof e=="function"||`Expected a function, but received: ${ir(e)}`)}function j3(e){return jr("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ir(t)}`)}function F3(){return jr("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ir(e)}`)}function U3(e){return new er({type:"intersection",schema:null,*entries(t,r){for(const i of e)yield*i.entries(t,r)},*validator(t,r){for(const i of e)yield*i.validator(t,r)},*refiner(t,r){for(const i of e)yield*i.refiner(t,r)}})}function k3(e){const t=ir(e),r=typeof e;return new er({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(i){return i===e||`Expected the literal \`${t}\`, but received: ${ir(i)}`}})}function q3(e,t){return new er({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[i,a]of r.entries())yield[i,i,e],yield[i,a,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${ir(r)}`}})}function qp(){return jr("never",()=>!1)}function H3(e){return new er({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function W3(){return jr("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${ir(e)}`)}function Cs(e){const t=e?Object.keys(e):[],r=qp();return new er({type:"object",schema:e||null,*entries(i){if(e&&pn(i)){const a=new Set(Object.keys(i));for(const s of t)a.delete(s),yield[s,i[s],e[s]];for(const s of a)yield[s,i[s],r]}},validator(i){return pn(i)||`Expected an object, but received: ${ir(i)}`},coercer(i){return pn(i)?{...i}:i}})}function gm(e){return new er({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function z3(e,t){return new er({type:"record",schema:null,*entries(r){if(pn(r))for(const i in r){const a=r[i];yield[i,i,e],yield[i,a,t]}},validator(r){return pn(r)||`Expected an object, but received: ${ir(r)}`}})}function G3(){return jr("regexp",e=>e instanceof RegExp)}function V3(e){return new er({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${ir(t)}`}})}function ym(){return jr("string",e=>typeof e=="string"||`Expected a string, but received: ${ir(e)}`)}function Z3(e){const t=qp();return new er({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const i=Math.max(e.length,r.length);for(let a=0;ar.type).join(" | ");return new er({type:"union",schema:null,coercer(r){for(const i of e){const[a,s]=i.validate(r,{coerce:!0});if(!a)return s}return r},validator(r,i){const a=[];for(const s of e){const[...f]=Up(r,s,i),[c]=f;if(c[0])for(const[l]of f)l&&a.push(l);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ir(r)}`,...a]}})}function _m(){return jr("unknown",()=>!0)}function Wp(e,t,r){return new er({...e,coercer:(i,a)=>kp(i,t)?e.coercer(r(i,a),a):e.coercer(i,a)})}function J3(e,t,r={}){return Wp(e,_m(),i=>{const a=typeof t=="function"?t():t;if(i===void 0)return a;if(!r.strict&&wb(i)&&wb(a)){const s={...i};let f=!1;for(const c in a)s[c]===void 0&&(s[c]=a[c],f=!0);if(f)return s}return i})}function X3(e){return Wp(e,ym(),t=>t.trim())}function Y3(e){return Lo(e,"empty",t=>{const r=bm(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function bm(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Q3(e,t,r={}){const{exclusive:i}=r;return Lo(e,"max",a=>i?ai?a>t:a>=t||`Expected a ${e.type} greater than ${i?"":"or equal to "}${t} but received \`${a}\``)}function tM(e){return Lo(e,"nonempty",t=>bm(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function rM(e,t){return Lo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function nM(e,t,r=t){const i=`Expected a ${e.type}`,a=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Lo(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${i} ${a} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:f}=s;return t<=f&&f<=r||`${i} with a size ${a} but received one with a size of \`${f}\``}else{const{length:f}=s;return t<=f&&f<=r||`${i} with a length ${a} but received one with a length of \`${f}\``}})}function Lo(e,t,r){return new er({...e,*refiner(i,a){yield*e.refiner(i,a);const s=r(i,a),f=kh(s,a,e,i);for(const c of f)yield{...c,refinement:t}}})}const iM=Object.freeze(Object.defineProperty({__proto__:null,Struct:er,StructError:cm,any:N3,array:C3,assert:dm,assign:S3,bigint:B3,boolean:x3,coerce:Wp,create:hm,date:$3,defaulted:J3,define:jr,deprecated:R3,dynamic:A3,empty:Y3,enums:M3,func:D3,instance:j3,integer:F3,intersection:U3,is:kp,lazy:T3,literal:k3,map:q3,mask:pm,max:Q3,min:eM,never:qp,nonempty:tM,nullable:H3,number:W3,object:Cs,omit:O3,optional:gm,partial:I3,pattern:rM,pick:P3,record:z3,refine:Lo,regexp:G3,set:V3,size:nM,string:ym,struct:L3,trimmed:X3,tuple:Z3,type:Hp,union:K3,unknown:_m,validate:La},Symbol.toStringTag,{value:"Module"})),No=rp(iM);Object.defineProperty(_r,"__esModule",{value:!0});_r.assertExhaustive=_r.assertStruct=_r.assert=_r.AssertionError=void 0;const oM=No;function aM(e){return typeof e=="object"&&e!==null&&"message"in e}function sM(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function fM(e){const t=aM(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function vm(e,t){return sM(e)?new e({message:t}):e({message:t})}class zp extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}_r.AssertionError=zp;function uM(e,t="Assertion failed.",r=zp){if(!e)throw t instanceof Error?t:vm(r,t)}_r.assert=uM;function lM(e,t,r="Assertion failed",i=zp){try{(0,oM.assert)(e,t)}catch(a){throw vm(i,`${r}: ${fM(a)}.`)}}_r.assertStruct=lM;function cM(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}_r.assertExhaustive=cM;var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.base64=void 0;const dM=No,hM=_r,pM=(e,t={})=>{var r,i;const a=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,s=(i=t.characterSet)!==null&&i!==void 0?i:"base64";let f;s==="base64"?f=String.raw`[A-Za-z0-9+\/]`:((0,hM.assert)(s==="base64url"),f=String.raw`[-_A-Za-z0-9]`);let c;return a?c=new RegExp(`^(?:${f}{4})*(?:${f}{3}=|${f}{2}==)?$`,"u"):c=new RegExp(`^(?:${f}{4})*(?:${f}{2,3}|${f}{3}=|${f}{2}==)?$`,"u"),(0,dM.pattern)(e,c)};Bs.base64=pM;var St={},xs={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=No,r=_r;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function i(d){return(0,t.is)(d,e.HexStruct)}e.isHexString=i;function a(d){return(0,t.is)(d,e.StrictHexStruct)}e.isStrictHexString=a;function s(d){(0,r.assert)(i(d),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function f(d){(0,r.assert)(a(d),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=f;function c(d){return d.startsWith("0x")?d:d.startsWith("0X")?`0x${d.substring(2)}`:`0x${d}`}e.add0x=c;function l(d){return d.startsWith("0x")||d.startsWith("0X")?d.substring(2):d}e.remove0x=l})(xs);Object.defineProperty(St,"__esModule",{value:!0});St.createDataView=St.concatBytes=St.valueToBytes=St.stringToBytes=St.numberToBytes=St.signedBigIntToBytes=St.bigIntToBytes=St.hexToBytes=St.bytesToString=St.bytesToNumber=St.bytesToSignedBigInt=St.bytesToBigInt=St.bytesToHex=St.assertIsBytes=St.isBytes=void 0;const Gr=_r,qh=xs,mb=48,Eb=58,Sb=87;function gM(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const yM=gM();function Gp(e){return e instanceof Uint8Array}St.isBytes=Gp;function Na(e){(0,Gr.assert)(Gp(e),"Value must be a Uint8Array.")}St.assertIsBytes=Na;function wm(e){if(Na(e),e.length===0)return"0x";const t=yM(),r=new Array(e.length);for(let i=0;i=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return nl(t)}St.bigIntToBytes=Em;function wM(e,t){(0,Gr.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function mM(e,t){(0,Gr.assert)(typeof e=="bigint","Value must be a bigint."),(0,Gr.assert)(typeof t=="number","Byte length must be a number."),(0,Gr.assert)(t>0,"Byte length must be greater than 0."),(0,Gr.assert)(wM(e,t),"Byte length is too small to represent the given value.");let r=e;const i=new Uint8Array(t);for(let a=0;a>=BigInt(8);return i.reverse()}St.signedBigIntToBytes=mM;function Sm(e){(0,Gr.assert)(typeof e=="number","Value must be a number."),(0,Gr.assert)(e>=0,"Value must be a non-negative number."),(0,Gr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return nl(t)}St.numberToBytes=Sm;function Rm(e){return(0,Gr.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}St.stringToBytes=Rm;function Am(e){if(typeof e=="bigint")return Em(e);if(typeof e=="number")return Sm(e);if(typeof e=="string")return e.startsWith("0x")?nl(e):Rm(e);if(Gp(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}St.valueToBytes=Am;function EM(e){const t=new Array(e.length);let r=0;for(let a=0;at.call(r,i,a,this))}get(t){return Ir(this,An,"f").get(t)}has(t){return Ir(this,An,"f").has(t)}keys(){return Ir(this,An,"f").keys()}values(){return Ir(this,An,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}ba.FrozenMap=Vp;class Zp{constructor(t){jn.set(this,void 0),Im(this,jn,new Set(t),"f"),Object.freeze(this)}get size(){return Ir(this,jn,"f").size}[(jn=new WeakMap,Symbol.iterator)](){return Ir(this,jn,"f")[Symbol.iterator]()}entries(){return Ir(this,jn,"f").entries()}forEach(t,r){return Ir(this,jn,"f").forEach((i,a,s)=>t.call(r,i,a,this))}has(t){return Ir(this,jn,"f").has(t)}keys(){return Ir(this,jn,"f").keys()}values(){return Ir(this,jn,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}ba.FrozenSet=Zp;Object.freeze(Vp);Object.freeze(Vp.prototype);Object.freeze(Zp);Object.freeze(Zp.prototype);var Pm={};Object.defineProperty(Pm,"__esModule",{value:!0});var Lm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=No,r=_r,i=()=>(0,t.define)("finite number",z=>(0,t.is)(z,(0,t.number)())&&Number.isFinite(z));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),i(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(z,q)=>{function ne(v,w){const J=[...w.validator(v,q)];return J.length>0?J:!0}try{const v=ne(z,e.UnsafeJsonStruct);return v!==!0?v:ne(JSON.parse(JSON.stringify(z)),e.UnsafeJsonStruct)}catch(v){return v instanceof RangeError?"Circular reference detected":!1}});function a(z){return(0,t.is)(z,e.JsonStruct)}e.isValidJson=a;function s(z){(0,r.assertStruct)(z,e.JsonStruct,"Invalid JSON value");const q=JSON.stringify(z);return new TextEncoder().encode(q).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function f(z){return(0,t.is)(z,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=f;function c(z,q){(0,r.assertStruct)(z,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",q)}e.assertIsJsonRpcNotification=c;function l(z){return(0,t.is)(z,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=l;function d(z,q){(0,r.assertStruct)(z,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",q)}e.assertIsJsonRpcRequest=d,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function h(z){return(0,t.is)(z,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=h;function b(z,q){(0,r.assertStruct)(z,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",q)}e.assertIsPendingJsonRpcResponse=b;function R(z){return(0,t.is)(z,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=R;function A(z,q){(0,r.assertStruct)(z,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",q)}e.assertIsJsonRpcResponse=A;function N(z){return(0,t.is)(z,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=N;function ae(z,q){(0,r.assertStruct)(z,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",q)}e.assertIsJsonRpcSuccess=ae;function K(z){return(0,t.is)(z,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=K;function I(z,q){(0,r.assertStruct)(z,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",q)}e.assertIsJsonRpcFailure=I;function y(z){return(0,t.is)(z,e.JsonRpcErrorStruct)}e.isJsonRpcError=y;function ie(z,q){(0,r.assertStruct)(z,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",q)}e.assertIsJsonRpcError=ie;function F(z){const{permitEmptyString:q,permitFractions:ne,permitNull:v}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},z);return E=>!!(typeof E=="number"&&(ne||Number.isInteger(E))||typeof E=="string"&&(q||E.length>0)||v&&E===null)}e.getJsonRpcIdValidator=F})(Lm);var Nm={};Object.defineProperty(Nm,"__esModule",{value:!0});var va={},Hh={exports:{}},Hd,Ab;function xM(){if(Ab)return Hd;Ab=1;var e=1e3,t=e*60,r=t*60,i=r*24,a=i*7,s=i*365.25;Hd=function(h,b){b=b||{};var R=typeof h;if(R==="string"&&h.length>0)return f(h);if(R==="number"&&isFinite(h))return b.long?l(h):c(h);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(h))};function f(h){if(h=String(h),!(h.length>100)){var b=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(h);if(b){var R=parseFloat(b[1]),A=(b[2]||"ms").toLowerCase();switch(A){case"years":case"year":case"yrs":case"yr":case"y":return R*s;case"weeks":case"week":case"w":return R*a;case"days":case"day":case"d":return R*i;case"hours":case"hour":case"hrs":case"hr":case"h":return R*r;case"minutes":case"minute":case"mins":case"min":case"m":return R*t;case"seconds":case"second":case"secs":case"sec":case"s":return R*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return R;default:return}}}}function c(h){var b=Math.abs(h);return b>=i?Math.round(h/i)+"d":b>=r?Math.round(h/r)+"h":b>=t?Math.round(h/t)+"m":b>=e?Math.round(h/e)+"s":h+"ms"}function l(h){var b=Math.abs(h);return b>=i?d(h,b,i,"day"):b>=r?d(h,b,r,"hour"):b>=t?d(h,b,t,"minute"):b>=e?d(h,b,e,"second"):h+" ms"}function d(h,b,R,A){var N=b>=R*1.5;return Math.round(h/R)+" "+A+(N?"s":"")}return Hd}function $M(e){r.debug=r,r.default=r,r.coerce=l,r.disable=s,r.enable=a,r.enabled=f,r.humanize=xM(),r.destroy=d,Object.keys(e).forEach(h=>{r[h]=e[h]}),r.names=[],r.skips=[],r.formatters={};function t(h){let b=0;for(let R=0;R{if(q==="%%")return"%";F++;const v=r.formatters[ne];if(typeof v=="function"){const w=K[F];q=v.call(I,w),K.splice(F,1),F--}return q}),r.formatArgs.call(I,K),(I.log||r.log).apply(I,K)}return ae.namespace=h,ae.useColors=r.useColors(),ae.color=r.selectColor(h),ae.extend=i,ae.destroy=r.destroy,Object.defineProperty(ae,"enabled",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(A!==r.namespaces&&(A=r.namespaces,N=r.enabled(h)),N),set:K=>{R=K}}),typeof r.init=="function"&&r.init(ae),ae}function i(h,b){const R=r(this.namespace+(typeof b>"u"?":":b)+h);return R.log=this.log,R}function a(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let b;const R=(typeof h=="string"?h:"").split(/[\s,]+/),A=R.length;for(b=0;b"-"+b)].join(",");return r.enable(""),h}function f(h){if(h[h.length-1]==="*")return!0;let b,R;for(b=0,R=r.skips.length;b{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;l.splice(1,0,d,"color: inherit");let h=0,b=0;l[0].replace(/%[a-zA-Z%]/g,R=>{R!=="%%"&&(h++,R==="%c"&&(b=h))}),l.splice(b,0,d)}t.log=console.debug||console.log||(()=>{});function a(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function s(){let l;try{l=t.storage.getItem("debug")}catch{}return!l&&typeof Ce.process<"u"&&"env"in Ce.process&&(l={}.DEBUG),l}function f(){try{return localStorage}catch{}}e.exports=MM(t);const{formatters:c}=e.exports;c.j=function(l){try{return JSON.stringify(l)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(Hh,Hh.exports);var DM=Hh.exports,jM=Qe&&Qe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(va,"__esModule",{value:!0});va.createModuleLogger=va.createProjectLogger=void 0;const FM=jM(DM),UM=(0,FM.default)("metamask");function kM(e){return UM.extend(e)}va.createProjectLogger=kM;function qM(e,t){return e.extend(t)}va.createModuleLogger=qM;var Cm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(d){return Array.isArray(d)&&d.length>0}e.isNonEmptyArray=t;function r(d){return d==null}e.isNullOrUndefined=r;function i(d){return!!d&&typeof d=="object"&&!Array.isArray(d)}e.isObject=i;const a=(d,h)=>Object.hasOwnProperty.call(d,h);e.hasProperty=a,function(d){d[d.Null=4]="Null",d[d.Comma=1]="Comma",d[d.Wrapper=1]="Wrapper",d[d.True=4]="True",d[d.False=5]="False",d[d.Quote=1]="Quote",d[d.Colon=1]="Colon",d[d.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(d){if(typeof d!="object"||d===null)return!1;try{let h=d;for(;Object.getPrototypeOf(h)!==null;)h=Object.getPrototypeOf(h);return Object.getPrototypeOf(d)===h}catch{return!1}}e.isPlainObject=s;function f(d){return d.charCodeAt(0)<=127}e.isASCII=f;function c(d){var h;return d.split("").reduce((R,A)=>f(A)?R+1:R+2,0)+((h=d.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&h!==void 0?h:[]).length}e.calculateStringSize=c;function l(d){return d.toString().length}e.calculateNumberSize=l})(Cm);var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});Hn.hexToBigInt=Hn.hexToNumber=Hn.bigIntToHex=Hn.numberToHex=void 0;const ha=_r,Rs=xs,HM=e=>((0,ha.assert)(typeof e=="number","Value must be a number."),(0,ha.assert)(e>=0,"Value must be a non-negative number."),(0,ha.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Rs.add0x)(e.toString(16)));Hn.numberToHex=HM;const WM=e=>((0,ha.assert)(typeof e=="bigint","Value must be a bigint."),(0,ha.assert)(e>=0,"Value must be a non-negative bigint."),(0,Rs.add0x)(e.toString(16)));Hn.bigIntToHex=WM;const zM=e=>{(0,Rs.assertIsHexString)(e);const t=parseInt(e,16);return(0,ha.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};Hn.hexToNumber=zM;const GM=e=>((0,Rs.assertIsHexString)(e),BigInt((0,Rs.add0x)(e)));Hn.hexToBigInt=GM;var Bm={};Object.defineProperty(Bm,"__esModule",{value:!0});var xm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,r=(s,f)=>{if(!t(s))throw new Error(`"${f}" must be a non-negative integer. Received: "${s}".`)};function i(s,f){return r(s,"count"),s*f}e.inMilliseconds=i;function a(s){return r(s,"timestamp"),Date.now()-s}e.timeSince=a})(xm);var $m={};Object.defineProperty($m,"__esModule",{value:!0});var Mm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=oB,r=No,i=_r;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",b=>(0,t.valid)(b)===null?`Expected SemVer version, got "${b}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",b=>(0,t.validRange)(b)===null?`Expected SemVer range, got "${b}"`:!0);function a(b){return(0,r.is)(b,e.VersionStruct)}e.isValidSemVerVersion=a;function s(b){return(0,r.is)(b,e.VersionRangeStruct)}e.isValidSemVerRange=s;function f(b){(0,i.assertStruct)(b,e.VersionStruct)}e.assertIsSemVerVersion=f;function c(b){(0,i.assertStruct)(b,e.VersionRangeStruct)}e.assertIsSemVerRange=c;function l(b,R){return(0,t.gt)(b,R)}e.gtVersion=l;function d(b,R){return(0,t.gtr)(b,R)}e.gtRange=d;function h(b,R){return(0,t.satisfies)(b,R,{includePrerelease:!0})}e.satisfiesVersionRange=h})(Mm);(function(e){var t=Qe&&Qe.__createBinding||(Object.create?function(i,a,s,f){f===void 0&&(f=s);var c=Object.getOwnPropertyDescriptor(a,s);(!c||("get"in c?!a.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return a[s]}}),Object.defineProperty(i,f,c)}:function(i,a,s,f){f===void 0&&(f=s),i[f]=a[s]}),r=Qe&&Qe.__exportStar||function(i,a){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(a,s)&&t(a,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(_r,e),r(Bs,e),r(St,e),r(il,e),r(qn,e),r(ba,e),r(Pm,e),r(xs,e),r(Lm,e),r(Nm,e),r(va,e),r(Cm,e),r(Hn,e),r(Bm,e),r(xm,e),r($m,e),r(Mm,e)})(Fp);var al={},Ui={};Object.defineProperty(Ui,"__esModule",{value:!0});Ui.errorValues=Ui.errorCodes=void 0;Ui.errorCodes={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}};Ui.errorValues={"-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."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeCause=e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Fp,r=Ui,i=r.errorCodes.rpc.internal,a="Unspecified error message. This is a bug, please report it.",s={code:i,message:f(i)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function f(A,N=a){if(c(A)){const ae=A.toString();if((0,t.hasProperty)(r.errorValues,ae))return r.errorValues[ae].message;if(h(A))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return N}e.getMessageFromCode=f;function c(A){return Number.isInteger(A)}e.isValidCode=c;function l(A,{fallbackError:N=s,shouldIncludeStack:ae=!0}={}){if(!(0,t.isJsonRpcError)(N))throw new Error("Must provide fallback error with integer number code and string message.");const K=d(A,N);return ae||delete K.stack,K}e.serializeError=l;function d(A,N){if(A&&typeof A=="object"&&"serialize"in A&&typeof A.serialize=="function")return A.serialize();if((0,t.isJsonRpcError)(A))return A;const ae=b(A);return{...N,data:{cause:ae}}}function h(A){return A>=-32099&&A<=-32e3}function b(A){return Array.isArray(A)?A.map(N=>(0,t.isValidJson)(N)?N:(0,t.isObject)(N)?R(N):null):(0,t.isObject)(A)?R(A):(0,t.isValidJson)(A)?A:null}e.serializeCause=b;function R(A){return Object.getOwnPropertyNames(A).reduce((N,ae)=>{const K=A[ae];return(0,t.isValidJson)(K)&&(N[ae]=K),N},{})}})(al);var VM=Qe&&Qe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.EthereumProviderError=Ro.JsonRpcError=void 0;const ZM=Fp,KM=VM(jp),JM=al;class Dm extends Error{constructor(t,r,i){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a non-empty string.');super(r),this.code=t,i!==void 0&&(this.data=i)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data,(0,ZM.isPlainObject)(this.data)&&(t.data.cause=(0,JM.serializeCause)(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return(0,KM.default)(this.serialize(),QM,2)}}Ro.JsonRpcError=Dm;let XM=class extends Dm{constructor(t,r,i){if(!YM(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,i)}};Ro.EthereumProviderError=XM;function YM(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function QM(e,t){if(t!=="[Circular]")return t}var wa={};Object.defineProperty(wa,"__esModule",{value:!0});wa.providerErrors=wa.rpcErrors=void 0;const Kp=Ro,Er=Ui,jm=al;wa.rpcErrors={parse:e=>on(Er.errorCodes.rpc.parse,e),invalidRequest:e=>on(Er.errorCodes.rpc.invalidRequest,e),invalidParams:e=>on(Er.errorCodes.rpc.invalidParams,e),methodNotFound:e=>on(Er.errorCodes.rpc.methodNotFound,e),internal:e=>on(Er.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return on(t,e)},invalidInput:e=>on(Er.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>on(Er.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>on(Er.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>on(Er.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>on(Er.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>on(Er.errorCodes.rpc.limitExceeded,e)};wa.providerErrors={userRejectedRequest:e=>os(Er.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>os(Er.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>os(Er.errorCodes.provider.unsupportedMethod,e),disconnected:e=>os(Er.errorCodes.provider.disconnected,e),chainDisconnected:e=>os(Er.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Kp.EthereumProviderError(t,r,i)}};function on(e,t){const[r,i]=Fm(t);return new Kp.JsonRpcError(e,r??(0,jm.getMessageFromCode)(e),i)}function os(e,t){const[r,i]=Fm(t);return new Kp.EthereumProviderError(e,r??(0,jm.getMessageFromCode)(e),i)}function Fm(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t??void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorCodes=e.providerErrors=e.rpcErrors=e.getMessageFromCode=e.serializeError=e.serializeCause=e.EthereumProviderError=e.JsonRpcError=void 0;var t=Ro;Object.defineProperty(e,"JsonRpcError",{enumerable:!0,get:function(){return t.JsonRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});var r=al;Object.defineProperty(e,"serializeCause",{enumerable:!0,get:function(){return r.serializeCause}}),Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});var i=wa;Object.defineProperty(e,"rpcErrors",{enumerable:!0,get:function(){return i.rpcErrors}}),Object.defineProperty(e,"providerErrors",{enumerable:!0,get:function(){return i.providerErrors}});var a=Ui;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return a.errorCodes}})})(v3);var Jp={exports:{}},eD=Um;function Um(e,t){if(e&&t)return Um(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(i){r[i]=e[i]}),r;function r(){for(var i=new Array(arguments.length),a=0;a0;return pD(a,f,c,function(l){r||(r=l),l&&i.forEach(Ob),!f&&(i.forEach(Ob),t(r))})});return e.reduce(gD)},_D=yD;const Ib=vi(_D);var Ln={},ki={};Object.defineProperty(ki,"__esModule",{value:!0});ki.EthereumProviderError=ki.EthereumRpcError=void 0;const bD=jp;class zm extends Error{constructor(t,r,i){if(!Number.isInteger(t))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=t,i!==void 0&&(this.data=i)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return bD.default(this.serialize(),mD,2)}}ki.EthereumRpcError=zm;class vD extends zm{constructor(t,r,i){if(!wD(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,i)}}ki.EthereumProviderError=vD;function wD(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function mD(e,t){if(t!=="[Circular]")return t}var Yp={},qi={};Object.defineProperty(qi,"__esModule",{value:!0});qi.errorValues=qi.errorCodes=void 0;qi.errorCodes={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}};qi.errorValues={"-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."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=qi,r=ki,i=t.errorCodes.rpc.internal,a="Unspecified error message. This is a bug, please report it.",s={code:i,message:f(i)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function f(R,A=a){if(Number.isInteger(R)){const N=R.toString();if(b(t.errorValues,N))return t.errorValues[N].message;if(d(R))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return A}e.getMessageFromCode=f;function c(R){if(!Number.isInteger(R))return!1;const A=R.toString();return!!(t.errorValues[A]||d(R))}e.isValidCode=c;function l(R,{fallbackError:A=s,shouldIncludeStack:N=!1}={}){var ae,K;if(!A||!Number.isInteger(A.code)||typeof A.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(R instanceof r.EthereumRpcError)return R.serialize();const I={};if(R&&typeof R=="object"&&!Array.isArray(R)&&b(R,"code")&&c(R.code)){const ie=R;I.code=ie.code,ie.message&&typeof ie.message=="string"?(I.message=ie.message,b(ie,"data")&&(I.data=ie.data)):(I.message=f(I.code),I.data={originalError:h(R)})}else{I.code=A.code;const ie=(ae=R)===null||ae===void 0?void 0:ae.message;I.message=ie&&typeof ie=="string"?ie:A.message,I.data={originalError:h(R)}}const y=(K=R)===null||K===void 0?void 0:K.stack;return N&&R&&y&&typeof y=="string"&&(I.stack=y),I}e.serializeError=l;function d(R){return R>=-32099&&R<=-32e3}function h(R){return R&&typeof R=="object"&&!Array.isArray(R)?Object.assign({},R):R}function b(R,A){return Object.prototype.hasOwnProperty.call(R,A)}})(Yp);var fl={};Object.defineProperty(fl,"__esModule",{value:!0});fl.ethErrors=void 0;const Qp=ki,Gm=Yp,mr=qi;fl.ethErrors={rpc:{parse:e=>an(mr.errorCodes.rpc.parse,e),invalidRequest:e=>an(mr.errorCodes.rpc.invalidRequest,e),invalidParams:e=>an(mr.errorCodes.rpc.invalidParams,e),methodNotFound:e=>an(mr.errorCodes.rpc.methodNotFound,e),internal:e=>an(mr.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return an(t,e)},invalidInput:e=>an(mr.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>an(mr.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>an(mr.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>an(mr.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>an(mr.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>an(mr.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>as(mr.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>as(mr.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>as(mr.errorCodes.provider.unsupportedMethod,e),disconnected:e=>as(mr.errorCodes.provider.disconnected,e),chainDisconnected:e=>as(mr.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Qp.EthereumProviderError(t,r,i)}}};function an(e,t){const[r,i]=Vm(t);return new Qp.EthereumRpcError(e,r||Gm.getMessageFromCode(e),i)}function as(e,t){const[r,i]=Vm(t);return new Qp.EthereumProviderError(e,r||Gm.getMessageFromCode(e),i)}function Vm(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=ki;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Yp;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const i=fl;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return i.ethErrors}});const a=qi;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return a.errorCodes}})})(Ln);var ED=SD;function SD(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const RD=vi(ED);var AD={},ul={},ll={},Zm={},ma={},cl={},cr={};Object.defineProperty(cr,"__esModule",{value:!0});cr.output=cr.exists=cr.hash=cr.bytes=cr.bool=cr.number=void 0;function Ru(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}cr.number=Ru;function Km(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}cr.bool=Km;function eg(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}cr.bytes=eg;function Jm(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ru(e.outputLen),Ru(e.blockLen)}cr.hash=Jm;function Xm(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}cr.exists=Xm;function Ym(e,t){eg(e);const r=t.outputLen;if(e.lengthq instanceof Uint8Array,i=q=>new Uint8Array(q.buffer,q.byteOffset,q.byteLength);e.u8=i;const a=q=>new Uint32Array(q.buffer,q.byteOffset,Math.floor(q.byteLength/4));e.u32=a;const s=q=>new DataView(q.buffer,q.byteOffset,q.byteLength);e.createView=s;const f=(q,ne)=>q<<32-ne|q>>>ne;if(e.rotr=f,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const c=Array.from({length:256},(q,ne)=>ne.toString(16).padStart(2,"0"));function l(q){if(!r(q))throw new Error("Uint8Array expected");let ne="";for(let v=0;v{};e.nextTick=h;async function b(q,ne,v){let w=Date.now();for(let E=0;E=0&&Jw+E.length,0));let v=0;return q.forEach(w=>{if(!r(w))throw new Error("Uint8Array expected");ne.set(w,v),v+=w.length}),ne}e.concatBytes=N;class ae{clone(){return this._cloneInto()}}e.Hash=ae;const K=q=>Object.prototype.toString.call(q)==="[object Object]"&&q.constructor===Object;function I(q,ne){if(ne!==void 0&&(typeof ne!="object"||!K(ne)))throw new Error("Options should be object or undefined");return Object.assign(q,ne)}e.checkOpts=I;function y(q){const ne=w=>q().update(A(w)).digest(),v=q();return ne.outputLen=v.outputLen,ne.blockLen=v.blockLen,ne.create=()=>q(),ne}e.wrapConstructor=y;function ie(q){const ne=(w,E)=>q(E).update(A(w)).digest(),v=q({});return ne.outputLen=v.outputLen,ne.blockLen=v.blockLen,ne.create=w=>q(w),ne}e.wrapConstructorWithOpts=ie;function F(q){const ne=(w,E)=>q(E).update(A(w)).digest(),v=q({});return ne.outputLen=v.outputLen,ne.blockLen=v.blockLen,ne.create=w=>q(w),ne}e.wrapXOFConstructorWithOpts=F;function z(q=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(q));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=z})(bi);Object.defineProperty(cl,"__esModule",{value:!0});cl.SHA2=void 0;const zd=cr,ss=bi;function OD(e,t,r,i){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,i);const a=BigInt(32),s=BigInt(4294967295),f=Number(r>>a&s),c=Number(r&s),l=i?4:0,d=i?0:4;e.setUint32(t+l,f,i),e.setUint32(t+d,c,i)}class ID extends ss.Hash{constructor(t,r,i,a){super(),this.blockLen=t,this.outputLen=r,this.padOffset=i,this.isLE=a,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,ss.createView)(this.buffer)}update(t){zd.default.exists(this);const{view:r,buffer:i,blockLen:a}=this;t=(0,ss.toBytes)(t);const s=t.length;for(let f=0;fa-f&&(this.process(i,0),f=0);for(let b=f;bh.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;be&t^~e&r,ND=(e,t,r)=>e&t^e&r^t&r,CD=new Uint32Array([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]),$i=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mi=new Uint32Array(64);class Qm extends PD.SHA2{constructor(){super(64,32,8,!1),this.A=$i[0]|0,this.B=$i[1]|0,this.C=$i[2]|0,this.D=$i[3]|0,this.E=$i[4]|0,this.F=$i[5]|0,this.G=$i[6]|0,this.H=$i[7]|0}get(){const{A:t,B:r,C:i,D:a,E:s,F:f,G:c,H:l}=this;return[t,r,i,a,s,f,c,l]}set(t,r,i,a,s,f,c,l){this.A=t|0,this.B=r|0,this.C=i|0,this.D=a|0,this.E=s|0,this.F=f|0,this.G=c|0,this.H=l|0}process(t,r){for(let b=0;b<16;b++,r+=4)Mi[b]=t.getUint32(r,!1);for(let b=16;b<64;b++){const R=Mi[b-15],A=Mi[b-2],N=(0,ln.rotr)(R,7)^(0,ln.rotr)(R,18)^R>>>3,ae=(0,ln.rotr)(A,17)^(0,ln.rotr)(A,19)^A>>>10;Mi[b]=ae+Mi[b-7]+N+Mi[b-16]|0}let{A:i,B:a,C:s,D:f,E:c,F:l,G:d,H:h}=this;for(let b=0;b<64;b++){const R=(0,ln.rotr)(c,6)^(0,ln.rotr)(c,11)^(0,ln.rotr)(c,25),A=h+R+LD(c,l,d)+CD[b]+Mi[b]|0,ae=((0,ln.rotr)(i,2)^(0,ln.rotr)(i,13)^(0,ln.rotr)(i,22))+ND(i,a,s)|0;h=d,d=l,l=c,c=f+A|0,f=s,s=a,a=i,i=A+ae|0}i=i+this.A|0,a=a+this.B|0,s=s+this.C|0,f=f+this.D|0,c=c+this.E|0,l=l+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(i,a,s,f,c,l,d,h)}roundClean(){Mi.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class BD extends Qm{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}ma.sha256=(0,ln.wrapConstructor)(()=>new Qm);ma.sha224=(0,ln.wrapConstructor)(()=>new BD);var _t={},at={};Object.defineProperty(at,"__esModule",{value:!0});at.validateObject=at.createHmacDrbg=at.bitMask=at.bitSet=at.bitGet=at.bitLen=at.utf8ToBytes=at.equalBytes=at.concatBytes=at.ensureBytes=at.numberToVarBytesBE=at.numberToBytesLE=at.numberToBytesBE=at.bytesToNumberLE=at.bytesToNumberBE=at.hexToBytes=at.hexToNumber=at.numberToHexUnpadded=at.bytesToHex=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const eE=BigInt(0),hl=BigInt(1),xD=BigInt(2),pl=e=>e instanceof Uint8Array,$D=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tg(e){if(!pl(e))throw new Error("Uint8Array expected");let t="";for(let r=0;ri+a.length,0));let r=0;return e.forEach(i=>{if(!pl(i))throw new Error("Uint8Array expected");t.set(i,r),r+=i.length}),t}at.concatBytes=nE;function kD(e,t){if(e.length!==t.length)return!1;for(let r=0;reE;e>>=hl,t+=1);return t}at.bitLen=HD;function WD(e,t){return e>>BigInt(t)&hl}at.bitGet=WD;const zD=(e,t,r)=>e|(r?hl:eE)<(xD<new Uint8Array(e),Pb=e=>Uint8Array.from(e);function VD(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let i=Gd(e),a=Gd(e),s=0;const f=()=>{i.fill(1),a.fill(0),s=0},c=(...b)=>r(a,i,...b),l=(b=Gd())=>{a=c(Pb([0]),b),i=c(),b.length!==0&&(a=c(Pb([1]),b),i=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let b=0;const R=[];for(;b{f(),l(b);let A;for(;!(A=R(d()));)l();return f(),A}}at.createHmacDrbg=VD;const ZD={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function KD(e,t,r={}){const i=(a,s,f)=>{const c=ZD[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);const l=e[a];if(!(f&&l===void 0)&&!c(l,e))throw new Error(`Invalid param ${String(a)}=${l} (${typeof l}), expected ${s}`)};for(const[a,s]of Object.entries(t))i(a,s,!1);for(const[a,s]of Object.entries(r))i(a,s,!0);return e}at.validateObject=KD;Object.defineProperty(_t,"__esModule",{value:!0});_t.hashToPrivateScalar=_t.FpSqrtEven=_t.FpSqrtOdd=_t.Field=_t.nLength=_t.FpIsSquare=_t.FpDiv=_t.FpInvertBatch=_t.FpPow=_t.validateField=_t.isNegativeLE=_t.FpSqrt=_t.tonelliShanks=_t.invert=_t.pow2=_t.pow=_t.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pi=at,dr=BigInt(0),zt=BigInt(1),Fi=BigInt(2),JD=BigInt(3),Wh=BigInt(4),Lb=BigInt(5),Nb=BigInt(8);BigInt(9);BigInt(16);function cn(e,t){const r=e%t;return r>=dr?r:t+r}_t.mod=cn;function iE(e,t,r){if(r<=dr||t 0");if(r===zt)return dr;let i=zt;for(;t>dr;)t&zt&&(i=i*e%r),e=e*e%r,t>>=zt;return i}_t.pow=iE;function XD(e,t,r){let i=e;for(;t-- >dr;)i*=i,i%=r;return i}_t.pow2=XD;function Au(e,t){if(e===dr||t<=dr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=cn(e,t),i=t,a=dr,s=zt;for(;r!==dr;){const c=i/r,l=i%r,d=a-s*c;i=r,r=l,a=s,s=d}if(i!==zt)throw new Error("invert: does not exist");return cn(a,t)}_t.invert=Au;function oE(e){const t=(e-zt)/Fi;let r,i,a;for(r=e-zt,i=0;r%Fi===dr;r/=Fi,i++);for(a=Fi;a(cn(e,t)&zt)===zt;_t.isNegativeLE=YD;const QD=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ej(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=QD.reduce((i,a)=>(i[a]="function",i),t);return(0,pi.validateObject)(e,r)}_t.validateField=ej;function sE(e,t,r){if(r 0");if(r===dr)return e.ONE;if(r===zt)return t;let i=e.ONE,a=t;for(;r>dr;)r&zt&&(i=e.mul(i,a)),a=e.sqr(a),r>>=zt;return i}_t.FpPow=sE;function fE(e,t){const r=new Array(t.length),i=t.reduce((s,f,c)=>e.is0(f)?s:(r[c]=s,e.mul(s,f)),e.ONE),a=e.inv(i);return t.reduceRight((s,f,c)=>e.is0(f)?s:(r[c]=e.mul(s,r[c]),e.mul(s,f)),a),r}_t.FpInvertBatch=fE;function tj(e,t,r){return e.mul(t,typeof r=="bigint"?Au(r,e.ORDER):e.inv(r))}_t.FpDiv=tj;function rj(e){const t=(e.ORDER-zt)/Fi;return r=>{const i=e.pow(r,t);return e.eql(i,e.ZERO)||e.eql(i,e.ONE)}}_t.FpIsSquare=rj;function ng(e,t){const r=t!==void 0?t:e.toString(2).length,i=Math.ceil(r/8);return{nBitLength:r,nByteLength:i}}_t.nLength=ng;function nj(e,t,r=!1,i={}){if(e<=dr)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:a,nByteLength:s}=ng(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const f=aE(e),c=Object.freeze({ORDER:e,BITS:a,BYTES:s,MASK:(0,pi.bitMask)(a),ZERO:dr,ONE:zt,create:l=>cn(l,e),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return dr<=l&&ll===dr,isOdd:l=>(l&zt)===zt,neg:l=>cn(-l,e),eql:(l,d)=>l===d,sqr:l=>cn(l*l,e),add:(l,d)=>cn(l+d,e),sub:(l,d)=>cn(l-d,e),mul:(l,d)=>cn(l*d,e),pow:(l,d)=>sE(c,l,d),div:(l,d)=>cn(l*Au(d,e),e),sqrN:l=>l*l,addN:(l,d)=>l+d,subN:(l,d)=>l-d,mulN:(l,d)=>l*d,inv:l=>Au(l,e),sqrt:i.sqrt||(l=>f(c,l)),invertBatch:l=>fE(c,l),cmov:(l,d,h)=>h?d:l,toBytes:l=>r?(0,pi.numberToBytesLE)(l,s):(0,pi.numberToBytesBE)(l,s),fromBytes:l=>{if(l.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${l.length}`);return r?(0,pi.bytesToNumberLE)(l):(0,pi.bytesToNumberBE)(l)}});return Object.freeze(c)}_t.Field=nj;function ij(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)}_t.FpSqrtOdd=ij;function oj(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}_t.FpSqrtEven=oj;function aj(e,t,r=!1){e=(0,pi.ensureBytes)("privateHash",e);const i=e.length,a=ng(t).nByteLength+8;if(a<24||i1024)throw new Error(`hashToPrivateScalar: expected ${a}-1024 bytes of input, got ${i}`);const s=r?(0,pi.bytesToNumberLE)(e):(0,pi.bytesToNumberBE)(e);return cn(s,t-zt)+zt}_t.hashToPrivateScalar=aj;var ig={},Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.validateBasic=Ea.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Cb=_t,sj=at,fj=BigInt(0),Vd=BigInt(1);function uj(e,t){const r=(a,s)=>{const f=s.negate();return a?f:s},i=a=>{const s=Math.ceil(t/a)+1,f=2**(a-1);return{windows:s,windowSize:f}};return{constTimeNegate:r,unsafeLadder(a,s){let f=e.ZERO,c=a;for(;s>fj;)s&Vd&&(f=f.add(c)),c=c.double(),s>>=Vd;return f},precomputeWindow(a,s){const{windows:f,windowSize:c}=i(s),l=[];let d=a,h=d;for(let b=0;b>=A,K>l&&(K-=R,f+=Vd);const I=ae,y=ae+Math.abs(K)-1,ie=N%2!==0,F=K<0;K===0?h=h.add(r(ie,s[I])):d=d.add(r(F,s[y]))}return{p:d,f:h}},wNAFCached(a,s,f,c){const l=a._WINDOW_SIZE||1;let d=s.get(a);return d||(d=this.precomputeWindow(a,l),l!==1&&s.set(a,c(d))),this.wNAF(l,d,f)}}}Ea.wNAF=uj;function lj(e){return(0,Cb.validateField)(e.Fp),(0,sj.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Cb.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}Ea.validateBasic=lj;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapToCurveSimpleSWU=e.SWUFpSqrtRatio=e.weierstrass=e.weierstrassPoints=e.DER=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=_t,r=at,i=at,a=Ea;function s(y){const ie=(0,a.validateBasic)(y);r.validateObject(ie,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:F,Fp:z,a:q}=ie;if(F){if(!z.eql(q,z.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof F!="object"||typeof F.beta!="bigint"||typeof F.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...ie})}const{bytesToNumberBE:f,hexToBytes:c}=r;e.DER={Err:class extends Error{constructor(ie=""){super(ie)}},_parseInt(y){const{Err:ie}=e.DER;if(y.length<2||y[0]!==2)throw new ie("Invalid signature integer tag");const F=y[1],z=y.subarray(2,F+2);if(!F||z.length!==F)throw new ie("Invalid signature integer: wrong length");if(z[0]&128)throw new ie("Invalid signature integer: negative");if(z[0]===0&&!(z[1]&128))throw new ie("Invalid signature integer: unnecessary leading zero");return{d:f(z),l:y.subarray(F+2)}},toSig(y){const{Err:ie}=e.DER,F=typeof y=="string"?c(y):y;if(!(F instanceof Uint8Array))throw new Error("ui8a expected");let z=F.length;if(z<2||F[0]!=48)throw new ie("Invalid signature tag");if(F[1]!==z-2)throw new ie("Invalid signature: incorrect length");const{d:q,l:ne}=e.DER._parseInt(F.subarray(2)),{d:v,l:w}=e.DER._parseInt(ne);if(w.length)throw new ie("Invalid signature: left bytes after parsing");return{r:q,s:v}},hexFromSig(y){const ie=J=>Number.parseInt(J[0],16)&8?"00"+J:J,F=J=>{const _=J.toString(16);return _.length&1?`0${_}`:_},z=ie(F(y.s)),q=ie(F(y.r)),ne=z.length/2,v=q.length/2,w=F(ne),E=F(v);return`30${F(v+ne+4)}02${E}${q}02${w}${z}`}};const l=BigInt(0),d=BigInt(1),h=BigInt(2),b=BigInt(3),R=BigInt(4);function A(y){const ie=s(y),{Fp:F}=ie,z=ie.toBytes||((H,M,W)=>{const P=M.toAffine();return r.concatBytes(Uint8Array.from([4]),F.toBytes(P.x),F.toBytes(P.y))}),q=ie.fromBytes||(H=>{const M=H.subarray(1),W=F.fromBytes(M.subarray(0,F.BYTES)),P=F.fromBytes(M.subarray(F.BYTES,2*F.BYTES));return{x:W,y:P}});function ne(H){const{a:M,b:W}=ie,P=F.sqr(H),T=F.mul(P,H);return F.add(F.add(T,F.mul(H,M)),W)}if(!F.eql(F.sqr(ie.Gy),ne(ie.Gx)))throw new Error("bad generator point: equation left != right");function v(H){return typeof H=="bigint"&&lF.eql(re,F.ZERO);return T(W)&&T(P)?m.ZERO:new m(W,P,F.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(M){const W=F.invertBatch(M.map(P=>P.pz));return M.map((P,T)=>P.toAffine(W[T])).map(m.fromAffine)}static fromHex(M){const W=m.fromAffine(q((0,i.ensureBytes)("pointHex",M)));return W.assertValidity(),W}static fromPrivateKey(M){return m.BASE.multiply(E(M))}_setWindowSize(M){this._WINDOW_SIZE=M,J.delete(this)}assertValidity(){if(this.is0()){if(ie.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:M,y:W}=this.toAffine();if(!F.isValid(M)||!F.isValid(W))throw new Error("bad point: x or y not FE");const P=F.sqr(W),T=ne(M);if(!F.eql(P,T))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:M}=this.toAffine();if(F.isOdd)return!F.isOdd(M);throw new Error("Field doesn't support isOdd")}equals(M){_(M);const{px:W,py:P,pz:T}=this,{px:re,py:j,pz:Q}=M,se=F.eql(F.mul(W,Q),F.mul(re,T)),de=F.eql(F.mul(P,Q),F.mul(j,T));return se&&de}negate(){return new m(this.px,F.neg(this.py),this.pz)}double(){const{a:M,b:W}=ie,P=F.mul(W,b),{px:T,py:re,pz:j}=this;let Q=F.ZERO,se=F.ZERO,de=F.ZERO,X=F.mul(T,T),D=F.mul(re,re),$=F.mul(j,j),te=F.mul(T,re);return te=F.add(te,te),de=F.mul(T,j),de=F.add(de,de),Q=F.mul(M,de),se=F.mul(P,$),se=F.add(Q,se),Q=F.sub(D,se),se=F.add(D,se),se=F.mul(Q,se),Q=F.mul(te,Q),de=F.mul(P,de),$=F.mul(M,$),te=F.sub(X,$),te=F.mul(M,te),te=F.add(te,de),de=F.add(X,X),X=F.add(de,X),X=F.add(X,$),X=F.mul(X,te),se=F.add(se,X),$=F.mul(re,j),$=F.add($,$),X=F.mul($,te),Q=F.sub(Q,X),de=F.mul($,D),de=F.add(de,de),de=F.add(de,de),new m(Q,se,de)}add(M){_(M);const{px:W,py:P,pz:T}=this,{px:re,py:j,pz:Q}=M;let se=F.ZERO,de=F.ZERO,X=F.ZERO;const D=ie.a,$=F.mul(ie.b,b);let te=F.mul(W,re),ue=F.mul(P,j),B=F.mul(T,Q),U=F.add(W,P),C=F.add(re,j);U=F.mul(U,C),C=F.add(te,ue),U=F.sub(U,C),C=F.add(W,T);let G=F.add(re,Q);return C=F.mul(C,G),G=F.add(te,B),C=F.sub(C,G),G=F.add(P,T),se=F.add(j,Q),G=F.mul(G,se),se=F.add(ue,B),G=F.sub(G,se),X=F.mul(D,C),se=F.mul($,B),X=F.add(se,X),se=F.sub(ue,X),X=F.add(ue,X),de=F.mul(se,X),ue=F.add(te,te),ue=F.add(ue,te),B=F.mul(D,B),C=F.mul($,C),ue=F.add(ue,B),B=F.sub(te,B),B=F.mul(D,B),C=F.add(C,B),te=F.mul(ue,C),de=F.add(de,te),te=F.mul(G,C),se=F.mul(U,se),se=F.sub(se,te),te=F.mul(U,ue),X=F.mul(G,X),X=F.add(X,te),new m(se,de,X)}subtract(M){return this.add(M.negate())}is0(){return this.equals(m.ZERO)}wNAF(M){return L.wNAFCached(this,J,M,W=>{const P=F.invertBatch(W.map(T=>T.pz));return W.map((T,re)=>T.toAffine(P[re])).map(m.fromAffine)})}multiplyUnsafe(M){const W=m.ZERO;if(M===l)return W;if(w(M),M===d)return this;const{endo:P}=ie;if(!P)return L.unsafeLadder(this,M);let{k1neg:T,k1:re,k2neg:j,k2:Q}=P.splitScalar(M),se=W,de=W,X=this;for(;re>l||Q>l;)re&d&&(se=se.add(X)),Q&d&&(de=de.add(X)),X=X.double(),re>>=d,Q>>=d;return T&&(se=se.negate()),j&&(de=de.negate()),de=new m(F.mul(de.px,P.beta),de.py,de.pz),se.add(de)}multiply(M){w(M);let W=M,P,T;const{endo:re}=ie;if(re){const{k1neg:j,k1:Q,k2neg:se,k2:de}=re.splitScalar(W);let{p:X,f:D}=this.wNAF(Q),{p:$,f:te}=this.wNAF(de);X=L.constTimeNegate(j,X),$=L.constTimeNegate(se,$),$=new m(F.mul($.px,re.beta),$.py,$.pz),P=X.add($),T=D.add(te)}else{const{p:j,f:Q}=this.wNAF(W);P=j,T=Q}return m.normalizeZ([P,T])[0]}multiplyAndAddUnsafe(M,W,P){const T=m.BASE,re=(Q,se)=>se===l||se===d||!Q.equals(T)?Q.multiplyUnsafe(se):Q.multiply(se),j=re(this,W).add(re(M,P));return j.is0()?void 0:j}toAffine(M){const{px:W,py:P,pz:T}=this,re=this.is0();M==null&&(M=re?F.ONE:F.inv(T));const j=F.mul(W,M),Q=F.mul(P,M),se=F.mul(T,M);if(re)return{x:F.ZERO,y:F.ZERO};if(!F.eql(se,F.ONE))throw new Error("invZ was invalid");return{x:j,y:Q}}isTorsionFree(){const{h:M,isTorsionFree:W}=ie;if(M===d)return!0;if(W)return W(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:M,clearCofactor:W}=ie;return M===d?this:W?W(m,this):this.multiplyUnsafe(ie.h)}toRawBytes(M=!0){return this.assertValidity(),z(m,this,M)}toHex(M=!0){return r.bytesToHex(this.toRawBytes(M))}}m.BASE=new m(ie.Gx,ie.Gy,F.ONE),m.ZERO=new m(F.ZERO,F.ONE,F.ZERO);const S=ie.nBitLength,L=(0,a.wNAF)(m,ie.endo?Math.ceil(S/2):S);return{CURVE:ie,ProjectivePoint:m,normPrivateKeyToScalar:E,weierstrassEquation:ne,isWithinCurveOrder:v}}e.weierstrassPoints=A;function N(y){const ie=(0,a.validateBasic)(y);return r.validateObject(ie,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...ie})}function ae(y){const ie=N(y),{Fp:F,n:z}=ie,q=F.BYTES+1,ne=2*F.BYTES+1;function v(C){return lr.bytesToHex(r.numberToBytesBE(C,ie.nByteLength));function H(C){const G=z>>d;return C>G}function M(C){return H(C)?w(-C):C}const W=(C,G,ce)=>r.bytesToNumberBE(C.slice(G,ce));class P{constructor(G,ce,Re){this.r=G,this.s=ce,this.recovery=Re,this.assertValidity()}static fromCompact(G){const ce=ie.nByteLength;return G=(0,i.ensureBytes)("compactSignature",G,ce*2),new P(W(G,0,ce),W(G,ce,2*ce))}static fromDER(G){const{r:ce,s:Re}=e.DER.toSig((0,i.ensureBytes)("DER",G));return new P(ce,Re)}assertValidity(){if(!S(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!S(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(G){return new P(this.r,this.s,G)}recoverPublicKey(G){const{r:ce,s:Re,recovery:Se}=this,De=de((0,i.ensureBytes)("msgHash",G));if(Se==null||![0,1,2,3].includes(Se))throw new Error("recovery id invalid");const me=Se===2||Se===3?ce+ie.n:ce;if(me>=F.ORDER)throw new Error("recovery id 2 or 3 invalid");const Ye=Se&1?"03":"02",Je=J.fromHex(Ye+L(me)),rt=E(me),et=w(-De*rt),ye=w(Re*rt),O=J.BASE.multiplyAndAddUnsafe(Je,et,ye);if(!O)throw new Error("point at infinify");return O.assertValidity(),O}hasHighS(){return H(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,w(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return L(this.r)+L(this.s)}}const T={isValidPrivateKey(C){try{return _(C),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const C=ie.randomBytes(F.BYTES+8),G=t.hashToPrivateScalar(C,z);return r.numberToBytesBE(G,ie.nByteLength)},precompute(C=8,G=J.BASE){return G._setWindowSize(C),G.multiply(BigInt(3)),G}};function re(C,G=!0){return J.fromPrivateKey(C).toRawBytes(G)}function j(C){const G=C instanceof Uint8Array,ce=typeof C=="string",Re=(G||ce)&&C.length;return G?Re===q||Re===ne:ce?Re===2*q||Re===2*ne:C instanceof J}function Q(C,G,ce=!0){if(j(C))throw new Error("first arg must be private key");if(!j(G))throw new Error("second arg must be public key");return J.fromHex(G).multiply(_(C)).toRawBytes(ce)}const se=ie.bits2int||function(C){const G=r.bytesToNumberBE(C),ce=C.length*8-ie.nBitLength;return ce>0?G>>BigInt(ce):G},de=ie.bits2int_modN||function(C){return w(se(C))},X=r.bitMask(ie.nBitLength);function D(C){if(typeof C!="bigint")throw new Error("bigint expected");if(!(l<=C&&CEe in ce))throw new Error("sign() legacy options not supported");const{hash:Re,randomBytes:Se}=ie;let{lowS:De,prehash:me,extraEntropy:Ye}=ce;De==null&&(De=!0),C=(0,i.ensureBytes)("msgHash",C),me&&(C=(0,i.ensureBytes)("prehashed msgHash",Re(C)));const Je=de(C),rt=_(G),et=[D(rt),D(Je)];if(Ye!=null){const Ee=Ye===!0?Se(F.BYTES):Ye;et.push((0,i.ensureBytes)("extraEntropy",Ee,F.BYTES))}const ye=r.concatBytes(...et),O=Je;function Y(Ee){const ve=se(Ee);if(!S(ve))return;const $e=E(ve),qe=J.BASE.multiply(ve).toAffine(),V=w(qe.x);if(V===l)return;const Ie=w($e*w(O+V*rt));if(Ie===l)return;let Be=(qe.x===V?0:2)|Number(qe.y&d),ke=Ie;return De&&H(Ie)&&(ke=M(Ie),Be^=1),new P(V,ke,Be)}return{seed:ye,k2sig:Y}}const te={lowS:ie.lowS,prehash:!1},ue={lowS:ie.lowS,prehash:!1};function B(C,G,ce=te){const{seed:Re,k2sig:Se}=$(C,G,ce),De=ie;return r.createHmacDrbg(De.hash.outputLen,De.nByteLength,De.hmac)(Re,Se)}J.BASE._setWindowSize(8);function U(C,G,ce,Re=ue){var qe;const Se=C;if(G=(0,i.ensureBytes)("msgHash",G),ce=(0,i.ensureBytes)("publicKey",ce),"strict"in Re)throw new Error("options.strict was renamed to lowS");const{lowS:De,prehash:me}=Re;let Ye,Je;try{if(typeof Se=="string"||Se instanceof Uint8Array)try{Ye=P.fromDER(Se)}catch(V){if(!(V instanceof e.DER.Err))throw V;Ye=P.fromCompact(Se)}else if(typeof Se=="object"&&typeof Se.r=="bigint"&&typeof Se.s=="bigint"){const{r:V,s:Ie}=Se;Ye=new P(V,Ie)}else throw new Error("PARSE");Je=J.fromHex(ce)}catch(V){if(V.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(De&&Ye.hasHighS())return!1;me&&(G=ie.hash(G));const{r:rt,s:et}=Ye,ye=de(G),O=E(et),Y=w(ye*O),Ee=w(rt*O),ve=(qe=J.BASE.multiplyAndAddUnsafe(Je,Y,Ee))==null?void 0:qe.toAffine();return ve?w(ve.x)===rt:!1}return{CURVE:ie,getPublicKey:re,getSharedSecret:Q,sign:B,verify:U,ProjectivePoint:J,Signature:P,utils:T}}e.weierstrass=ae;function K(y,ie){const F=y.ORDER;let z=l;for(let H=F-d;H%h===l;H/=h)z+=d;const q=z,ne=h<{let W=m,P=y.pow(M,J),T=y.sqr(P);T=y.mul(T,M);let re=y.mul(H,T);re=y.pow(re,E),re=y.mul(re,P),P=y.mul(re,M),T=y.mul(re,H);let j=y.mul(T,P);re=y.pow(j,_);let Q=y.eql(re,y.ONE);P=y.mul(T,S),re=y.mul(j,W),T=y.cmov(P,T,Q),j=y.cmov(re,j,Q);for(let se=q;se>d;se--){let de=se-h;de=h<{let T=y.sqr(P);const re=y.mul(W,P);T=y.mul(T,re);let j=y.pow(T,H);j=y.mul(j,re);const Q=y.mul(j,M),se=y.mul(y.sqr(j),P),de=y.eql(se,W);let X=y.cmov(Q,j,de);return{isValid:de,value:X}}}return L}e.SWUFpSqrtRatio=K;function I(y,ie){if(t.validateField(y),!y.isValid(ie.A)||!y.isValid(ie.B)||!y.isValid(ie.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const F=K(y,ie.Z);if(!y.isOdd)throw new Error("Fp.isOdd is not implemented!");return z=>{let q,ne,v,w,E,J,_,m;q=y.sqr(z),q=y.mul(q,ie.Z),ne=y.sqr(q),ne=y.add(ne,q),v=y.add(ne,y.ONE),v=y.mul(v,ie.B),w=y.cmov(ie.Z,y.neg(ne),!y.eql(ne,y.ZERO)),w=y.mul(w,ie.A),ne=y.sqr(v),J=y.sqr(w),E=y.mul(J,ie.A),ne=y.add(ne,E),ne=y.mul(ne,v),J=y.mul(J,w),E=y.mul(J,ie.B),ne=y.add(ne,E),_=y.mul(q,v);const{isValid:S,value:L}=F(ne,J);m=y.mul(q,z),m=y.mul(m,L),_=y.cmov(_,v,S),m=y.cmov(m,L,S);const H=y.isOdd(z)===y.isOdd(m);return m=y.cmov(y.neg(m),m,H),_=y.div(_,w),{x:_,y:m}}}e.mapToCurveSimpleSWU=I})(ig);var dn={};Object.defineProperty(dn,"__esModule",{value:!0});dn.createHasher=dn.isogenyMap=dn.hash_to_field=dn.expand_message_xof=dn.expand_message_xmd=void 0;const cj=_t,In=at;function dj(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return(0,In.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}const hj=In.bytesToNumberBE;function ji(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let i=t-1;i>=0;i--)r[i]=e&255,e>>>=8;return new Uint8Array(r)}function pj(e,t){const r=new Uint8Array(e.length);for(let i=0;i255&&(t=i((0,In.concatBytes)((0,In.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:a,blockLen:s}=i,f=Math.ceil(r/a);if(f>255)throw new Error("Invalid xmd length");const c=(0,In.concatBytes)(t,ji(t.length,1)),l=ji(0,s),d=ji(r,2),h=new Array(f),b=i((0,In.concatBytes)(l,e,d,ji(0,1),c));h[0]=i((0,In.concatBytes)(b,ji(1,1),c));for(let A=1;A<=f;A++){const N=[pj(b,h[A-1]),ji(A+1,1),c];h[A]=i((0,In.concatBytes)(...N))}return(0,In.concatBytes)(...h).slice(0,r)}dn.expand_message_xmd=uE;function lE(e,t,r,i,a){if(Ts(e),Ts(t),og(r),t.length>255){const s=Math.ceil(2*i/8);t=a.create({dkLen:s}).update((0,In.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return a.create({dkLen:r}).update(e).update(ji(r,2)).update(t).update(ji(t.length,1)).digest()}dn.expand_message_xof=lE;function zh(e,t,r){(0,In.validateObject)(r,{DST:"string",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:i,k:a,m:s,hash:f,expand:c,DST:l}=r;Ts(e),og(t);const d=dj(l),h=i.toString(2).length,b=Math.ceil((h+a)/8),R=t*s*b;let A;if(c==="xmd")A=uE(e,d,R,f);else if(c==="xof")A=lE(e,d,R,a,f);else if(c==="_internal_pass")A=e;else throw new Error('expand must be "xmd" or "xof"');const N=new Array(t);for(let ae=0;aeArray.from(i).reverse());return(i,a)=>{const[s,f,c,l]=r.map(d=>d.reduce((h,b)=>e.add(e.mul(h,i),b)));return i=e.div(s,f),a=e.mul(a,e.div(c,l)),{x:i,y:a}}}dn.isogenyMap=gj;function yj(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(i,a){const s=zh(i,2,{...r,DST:r.DST,...a}),f=e.fromAffine(t(s[0])),c=e.fromAffine(t(s[1])),l=f.add(c).clearCofactor();return l.assertValidity(),l},encodeToCurve(i,a){const s=zh(i,1,{...r,DST:r.encodeDST,...a}),f=e.fromAffine(t(s[0])).clearCofactor();return f.assertValidity(),f}}}dn.createHasher=yj;var Sa={},cE={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=cr,r=bi;class i extends r.Hash{constructor(f,c){super(),this.finished=!1,this.destroyed=!1,t.default.hash(f);const l=(0,r.toBytes)(c);if(this.iHash=f.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 d=this.blockLen,h=new Uint8Array(d);h.set(l.length>d?f.create().update(l).digest():l);for(let b=0;bnew i(s,f).update(c).digest();e.hmac=a,e.hmac.create=(s,f)=>new i(s,f)})(cE);Object.defineProperty(Sa,"__esModule",{value:!0});Sa.createCurve=Sa.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _j=cE,Bb=bi,bj=ig;function dE(e){return{hash:e,hmac:(t,...r)=>(0,_j.hmac)(e,t,(0,Bb.concatBytes)(...r)),randomBytes:Bb.randomBytes}}Sa.getHash=dE;function vj(e,t){const r=i=>(0,bj.weierstrass)({...e,...dE(i)});return Object.freeze({...r(t),create:r})}Sa.createCurve=vj;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=ma,r=bi,i=_t,a=ig,s=at,f=dn,c=Sa,l=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),d=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h=BigInt(1),b=BigInt(2),R=(P,T)=>(P+T/b)/T;function A(P){const T=l,re=BigInt(3),j=BigInt(6),Q=BigInt(11),se=BigInt(22),de=BigInt(23),X=BigInt(44),D=BigInt(88),$=P*P*P%T,te=$*$*P%T,ue=(0,i.pow2)(te,re,T)*te%T,B=(0,i.pow2)(ue,re,T)*te%T,U=(0,i.pow2)(B,b,T)*$%T,C=(0,i.pow2)(U,Q,T)*U%T,G=(0,i.pow2)(C,se,T)*C%T,ce=(0,i.pow2)(G,X,T)*G%T,Re=(0,i.pow2)(ce,D,T)*ce%T,Se=(0,i.pow2)(Re,X,T)*G%T,De=(0,i.pow2)(Se,re,T)*te%T,me=(0,i.pow2)(De,de,T)*C%T,Ye=(0,i.pow2)(me,j,T)*$%T,Je=(0,i.pow2)(Ye,b,T);if(!N.eql(N.sqr(Je),P))throw new Error("Cannot find square root");return Je}const N=(0,i.Field)(l,void 0,void 0,{sqrt:A});e.secp256k1=(0,c.createCurve)({a:BigInt(0),b:BigInt(7),Fp:N,n:d,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:P=>{const T=d,re=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),j=-h*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),Q=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),se=re,de=BigInt("0x100000000000000000000000000000000"),X=R(se*P,T),D=R(-j*P,T);let $=(0,i.mod)(P-X*re-D*Q,T),te=(0,i.mod)(-X*j-D*se,T);const ue=$>de,B=te>de;if(ue&&($=T-$),B&&(te=T-te),$>de||te>de)throw new Error("splitScalar: Endomorphism failed, k="+P);return{k1neg:ue,k1:$,k2neg:B,k2:te}}}},t.sha256);const ae=BigInt(0),K=P=>typeof P=="bigint"&&aetypeof P=="bigint"&&aeQ.charCodeAt(0)));re=(0,s.concatBytes)(j,j),y[P]=re}return(0,t.sha256)((0,s.concatBytes)(re,...T))}const F=P=>P.toRawBytes(!0).slice(1),z=P=>(0,s.numberToBytesBE)(P,32),q=P=>(0,i.mod)(P,l),ne=P=>(0,i.mod)(P,d),v=e.secp256k1.ProjectivePoint,w=(P,T,re)=>v.BASE.multiplyAndAddUnsafe(P,T,re);function E(P){let T=e.secp256k1.utils.normPrivateKeyToScalar(P),re=v.fromPrivateKey(T);return{scalar:re.hasEvenY()?T:ne(-T),bytes:F(re)}}function J(P){if(!K(P))throw new Error("bad x: need 0 < x < p");const T=q(P*P),re=q(T*P+BigInt(7));let j=A(re);j%b!==ae&&(j=q(-j));const Q=new v(P,j,h);return Q.assertValidity(),Q}function _(...P){return ne((0,s.bytesToNumberBE)(ie("BIP0340/challenge",...P)))}function m(P){return E(P).bytes}function S(P,T,re=(0,r.randomBytes)(32)){const j=(0,s.ensureBytes)("message",P),{bytes:Q,scalar:se}=E(T),de=(0,s.ensureBytes)("auxRand",re,32),X=z(se^(0,s.bytesToNumberBE)(ie("BIP0340/aux",de))),D=ie("BIP0340/nonce",X,Q,j),$=ne((0,s.bytesToNumberBE)(D));if($===ae)throw new Error("sign failed: k is zero");const{bytes:te,scalar:ue}=E($),B=_(te,Q,j),U=new Uint8Array(64);if(U.set(te,0),U.set(z(ne(ue+B*se)),32),!L(U,j,Q))throw new Error("sign: Invalid signature produced");return U}function L(P,T,re){const j=(0,s.ensureBytes)("signature",P,64),Q=(0,s.ensureBytes)("message",T),se=(0,s.ensureBytes)("publicKey",re,32);try{const de=J((0,s.bytesToNumberBE)(se)),X=(0,s.bytesToNumberBE)(j.subarray(0,32));if(!K(X))return!1;const D=(0,s.bytesToNumberBE)(j.subarray(32,64));if(!I(D))return!1;const $=_(z(X),F(de),Q),te=w(de,D,ne(-$));return!(!te||!te.hasEvenY()||te.toAffine().x!==X)}catch{return!1}}e.schnorr=(()=>({getPublicKey:m,sign:S,verify:L,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:J,pointToBytes:F,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:ie,mod:i.mod}}))();const H=(()=>(0,f.isogenyMap)(N,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(P=>P.map(T=>BigInt(T)))))(),M=(()=>(0,a.mapToCurveSimpleSWU)(N,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:N.create(BigInt("-11"))}))(),W=(()=>(0,f.createHasher)(e.secp256k1.ProjectivePoint,P=>{const{x:T,y:re}=M(N.create(P[0]));return H(T,re)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:N.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=(()=>W.hashToCurve)(),e.encodeToCurve=(()=>W.encodeToCurve)()})(Zm);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=Zm;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})})(ll);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=Vr,r=ll;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16})(ul);var yl={};Object.defineProperty(yl,"__esModule",{value:!0});yl.GWEI_TO_WEI=void 0;yl.GWEI_TO_WEI=BigInt(1e9);var ag={},Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.RLP=Wn.utils=Wn.decode=Wn.encode=void 0;function sg(e){if(Array.isArray(e)){const r=[];let i=0;for(let a=0;ae.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function xb(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return gE(pE(e))}function $b(e,t){if(e<56)return Uint8Array.from([e+t]);const r=Zh(e),i=r.length/2,a=Zh(t+55+i);return Uint8Array.from(Tu(a+r))}function hE(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=bE(e),i=Gh(r);if(t)return i;if(i.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return i.data}Wn.decode=hE;function Gh(e){let t,r,i,a,s;const f=[],c=e[0];if(c<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(c<=183){if(t=c-127,c===128?i=Uint8Array.from([]):i=ia(e,1,t),t===2&&i[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:i,remainder:e.slice(t)}}else if(c<=191){if(r=c-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(a=ia(e,r,l);a.length;)s=Gh(a),f.push(s.data),a=s.remainder;return{data:f,remainder:e.slice(l)}}}const wj=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function pE(e){let t="";for(let r=0;ri+a.length,0),r=new Uint8Array(t);for(let i=0,a=0;i=2&&e[0]==="0"&&e[1]==="x"}function Ej(e){return typeof e!="string"?e:_E(e)?e.slice(2):e}function bE(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return _E(e)?Tu(mj(Ej(e))):yE(e);if(typeof e=="number"||typeof e=="bigint")return e?Tu(Zh(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}Wn.utils={bytesToHex:pE,concatBytes:Vh,hexToBytes:Tu,utf8ToBytes:yE};Wn.RLP={encode:sg,decode:hE};var Pn={},jt={},vE={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.add=e.toBig=e.split=e.fromBig=void 0;const t=BigInt(2**32-1),r=BigInt(32);function i(E,J=!1){return J?{h:Number(E&t),l:Number(E>>r&t)}:{h:Number(E>>r&t)|0,l:Number(E&t)|0}}e.fromBig=i;function a(E,J=!1){let _=new Uint32Array(E.length),m=new Uint32Array(E.length);for(let S=0;SBigInt(E>>>0)<>>0);e.toBig=s;const f=(E,J,_)=>E>>>_,c=(E,J,_)=>E<<32-_|J>>>_,l=(E,J,_)=>E>>>_|J<<32-_,d=(E,J,_)=>E<<32-_|J>>>_,h=(E,J,_)=>E<<64-_|J>>>_-32,b=(E,J,_)=>E>>>_-32|J<<64-_,R=(E,J)=>J,A=(E,J)=>E,N=(E,J,_)=>E<<_|J>>>32-_,ae=(E,J,_)=>J<<_|E>>>32-_,K=(E,J,_)=>J<<_-32|E>>>64-_,I=(E,J,_)=>E<<_-32|J>>>64-_;function y(E,J,_,m){const S=(J>>>0)+(m>>>0);return{h:E+_+(S/2**32|0)|0,l:S|0}}e.add=y;const ie=(E,J,_)=>(E>>>0)+(J>>>0)+(_>>>0),F=(E,J,_,m)=>J+_+m+(E/2**32|0)|0,z=(E,J,_,m)=>(E>>>0)+(J>>>0)+(_>>>0)+(m>>>0),q=(E,J,_,m,S)=>J+_+m+S+(E/2**32|0)|0,ne=(E,J,_,m,S)=>(E>>>0)+(J>>>0)+(_>>>0)+(m>>>0)+(S>>>0),v=(E,J,_,m,S,L)=>J+_+m+S+L+(E/2**32|0)|0,w={fromBig:i,split:a,toBig:e.toBig,shrSH:f,shrSL:c,rotrSH:l,rotrSL:d,rotrBH:h,rotrBL:b,rotr32H:R,rotr32L:A,rotlSH:N,rotlSL:ae,rotlBH:K,rotlBL:I,add:y,add3L:ie,add3H:F,add4L:z,add4H:q,add5H:v,add5L:ne};e.default=w})(vE);Object.defineProperty(jt,"__esModule",{value:!0});jt.shake256=jt.shake128=jt.keccak_512=jt.keccak_384=jt.keccak_256=jt.keccak_224=jt.sha3_512=jt.sha3_384=jt.sha3_256=jt.sha3_224=jt.Keccak=jt.keccakP=void 0;const oa=cr,Os=vE,bs=bi,[wE,mE,EE]=[[],[],[]],Sj=BigInt(0),fs=BigInt(1),Rj=BigInt(2),Aj=BigInt(7),Tj=BigInt(256),Oj=BigInt(113);for(let e=0,t=fs,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],wE.push(2*(5*i+r)),mE.push((e+1)*(e+2)/2%64);let a=Sj;for(let s=0;s<7;s++)t=(t<>Aj)*Oj)%Tj,t&Rj&&(a^=fs<<(fs<r>32?Os.default.rotlBH(e,t,r):Os.default.rotlSH(e,t,r),Db=(e,t,r)=>r>32?Os.default.rotlBL(e,t,r):Os.default.rotlSL(e,t,r);function SE(e,t=24){const r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let f=0;f<10;f++)r[f]=e[f]^e[f+10]^e[f+20]^e[f+30]^e[f+40];for(let f=0;f<10;f+=2){const c=(f+8)%10,l=(f+2)%10,d=r[l],h=r[l+1],b=Mb(d,h,1)^r[c],R=Db(d,h,1)^r[c+1];for(let A=0;A<50;A+=10)e[f+A]^=b,e[f+A+1]^=R}let a=e[2],s=e[3];for(let f=0;f<24;f++){const c=mE[f],l=Mb(a,s,c),d=Db(a,s,c),h=wE[f];a=e[h],s=e[h+1],e[h]=l,e[h+1]=d}for(let f=0;f<50;f+=10){for(let c=0;c<10;c++)r[c]=e[f+c];for(let c=0;c<10;c++)e[f+c]^=~r[(c+2)%10]&r[(c+4)%10]}e[0]^=Ij[i],e[1]^=Pj[i]}r.fill(0)}jt.keccakP=SE;let fg=class RE extends bs.Hash{constructor(t,r,i,a=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=i,this.enableXOF=a,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,oa.default.number(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,bs.u32)(this.state)}keccak(){SE(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){oa.default.exists(this);const{blockLen:r,state:i}=this;t=(0,bs.toBytes)(t);const a=t.length;for(let s=0;s=i&&this.keccak();const f=Math.min(i-this.posOut,s-a);t.set(r.subarray(this.posOut,this.posOut+f),a),this.posOut+=f,a+=f}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return oa.default.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(oa.default.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:i,outputLen:a,rounds:s,enableXOF:f}=this;return t||(t=new RE(r,i,a,f,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=i,t.outputLen=a,t.enableXOF=f,t.destroyed=this.destroyed,t}};jt.Keccak=fg;const Gi=(e,t,r)=>(0,bs.wrapConstructor)(()=>new fg(t,e,r));jt.sha3_224=Gi(6,144,224/8);jt.sha3_256=Gi(6,136,256/8);jt.sha3_384=Gi(6,104,384/8);jt.sha3_512=Gi(6,72,512/8);jt.keccak_224=Gi(1,144,224/8);jt.keccak_256=Gi(1,136,256/8);jt.keccak_384=Gi(1,104,384/8);jt.keccak_512=Gi(1,72,512/8);const AE=(e,t,r)=>(0,bs.wrapXOFConstructorWithOpts)((i={})=>new fg(t,e,i.dkLen===void 0?r:i.dkLen,!0));jt.shake128=AE(31,168,128/8);jt.shake256=AE(31,136,256/8);var Ou={exports:{}};Ou.exports;(function(e,t){var r=Qe&&Qe.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.wrapHash=t.equalsBytes=t.hexToBytes=t.bytesToUtf8=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0;const i=r(cr),a=bi,s=i.default.bool;t.assertBool=s;const f=i.default.bytes;t.assertBytes=f;var c=bi;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}});function l(R){if(!(R instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof R}`);return new TextDecoder().decode(R)}t.bytesToUtf8=l;function d(R){const A=R.startsWith("0x")?R.substring(2):R;return(0,a.hexToBytes)(A)}t.hexToBytes=d;function h(R,A){if(R.length!==A.length)return!1;for(let N=0;N(i.default.bytes(A),R(A))}t.wrapHash=b,t.crypto=(()=>{const R=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,A=typeof x_=="function"&&x_.bind(e);return{node:A&&!R?A("crypto"):void 0,web:R}})()})(Ou,Ou.exports);var TE=Ou.exports;Object.defineProperty(Pn,"__esModule",{value:!0});Pn.keccak512=Pn.keccak384=Pn.keccak256=Pn.keccak224=void 0;const Is=jt,_l=TE;Pn.keccak224=(0,_l.wrapHash)(Is.keccak_224);Pn.keccak256=(()=>{const e=(0,_l.wrapHash)(Is.keccak_256);return e.create=Is.keccak_256.create,e})();Pn.keccak384=(0,_l.wrapHash)(Is.keccak_384);Pn.keccak512=(0,_l.wrapHash)(Is.keccak_512);var Co={},hn={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.isHexString=Ft.getKeys=Ft.fromAscii=Ft.fromUtf8=Ft.toAscii=Ft.arrayContainsArray=Ft.getBinarySize=Ft.padToEven=Ft.stripHexPrefix=Ft.isHexPrefixed=void 0;function OE(e){if(typeof e!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof e}`);return e[0]==="0"&&e[1]==="x"}Ft.isHexPrefixed=OE;const Lj=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return OE(e)?e.slice(2):e};Ft.stripHexPrefix=Lj;function IE(e){let t=e;if(typeof t!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof t}`);return t.length%2&&(t=`0${t}`),t}Ft.padToEven=IE;function Nj(e){if(typeof e!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof e}`);return Ce.Buffer.byteLength(e,"utf8")}Ft.getBinarySize=Nj;function Cj(e,t,r){if(Array.isArray(e)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(Array.isArray(t)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[r===!0?"some":"every"](i=>e.indexOf(i)>=0)}Ft.arrayContainsArray=Cj;function Bj(e){let t="",r=0;const i=e.length;for(e.substring(0,2)==="0x"&&(r=2);r0&&e.length!==2+2*t)}Ft.isHexString=Dj;Object.defineProperty(hn,"__esModule",{value:!0});hn.assertIsString=hn.assertIsArray=hn.assertIsBuffer=hn.assertIsHexString=void 0;const jj=Ft,Fj=function(e){if(!(0,jj.isHexString)(e)){const t=`This method only supports 0x-prefixed hex strings but input was: ${e}`;throw new Error(t)}};hn.assertIsHexString=Fj;const Uj=function(e){if(!Ce.Buffer.isBuffer(e)){const t=`This method only supports Buffer but input was: ${e}`;throw new Error(t)}};hn.assertIsBuffer=Uj;const kj=function(e){if(!Array.isArray(e)){const t=`This method only supports number arrays but input was: ${e}`;throw new Error(t)}};hn.assertIsArray=kj;const qj=function(e){if(typeof e!="string"){const t=`This method only supports strings but input was: ${e}`;throw new Error(t)}};hn.assertIsString=qj;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=hn,r=Ft,i=function(S){if(!Number.isSafeInteger(S)||S<0)throw new Error(`Received an invalid integer type: ${S}`);return`0x${S.toString(16)}`};e.intToHex=i;const a=function(S){const L=(0,e.intToHex)(S);return Ce.Buffer.from((0,r.padToEven)(L.slice(2)),"hex")};e.intToBuffer=a;const s=function(S){return Ce.Buffer.allocUnsafe(S).fill(0)};e.zeros=s;const f=function(S,L,H){const M=(0,e.zeros)(L);return H?S.length0&&L.toString()==="0";)S=S.slice(1),L=S[0];return S},h=function(S){return(0,t.assertIsBuffer)(S),d(S)};e.unpadBuffer=h;const b=function(S){return(0,t.assertIsArray)(S),d(S)};e.unpadArray=b;const R=function(S){return(0,t.assertIsHexString)(S),S=(0,r.stripHexPrefix)(S),"0x"+d(S)};e.unpadHexString=R;const A=function(S){if(S==null)return Ce.Buffer.allocUnsafe(0);if(Ce.Buffer.isBuffer(S))return Ce.Buffer.from(S);if(Array.isArray(S)||S instanceof Uint8Array)return Ce.Buffer.from(S);if(typeof S=="string"){if(!(0,r.isHexString)(S))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${S}`);return Ce.Buffer.from((0,r.padToEven)((0,r.stripHexPrefix)(S)),"hex")}if(typeof S=="number")return(0,e.intToBuffer)(S);if(typeof S=="bigint"){if(S0&&H[0]===0)throw new Error(`${L} cannot have leading zeroes, received: ${H.toString("hex")}`)};e.validateNoLeadingZeroes=v;function w(S){return Array.isArray(S)?S.map(L=>w(L)):Ce.Buffer.from(S)}e.arrToBufArr=w;function E(S){return Array.isArray(S)?S.map(L=>E(L)):Uint8Array.from(S??[])}e.bufArrToArr=E;const J=S=>"0x"+S.toString(16);e.bigIntToHex=J;function _(S){return(0,e.unpadBuffer)(K(S))}e.bigIntToUnpaddedBuffer=_;function m(S){return(0,e.unpadBuffer)((0,e.intToBuffer)(S))}e.intToUnpaddedBuffer=m})(Co);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=Wn,r=Pn,i=ll,a=TE,s=Co,f=ul,c=hn,l=Ft,d=BigInt(0);class h{constructor(m=d,S=d,L=f.KECCAK256_RLP,H=f.KECCAK256_NULL){this.nonce=m,this.balance=S,this.storageRoot=L,this.codeHash=H,this._validate()}static fromAccountData(m){const{nonce:S,balance:L,storageRoot:H,codeHash:M}=m;return new h(S!==void 0?(0,s.bufferToBigInt)((0,s.toBuffer)(S)):void 0,L!==void 0?(0,s.bufferToBigInt)((0,s.toBuffer)(L)):void 0,H!==void 0?(0,s.toBuffer)(H):void 0,M!==void 0?(0,s.toBuffer)(M):void 0)}static fromRlpSerializedAccount(m){const S=(0,s.arrToBufArr)(t.RLP.decode(Uint8Array.from(m)));if(!Array.isArray(S))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(S)}static fromValuesArray(m){const[S,L,H,M]=m;return new h((0,s.bufferToBigInt)(S),(0,s.bufferToBigInt)(L),H,M)}_validate(){if(this.nonce=8?W+=S[P].toUpperCase():W+=S[P];return W};e.toChecksumAddress=R;const A=function(_,m){return(0,e.isValidAddress)(_)&&(0,e.toChecksumAddress)(_,m)===_};e.isValidChecksumAddress=A;const N=function(_,m){return(0,c.assertIsBuffer)(_),(0,c.assertIsBuffer)(m),(0,s.bufferToBigInt)(m)===BigInt(0)?Ce.Buffer.from((0,r.keccak256)(t.RLP.encode((0,s.bufArrToArr)([_,null])))).slice(-20):Ce.Buffer.from((0,r.keccak256)(t.RLP.encode((0,s.bufArrToArr)([_,m])))).slice(-20)};e.generateAddress=N;const ae=function(_,m,S){if((0,c.assertIsBuffer)(_),(0,c.assertIsBuffer)(m),(0,c.assertIsBuffer)(S),_.length!==20)throw new Error("Expected from to be of length 20");if(m.length!==32)throw new Error("Expected salt to be of length 32");const L=(0,r.keccak256)(Ce.Buffer.concat([Ce.Buffer.from("ff","hex"),_,m,(0,r.keccak256)(S)]));return(0,s.toBuffer)(L).slice(-20)};e.generateAddress2=ae;const K=function(_){return i.secp256k1.utils.isValidPrivateKey(_)};e.isValidPrivate=K;const I=function(_,m=!1){if((0,c.assertIsBuffer)(_),_.length===64)try{return i.secp256k1.ProjectivePoint.fromHex(Ce.Buffer.concat([Ce.Buffer.from([4]),_])),!0}catch{return!1}if(!m)return!1;try{return i.secp256k1.ProjectivePoint.fromHex(_),!0}catch{return!1}};e.isValidPublic=I;const y=function(_,m=!1){if((0,c.assertIsBuffer)(_),m&&_.length!==64&&(_=Ce.Buffer.from(i.secp256k1.ProjectivePoint.fromHex(_).toRawBytes(!1).slice(1))),_.length!==64)throw new Error("Expected pubKey to be of length 64");return Ce.Buffer.from((0,r.keccak256)(_)).slice(-20)};e.pubToAddress=y,e.publicToAddress=e.pubToAddress;const ie=function(_){return(0,c.assertIsBuffer)(_),Ce.Buffer.from(i.secp256k1.ProjectivePoint.fromPrivateKey(_).toRawBytes(!1).slice(1))};e.privateToPublic=ie;const F=function(_){return(0,e.publicToAddress)((0,e.privateToPublic)(_))};e.privateToAddress=F;const z=function(_){return(0,c.assertIsBuffer)(_),_.length!==64&&(_=Ce.Buffer.from(i.secp256k1.ProjectivePoint.fromHex(_).toRawBytes(!1).slice(1))),_};e.importPublic=z;const q=function(){const m=(0,s.zeros)(20);return(0,s.bufferToHex)(m)};e.zeroAddress=q;const ne=function(_){try{(0,c.assertIsString)(_)}catch{return!1}return(0,e.zeroAddress)()===_};e.isZeroAddress=ne;function v(_){const[m,S,L,H]=_;return[m,S,(0,s.arrToBufArr)(L).length===0?f.KECCAK256_RLP:L,(0,s.arrToBufArr)(H).length===0?f.KECCAK256_NULL:H]}e.accountBodyFromSlim=v;const w=new Uint8Array(0);function E(_){const[m,S,L,H]=_;return[m,S,(0,s.arrToBufArr)(L).equals(f.KECCAK256_RLP)?w:L,(0,s.arrToBufArr)(H).equals(f.KECCAK256_NULL)?w:H]}e.accountBodyToSlim=E;function J(_,m=!0){const S=m?v(_):_;return(0,s.arrToBufArr)(t.RLP.encode(S))}e.accountBodyToRLP=J})(ag);var $s={};Object.defineProperty($s,"__esModule",{value:!0});$s.Address=void 0;const us=ag,Qf=Co;class ci{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new ci((0,Qf.zeros)(20))}static fromString(t){if(!(0,us.isValidAddress)(t))throw new Error("Invalid address");return new ci((0,Qf.toBuffer)(t))}static fromPublicKey(t){if(!Ce.Buffer.isBuffer(t))throw new Error("Public key should be Buffer");const r=(0,us.pubToAddress)(t);return new ci(r)}static fromPrivateKey(t){if(!Ce.Buffer.isBuffer(t))throw new Error("Private key should be Buffer");const r=(0,us.privateToAddress)(t);return new ci(r)}static generate(t,r){if(typeof r!="bigint")throw new Error("Expected nonce to be a bigint");return new ci((0,us.generateAddress)(t.buf,(0,Qf.bigIntToBuffer)(r)))}static generate2(t,r,i){if(!Ce.Buffer.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!Ce.Buffer.isBuffer(i))throw new Error("Expected initCode to be a Buffer");return new ci((0,us.generateAddress2)(t.buf,r,i))}equals(t){return this.buf.equals(t.buf)}isZero(){return this.equals(ci.zero())}isPrecompileOrSystemAddress(){const t=(0,Qf.bufferToBigInt)(this.buf),r=BigInt(0),i=BigInt("0xffff");return t>=r&&t<=i}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return Ce.Buffer.from(this.buf)}}$s.Address=ci;var bl={},ug={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=Co,r=Ft;var i;(function(s){s[s.Number=0]="Number",s[s.BigInt=1]="BigInt",s[s.Buffer=2]="Buffer",s[s.PrefixedHexString=3]="PrefixedHexString"})(i=e.TypeOutput||(e.TypeOutput={}));function a(s,f){if(s===null)return null;if(s===void 0)return;if(typeof s=="string"&&!(0,r.isHexString)(s))throw new Error(`A string must be provided with a 0x-prefix, given: ${s}`);if(typeof s=="number"&&!Number.isSafeInteger(s))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const c=(0,t.toBuffer)(s);switch(f){case i.Buffer:return c;case i.BigInt:return(0,t.bufferToBigInt)(c);case i.Number:{const l=(0,t.bufferToBigInt)(c);if(l>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(l)}case i.PrefixedHexString:return(0,t.bufferToHex)(c);default:throw new Error("unknown outputType")}}e.toType=a})(ug);Object.defineProperty(bl,"__esModule",{value:!0});bl.Withdrawal=void 0;const jb=$s,Zd=Co,Xt=ug;class vs{constructor(t,r,i,a){this.index=t,this.validatorIndex=r,this.address=i,this.amount=a}static fromWithdrawalData(t){const{index:r,validatorIndex:i,address:a,amount:s}=t,f=(0,Xt.toType)(r,Xt.TypeOutput.BigInt),c=(0,Xt.toType)(i,Xt.TypeOutput.BigInt),l=new jb.Address((0,Xt.toType)(a,Xt.TypeOutput.Buffer)),d=(0,Xt.toType)(s,Xt.TypeOutput.BigInt);return new vs(f,c,l,d)}static fromValuesArray(t){if(t.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${t.length}`);const[r,i,a,s]=t;return vs.fromWithdrawalData({index:r,validatorIndex:i,address:a,amount:s})}static toBufferArray(t){const{index:r,validatorIndex:i,address:a,amount:s}=t,f=(0,Xt.toType)(r,Xt.TypeOutput.BigInt)===BigInt(0)?Ce.Buffer.alloc(0):(0,Xt.toType)(r,Xt.TypeOutput.Buffer),c=(0,Xt.toType)(i,Xt.TypeOutput.BigInt)===BigInt(0)?Ce.Buffer.alloc(0):(0,Xt.toType)(i,Xt.TypeOutput.Buffer);let l;a instanceof jb.Address?l=a.buf:l=(0,Xt.toType)(a,Xt.TypeOutput.Buffer);const d=(0,Xt.toType)(s,Xt.TypeOutput.BigInt)===BigInt(0)?Ce.Buffer.alloc(0):(0,Xt.toType)(s,Xt.TypeOutput.Buffer);return[f,c,l,d]}raw(){return vs.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,Zd.bigIntToHex)(this.index),validatorIndex:(0,Zd.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,Zd.bigIntToHex)(this.amount)}}}bl.Withdrawal=vs;var Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.hashPersonalMessage=Sr.isValidSignature=Sr.fromRpcSig=Sr.toCompactSig=Sr.toRpcSig=Sr.ecrecover=Sr.ecsign=void 0;const Hj=Pn,PE=ll,Mr=Co,Kd=ul,Wj=hn;function zj(e,t,r){const i=PE.secp256k1.sign(e,t),a=i.toCompactRawBytes(),s=Ce.Buffer.from(a.slice(0,32)),f=Ce.Buffer.from(a.slice(32,64)),c=r===void 0?BigInt(i.recovery+27):BigInt(i.recovery+35)+BigInt(r)*BigInt(2);return{r:s,s:f,v:c}}Sr.ecsign=zj;function vl(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function wl(e){return e===BigInt(0)||e===BigInt(1)}const Gj=function(e,t,r,i,a){const s=Ce.Buffer.concat([(0,Mr.setLengthLeft)(r,32),(0,Mr.setLengthLeft)(i,32)],64),f=vl(t,a);if(!wl(f))throw new Error("Invalid signature v value");const l=PE.secp256k1.Signature.fromCompact(s).addRecoveryBit(Number(f)).recoverPublicKey(e);return Ce.Buffer.from(l.toRawBytes(!1).slice(1))};Sr.ecrecover=Gj;const Vj=function(e,t,r,i){const a=vl(e,i);if(!wl(a))throw new Error("Invalid signature v value");return(0,Mr.bufferToHex)(Ce.Buffer.concat([(0,Mr.setLengthLeft)(t,32),(0,Mr.setLengthLeft)(r,32),(0,Mr.toBuffer)(e)]))};Sr.toRpcSig=Vj;const Zj=function(e,t,r,i){const a=vl(e,i);if(!wl(a))throw new Error("Invalid signature v value");let s=r;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(s=Ce.Buffer.from(r),s[0]|=128),(0,Mr.bufferToHex)(Ce.Buffer.concat([(0,Mr.setLengthLeft)(t,32),(0,Mr.setLengthLeft)(s,32)]))};Sr.toCompactSig=Zj;const Kj=function(e){const t=(0,Mr.toBuffer)(e);let r,i,a;if(t.length>=65)r=t.slice(0,32),i=t.slice(32,64),a=(0,Mr.bufferToBigInt)(t.slice(64));else if(t.length===64)r=t.slice(0,32),i=t.slice(32,64),a=BigInt((0,Mr.bufferToInt)(t.slice(32,33))>>7),i[0]&=127;else throw new Error("Invalid signature length");return a<27&&(a=a+BigInt(27)),{v:a,r,s:i}};Sr.fromRpcSig=Kj;const Jj=function(e,t,r,i=!0,a){if(t.length!==32||r.length!==32||!wl(vl(e,a)))return!1;const s=(0,Mr.bufferToBigInt)(t),f=(0,Mr.bufferToBigInt)(r);return!(s===BigInt(0)||s>=Kd.SECP256K1_ORDER||f===BigInt(0)||f>=Kd.SECP256K1_ORDER||i&&f>=Kd.SECP256K1_ORDER_DIV_2)};Sr.isValidSignature=Jj;const Xj=function(e){(0,Wj.assertIsBuffer)(e);const t=Ce.Buffer.from(`Ethereum Signed Message: -${e.length}`,"utf-8");return Ce.Buffer.from((0,Hj.keccak256)(Ce.Buffer.concat([t,e])))};Sr.hashPersonalMessage=Xj;var LE={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=f=>f.length>0&&f[f.length-1]===16;e.hasTerminator=t;const r=(f,c)=>{for(let l=0,d=0;d{let c=0;(0,e.hasTerminator)(f)&&(c=1,f=f.subarray(0,f.length-1));const l=new Uint8Array(f.length/2+1);return l[0]=c<<5,(f.length&1)===1&&(l[0]|=16,l[0]|=f[0],f=f.subarray(1)),(0,e.nibblesToBytes)(f,l.subarray(1)),l};e.nibblesToCompactBytes=i;const a=f=>{const c=f.length*2+1,l=new Uint8Array(c);for(let d=0;d{if(f.length===0)return f;let c=(0,e.bytesToNibbles)(f);c[0]<2&&(c=c.subarray(0,c.length-1));const l=2-(c[0]&1);return c.subarray(l)};e.compactBytesToNibbles=s})(LE);var ml={};Object.defineProperty(ml,"__esModule",{value:!0});ml.AsyncEventEmitter=void 0;const Yj=Wi;async function Qj(e,t,r){let i;for await(const a of t)try{a.length<2?a.call(e,r):await new Promise((s,f)=>{a.call(e,r,c=>{c?f(c):s()})})}catch(s){i=s}if(i)throw i}class eF extends Yj.EventEmitter{emit(t,...r){let[i,a]=r;const s=this;let f=s._events[t]??[];return a===void 0&&typeof i=="function"&&(a=i,i=void 0),(t==="newListener"||t==="removeListener")&&(i={event:i,fn:a},a=void 0),f=Array.isArray(f)?f:[f],Qj(s,f.slice(),i).then(a).catch(a),s.listenerCount(t)>0}once(t,r){const i=this;let a;if(typeof r!="function")throw new TypeError("listener must be a function");return r.length>=2?a=function(s,f){i.removeListener(t,a),r(s,f)}:a=function(s){i.removeListener(t,a),r(s,a)},i.on(t,a),i}first(t,r){let i=this._events[t]??[];if(typeof r!="function")throw new TypeError("listener must be a function");return Array.isArray(i)||(this._events[t]=i=[i]),i.unshift(r),this}before(t,r,i){return this.beforeOrAfter(t,r,i)}after(t,r,i){return this.beforeOrAfter(t,r,i,"after")}beforeOrAfter(t,r,i,a){let s=this._events[t]??[],f,c;const l=a==="after"?1:0;if(typeof i!="function")throw new TypeError("listener must be a function");if(typeof r!="function")throw new TypeError("target must be a function");for(Array.isArray(s)||(this._events[t]=s=[s]),c=s.length,f=s.length;f--;)if(s[f]===r){c=f+l;break}return s.splice(c,0,i),this}on(t,r){return super.on(t,r)}addListener(t,r){return super.addListener(t,r)}prependListener(t,r){return super.prependListener(t,r)}prependOnceListener(t,r){return super.prependOnceListener(t,r)}removeAllListeners(t){return super.removeAllListeners(t)}removeListener(t,r){return super.removeListener(t,r)}eventNames(){return super.eventNames()}listeners(t){return super.listeners(t)}listenerCount(t){return super.listenerCount(t)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(t){return super.setMaxListeners(t)}}ml.AsyncEventEmitter=eF;var El={};Object.defineProperty(El,"__esModule",{value:!0});El.Lock=void 0;class tF{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(t=>this.promiseResolverQueue.push(t))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const t=this.promiseResolverQueue.shift();t&&t(!0)}}}El.Lock=tF;var Ra={},Ao={},Jd={},Xd={exports:{}},Yd={},Fb;function NE(){return Fb||(Fb=1,function(e){e.fetch=a(Qe.fetch)&&a(Qe.ReadableStream),e.writableStream=a(Qe.WritableStream),e.abortController=a(Qe.AbortController);var t;function r(){if(t!==void 0)return t;if(Qe.XMLHttpRequest){t=new Qe.XMLHttpRequest;try{t.open("GET",Qe.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function i(s){var f=r();if(!f)return!1;try{return f.responseType=s,f.responseType===s}catch{}return!1}e.arraybuffer=e.fetch||i("arraybuffer"),e.msstream=!e.fetch&&i("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&i("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||(r()?a(r().overrideMimeType):!1);function a(s){return typeof s=="function"}t=null}(Yd)),Yd}var eu={},Ub;function CE(){if(Ub)return eu;Ub=1;var e=NE(),t=wi,r=Ta,i=eu.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},a=eu.IncomingMessage=function(s,f,c,l){var d=this;if(r.Readable.call(d),d._mode=c,d.headers={},d.rawHeaders=[],d.trailers={},d.rawTrailers=[],d.on("end",function(){Ce.process.nextTick(function(){d.emit("close")})}),c==="fetch"){let ae=function(){b.read().then(function(K){if(!d._destroyed){if(l(K.done),K.done){d.push(null);return}d.push(Ce.Buffer.from(K.value)),ae()}}).catch(function(K){l(!0),d._destroyed||d.emit("error",K)})};if(d._fetchResponse=f,d.url=f.url,d.statusCode=f.status,d.statusMessage=f.statusText,f.headers.forEach(function(K,I){d.headers[I.toLowerCase()]=K,d.rawHeaders.push(I,K)}),e.writableStream){var h=new WritableStream({write:function(K){return l(!1),new Promise(function(I,y){d._destroyed?y():d.push(Ce.Buffer.from(K))?I():d._resumeFetch=I})},close:function(){l(!0),d._destroyed||d.push(null)},abort:function(K){l(!0),d._destroyed||d.emit("error",K)}});try{f.body.pipeTo(h).catch(function(K){l(!0),d._destroyed||d.emit("error",K)});return}catch{}}var b=f.body.getReader();ae()}else{d._xhr=s,d._pos=0,d.url=s.responseURL,d.statusCode=s.status,d.statusMessage=s.statusText;var R=s.getAllResponseHeaders().split(/\r?\n/);if(R.forEach(function(ae){var K=ae.match(/^([^:]+):\s*(.*)/);if(K){var I=K[1].toLowerCase();I==="set-cookie"?(d.headers[I]===void 0&&(d.headers[I]=[]),d.headers[I].push(K[2])):d.headers[I]!==void 0?d.headers[I]+=", "+K[2]:d.headers[I]=K[2],d.rawHeaders.push(K[1],K[2])}}),d._charset="x-user-defined",!e.overrideMimeType){var A=d.rawHeaders["mime-type"];if(A){var N=A.match(/;\s*charset=([^;])(;|$)/);N&&(d._charset=N[1].toLowerCase())}d._charset||(d._charset="utf-8")}}};return t(a,r.Readable),a.prototype._read=function(){var s=this,f=s._resumeFetch;f&&(s._resumeFetch=null,f())},a.prototype._onXHRProgress=function(s){var f=this,c=f._xhr,l=null;switch(f._mode){case"text":if(l=c.responseText,l.length>f._pos){var d=l.substr(f._pos);if(f._charset==="x-user-defined"){for(var h=Ce.Buffer.alloc(d.length),b=0;bf._pos&&(f.push(Ce.Buffer.from(new Uint8Array(R.result.slice(f._pos)))),f._pos=R.result.byteLength)},R.onload=function(){s(!0),f.push(null)},R.readAsArrayBuffer(l);break}f._xhr.readyState===i.DONE&&f._mode!=="ms-stream"&&(s(!0),f.push(null))},eu}var kb;function rF(){if(kb)return Xd.exports;kb=1;var e=NE(),t=wi,r=CE(),i=Ta,a=r.IncomingMessage,s=r.readyStates;function f(h,b){return e.fetch&&b?"fetch":e.mozchunkedarraybuffer?"moz-chunked-arraybuffer":e.msstream?"ms-stream":e.arraybuffer&&h?"arraybuffer":"text"}var c=Xd.exports=function(h){var b=this;i.Writable.call(b),b._opts=h,b._body=[],b._headers={},h.auth&&b.setHeader("Authorization","Basic "+Ce.Buffer.from(h.auth).toString("base64")),Object.keys(h.headers).forEach(function(N){b.setHeader(N,h.headers[N])});var R,A=!0;if(h.mode==="disable-fetch"||"requestTimeout"in h&&!e.abortController)A=!1,R=!0;else if(h.mode==="prefer-streaming")R=!1;else if(h.mode==="allow-wrong-content-type")R=!e.overrideMimeType;else if(!h.mode||h.mode==="default"||h.mode==="prefer-fast")R=!0;else throw new Error("Invalid value for opts.mode");b._mode=f(R,A),b._fetchTimer=null,b._socketTimeout=null,b._socketTimer=null,b.on("finish",function(){b._onFinish()})};t(c,i.Writable),c.prototype.setHeader=function(h,b){var R=this,A=h.toLowerCase();d.indexOf(A)===-1&&(R._headers[A]={name:h,value:b})},c.prototype.getHeader=function(h){var b=this._headers[h.toLowerCase()];return b?b.value:null},c.prototype.removeHeader=function(h){var b=this;delete b._headers[h.toLowerCase()]},c.prototype._onFinish=function(){var h=this;if(!h._destroyed){var b=h._opts;"timeout"in b&&b.timeout!==0&&h.setTimeout(b.timeout);var R=h._headers,A=null;b.method!=="GET"&&b.method!=="HEAD"&&(A=new Blob(h._body,{type:(R["content-type"]||{}).value||""}));var N=[];if(Object.keys(R).forEach(function(y){var ie=R[y].name,F=R[y].value;Array.isArray(F)?F.forEach(function(z){N.push([ie,z])}):N.push([ie,F])}),h._mode==="fetch"){var ae=null;if(e.abortController){var K=new AbortController;ae=K.signal,h._fetchAbortController=K,"requestTimeout"in b&&b.requestTimeout!==0&&(h._fetchTimer=Qe.setTimeout(function(){h.emit("requestTimeout"),h._fetchAbortController&&h._fetchAbortController.abort()},b.requestTimeout))}Qe.fetch(h._opts.url,{method:h._opts.method,headers:N,body:A||void 0,mode:"cors",credentials:b.withCredentials?"include":"same-origin",signal:ae}).then(function(y){h._fetchResponse=y,h._resetTimers(!1),h._connect()},function(y){h._resetTimers(!0),h._destroyed||h.emit("error",y)})}else{var I=h._xhr=new Qe.XMLHttpRequest;try{I.open(h._opts.method,h._opts.url,!0)}catch(y){Ce.process.nextTick(function(){h.emit("error",y)});return}"responseType"in I&&(I.responseType=h._mode),"withCredentials"in I&&(I.withCredentials=!!b.withCredentials),h._mode==="text"&&"overrideMimeType"in I&&I.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in b&&(I.timeout=b.requestTimeout,I.ontimeout=function(){h.emit("requestTimeout")}),N.forEach(function(y){I.setRequestHeader(y[0],y[1])}),h._response=null,I.onreadystatechange=function(){switch(I.readyState){case s.LOADING:case s.DONE:h._onXHRProgress();break}},h._mode==="moz-chunked-arraybuffer"&&(I.onprogress=function(){h._onXHRProgress()}),I.onerror=function(){h._destroyed||(h._resetTimers(!0),h.emit("error",new Error("XHR error")))};try{I.send(A)}catch(y){Ce.process.nextTick(function(){h.emit("error",y)});return}}}};function l(h){try{var b=h.status;return b!==null&&b!==0}catch{return!1}}c.prototype._onXHRProgress=function(){var h=this;h._resetTimers(!1),!(!l(h._xhr)||h._destroyed)&&(h._response||h._connect(),h._response._onXHRProgress(h._resetTimers.bind(h)))},c.prototype._connect=function(){var h=this;h._destroyed||(h._response=new a(h._xhr,h._fetchResponse,h._mode,h._resetTimers.bind(h)),h._response.on("error",function(b){h.emit("error",b)}),h.emit("response",h._response))},c.prototype._write=function(h,b,R){var A=this;A._body.push(h),R()},c.prototype._resetTimers=function(h){var b=this;Qe.clearTimeout(b._socketTimer),b._socketTimer=null,h?(Qe.clearTimeout(b._fetchTimer),b._fetchTimer=null):b._socketTimeout&&(b._socketTimer=Qe.setTimeout(function(){b.emit("timeout")},b._socketTimeout))},c.prototype.abort=c.prototype.destroy=function(h){var b=this;b._destroyed=!0,b._resetTimers(!0),b._response&&(b._response._destroyed=!0),b._xhr?b._xhr.abort():b._fetchAbortController&&b._fetchAbortController.abort(),h&&b.emit("error",h)},c.prototype.end=function(h,b,R){var A=this;typeof h=="function"&&(R=h,h=void 0),i.Writable.prototype.end.call(A,h,b,R)},c.prototype.setTimeout=function(h,b){var R=this;b&&R.once("timeout",b),R._socketTimeout=h,R._resetTimers(!1)},c.prototype.flushHeaders=function(){},c.prototype.setNoDelay=function(){},c.prototype.setSocketKeepAlive=function(){};var d=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return Xd.exports}var Qd,qb;function nF(){if(qb)return Qd;qb=1,Qd=t;var e=Object.prototype.hasOwnProperty;function t(){for(var r={},i=0;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},F=l-d,z=Math.floor,q=String.fromCharCode,ne;function v(T){throw new RangeError(ie[T])}function w(T,re){for(var j=T.length,Q=[];j--;)Q[j]=re(T[j]);return Q}function E(T,re){var j=T.split("@"),Q="";j.length>1&&(Q=j[0]+"@",T=j[1]),T=T.replace(y,".");var se=T.split("."),de=w(se,re).join(".");return Q+de}function J(T){for(var re=[],j=0,Q=T.length,se,de;j=55296&&se<=56319&&j65535&&(re-=65536,j+=q(re>>>10&1023|55296),re=56320|re&1023),j+=q(re),j}).join("")}function m(T){return T-48<10?T-22:T-65<26?T-65:T-97<26?T-97:l}function S(T,re){return T+22+75*(T<26)-((re!=0)<<5)}function L(T,re,j){var Q=0;for(T=j?z(T/R):T>>1,T+=z(T/re);T>F*h>>1;Q+=l)T=z(T/F);return z(Q+(F+1)*T/(T+b))}function H(T){var re=[],j=T.length,Q,se=0,de=N,X=A,D,$,te,ue,B,U,C,G,ce;for(D=T.lastIndexOf(ae),D<0&&(D=0),$=0;$=128&&v("not-basic"),re.push(T.charCodeAt($));for(te=D>0?D+1:0;te=j&&v("invalid-input"),C=m(T.charCodeAt(te++)),(C>=l||C>z((c-se)/B))&&v("overflow"),se+=C*B,G=U<=X?d:U>=X+h?h:U-X,!(Cz(c/ce)&&v("overflow"),B*=ce;Q=re.length+1,X=L(se-ue,Q,ue==0),z(se/Q)>c-de&&v("overflow"),de+=z(se/Q),se%=Q,re.splice(se++,0,de)}return _(re)}function M(T){var re,j,Q,se,de,X,D,$,te,ue,B,U=[],C,G,ce,Re;for(T=J(T),C=T.length,re=N,j=0,de=A,X=0;X=re&&Bz((c-j)/G)&&v("overflow"),j+=(D-re)*G,re=D,X=0;Xc&&v("overflow"),B==re){for($=j,te=l;ue=te<=de?d:te>=de+h?h:te-de,!($0&&c>f&&(c=f);for(var l=0;l=0?(b=d.substr(0,h),R=d.substr(h+1)):(b=d,R=""),A=decodeURIComponent(b),N=decodeURIComponent(R),sF(a,A)?uF(a[A])?a[A].push(N):a[A]=[a[A],N]:a[A]=N}return a},uF=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ls=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},lF=function(e,t,r,i){return t=t||"&",r=r||"=",e===null&&(e=void 0),typeof e=="object"?Wb(dF(e),function(a){var s=encodeURIComponent(ls(a))+r;return cF(e[a])?Wb(e[a],function(f){return s+encodeURIComponent(ls(f))}).join(t):s+encodeURIComponent(ls(e[a]))}).join(t):i?encodeURIComponent(ls(i))+r+encodeURIComponent(ls(e)):""},cF=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function Wb(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i",'"',"`"," ","\r",` -`," "],IF=["{","}","|","\\","^","`"].concat(OF),Kh=["'"].concat(IF),zb=["%","/","?",";","#"].concat(Kh),Gb=["/","?","#"],PF=255,Vb=/^[+a-z0-9A-Z_-]{0,63}$/,LF=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,NF={javascript:!0,"javascript:":!0},Jh={javascript:!0,"javascript:":!0},pa={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Xh=_F;function Ms(e,t,r){if(e&&Un.isObject(e)&&e instanceof gn)return e;var i=new gn;return i.parse(e,t,r),i}gn.prototype.parse=function(e,t,r){if(!Un.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),a=i!==-1&&i127?z+="x":z+=F[q];if(!z.match(Vb)){var v=y.slice(0,A),w=y.slice(A+1),E=F.match(LF);E&&(v.push(E[1]),w.unshift(E[2])),w.length&&(c="/"+w.join(".")+c),this.hostname=v.join(".");break}}}this.hostname.length>PF?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=vF.toASCII(this.hostname));var J=this.port?":"+this.port:"",_=this.hostname||"";this.host=_+J,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),c[0]!=="/"&&(c="/"+c))}if(!NF[h])for(var A=0,ie=Kh.length;A0?r.host.split("@"):!1;z&&(r.auth=z.shift(),r.host=r.hostname=z.shift())}return r.search=e.search,r.query=e.query,(!Un.isNull(r.pathname)||!Un.isNull(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!y.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var q=y.slice(-1)[0],ne=(r.host||e.host||y.length>1)&&(q==="."||q==="..")||q==="",v=0,w=y.length;w>=0;w--)q=y[w],q==="."?y.splice(w,1):q===".."?(y.splice(w,1),v++):v&&(y.splice(w,1),v--);if(!K&&!I)for(;v--;v)y.unshift("..");K&&y[0]!==""&&(!y[0]||y[0].charAt(0)!=="/")&&y.unshift(""),ne&&y.join("/").substr(-1)!=="/"&&y.push("");var E=y[0]===""||y[0]&&y[0].charAt(0)==="/";if(F){r.hostname=r.host=E?"":y.length?y.shift():"";var z=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;z&&(r.auth=z.shift(),r.host=r.hostname=z.shift())}return K=K||r.host&&y.length,K&&!E&&y.unshift(""),y.length?r.pathname=y.join("/"):(r.pathname=null,r.path=null),(!Un.isNull(r.pathname)||!Un.isNull(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r};gn.prototype.parseHost=function(){var e=this.host,t=AF.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};function $F(e,t){for(var r=0,i=e.length-1;i>=0;i--){var a=e[i];a==="."?e.splice(i,1):a===".."?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function MF(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:"/";if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)continue;e=i+"/"+e,t=i.charAt(0)==="/"}return e=$F(DF(e.split("/"),function(a){return!!a}),!t).join("/"),(t?"/":"")+e||"."}function DF(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i"u")throw new TypeError('The "domain" argument must be specified');return new Hi("http://"+t).hostname},qE=function(t){if(typeof t>"u")throw new TypeError('The "domain" argument must be specified');return new Hi("http://"+t).hostname},HE=function(t){var r=new Hi("file://"),i=MF(t),a=t.charCodeAt(t.length-1);return a===WF&&i[i.length-1]!=="/"&&(i+="/"),r.pathname=VF(i),r},WE=function(t){if(!zF(t)&&typeof t!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof t+" ("+t+")");var r=new Hi(t);if(r.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return GF(r)},zE=function(t,r){var i,a,s;if(r===void 0&&(r={}),!(t instanceof Hi))return jF(t);if(typeof r!="object"||r===null)throw new TypeError('The "options" argument must be of type object.');var f=(i=r.auth)!=null?i:!0,c=(a=r.fragment)!=null?a:!0,l=(s=r.search)!=null?s:!0,d=new Hi(t.toString());return f||(d.username="",d.password=""),c||(d.hash=""),l||(d.search=""),d.toString()},ZF={format:zE,parse:DE,resolve:jE,resolveObject:$E,Url:FE,URL:Hi,URLSearchParams:UE,domainToASCII:kE,domainToUnicode:qE,pathToFileURL:HE,fileURLToPath:WE};const KF=Object.freeze(Object.defineProperty({__proto__:null,URL:Hi,URLSearchParams:UE,Url:FE,default:ZF,domainToASCII:kE,domainToUnicode:qE,fileURLToPath:WE,format:zE,parse:DE,pathToFileURL:HE,resolve:jE,resolveObject:$E},Symbol.toStringTag,{value:"Module"})),lg=rp(KF);var Zb;function GE(){return Zb||(Zb=1,function(e){var t=rF(),r=CE(),i=nF(),a=iF(),s=lg,f=e;f.request=function(c,l){typeof c=="string"?c=s.parse(c):c=i(c);var d=Qe.location.protocol.search(/^https?:$/)===-1?"http:":"",h=c.protocol||d,b=c.hostname||c.host,R=c.port,A=c.path||"/";b&&b.indexOf(":")!==-1&&(b="["+b+"]"),c.url=(b?h+"//"+b:"")+(R?":"+R:"")+A,c.method=(c.method||"GET").toUpperCase(),c.headers=c.headers||{};var N=new t(c);return l&&N.on("response",l),N},f.get=function(l,d){var h=f.request(l,d);return h.end(),h},f.ClientRequest=t,f.IncomingMessage=r.IncomingMessage,f.Agent=function(){},f.Agent.defaultMaxSockets=4,f.globalAgent=new f.Agent,f.STATUS_CODES=a,f.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}(Jd)),Jd}var th={exports:{}},Kb;function JF(){return Kb||(Kb=1,function(e){var t=GE(),r=lg,i=e.exports;for(var a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);i.request=function(f,c){return f=s(f),t.request.call(this,f,c)},i.get=function(f,c){return f=s(f),t.get.call(this,f,c)};function s(f){if(typeof f=="string"&&(f=r.parse(f)),f.protocol||(f.protocol="https:"),f.protocol!=="https:")throw new Error('Protocol "'+f.protocol+'" not supported. Expected "https:"');return f}}(th)),th.exports}var rh={},nh={},ih,Jb;function XF(){if(Jb)return ih;Jb=1;function e(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}return ih=e,ih}var Tn={},oh={},Xb;function Sl(){return Xb||(Xb=1,function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function r(s,f){return Object.prototype.hasOwnProperty.call(s,f)}e.assign=function(s){for(var f=Array.prototype.slice.call(arguments,1);f.length;){var c=f.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var l in c)r(c,l)&&(s[l]=c[l])}}return s},e.shrinkBuf=function(s,f){return s.length===f?s:s.subarray?s.subarray(0,f):(s.length=f,s)};var i={arraySet:function(s,f,c,l,d){if(f.subarray&&s.subarray){s.set(f.subarray(c,c+l),d);return}for(var h=0;h=0;)V[Ie]=0}var f=0,c=1,l=2,d=3,h=258,b=29,R=256,A=R+1+b,N=30,ae=19,K=2*A+1,I=15,y=16,ie=7,F=256,z=16,q=17,ne=18,v=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_=512,m=new Array((A+2)*2);s(m);var S=new Array(N*2);s(S);var L=new Array(_);s(L);var H=new Array(h-d+1);s(H);var M=new Array(b);s(M);var W=new Array(N);s(W);function P(V,Ie,Be,ke,ge){this.static_tree=V,this.extra_bits=Ie,this.extra_base=Be,this.elems=ke,this.max_length=ge,this.has_stree=V&&V.length}var T,re,j;function Q(V,Ie){this.dyn_tree=V,this.max_code=0,this.stat_desc=Ie}function se(V){return V<256?L[V]:L[256+(V>>>7)]}function de(V,Ie){V.pending_buf[V.pending++]=Ie&255,V.pending_buf[V.pending++]=Ie>>>8&255}function X(V,Ie,Be){V.bi_valid>y-Be?(V.bi_buf|=Ie<>y-V.bi_valid,V.bi_valid+=Be-y):(V.bi_buf|=Ie<>>=1,Be<<=1;while(--Ie>0);return Be>>>1}function te(V){V.bi_valid===16?(de(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):V.bi_valid>=8&&(V.pending_buf[V.pending++]=V.bi_buf&255,V.bi_buf>>=8,V.bi_valid-=8)}function ue(V,Ie){var Be=Ie.dyn_tree,ke=Ie.max_code,ge=Ie.stat_desc.static_tree,Pe=Ie.stat_desc.has_stree,k=Ie.stat_desc.extra_bits,Me=Ie.stat_desc.extra_base,Ge=Ie.stat_desc.max_length,p,Ae,Oe,Z,he,Te,Ke=0;for(Z=0;Z<=I;Z++)V.bl_count[Z]=0;for(Be[V.heap[V.heap_max]*2+1]=0,p=V.heap_max+1;pGe&&(Z=Ge,Ke++),Be[Ae*2+1]=Z,!(Ae>ke)&&(V.bl_count[Z]++,he=0,Ae>=Me&&(he=k[Ae-Me]),Te=Be[Ae*2],V.opt_len+=Te*(Z+he),Pe&&(V.static_len+=Te*(ge[Ae*2+1]+he)));if(Ke!==0){do{for(Z=Ge-1;V.bl_count[Z]===0;)Z--;V.bl_count[Z]--,V.bl_count[Z+1]+=2,V.bl_count[Ge]--,Ke-=2}while(Ke>0);for(Z=Ge;Z!==0;Z--)for(Ae=V.bl_count[Z];Ae!==0;)Oe=V.heap[--p],!(Oe>ke)&&(Be[Oe*2+1]!==Z&&(V.opt_len+=(Z-Be[Oe*2+1])*Be[Oe*2],Be[Oe*2+1]=Z),Ae--)}}function B(V,Ie,Be){var ke=new Array(I+1),ge=0,Pe,k;for(Pe=1;Pe<=I;Pe++)ke[Pe]=ge=ge+Be[Pe-1]<<1;for(k=0;k<=Ie;k++){var Me=V[k*2+1];Me!==0&&(V[k*2]=$(ke[Me]++,Me))}}function U(){var V,Ie,Be,ke,ge,Pe=new Array(I+1);for(Be=0,ke=0;ke>=7;ke8?de(V,V.bi_buf):V.bi_valid>0&&(V.pending_buf[V.pending++]=V.bi_buf),V.bi_buf=0,V.bi_valid=0}function ce(V,Ie,Be,ke){G(V),ke&&(de(V,Be),de(V,~Be)),e.arraySet(V.pending_buf,V.window,Ie,Be,V.pending),V.pending+=Be}function Re(V,Ie,Be,ke){var ge=Ie*2,Pe=Be*2;return V[ge]>1;k>=1;k--)Se(V,Be,k);p=Pe;do k=V.heap[1],V.heap[1]=V.heap[V.heap_len--],Se(V,Be,1),Me=V.heap[1],V.heap[--V.heap_max]=k,V.heap[--V.heap_max]=Me,Be[p*2]=Be[k*2]+Be[Me*2],V.depth[p]=(V.depth[k]>=V.depth[Me]?V.depth[k]:V.depth[Me])+1,Be[k*2+1]=Be[Me*2+1]=p,V.heap[1]=p++,Se(V,Be,1);while(V.heap_len>=2);V.heap[--V.heap_max]=V.heap[1],ue(V,Ie),B(Be,Ge,V.bl_count)}function Ye(V,Ie,Be){var ke,ge=-1,Pe,k=Ie[0*2+1],Me=0,Ge=7,p=4;for(k===0&&(Ge=138,p=3),Ie[(Be+1)*2+1]=65535,ke=0;ke<=Be;ke++)Pe=k,k=Ie[(ke+1)*2+1],!(++Me=3&&V.bl_tree[J[Ie]*2+1]===0;Ie--);return V.opt_len+=3*(Ie+1)+5+5+4,Ie}function et(V,Ie,Be,ke){var ge;for(X(V,Ie-257,5),X(V,Be-1,5),X(V,ke-4,4),ge=0;ge>>=1)if(Ie&1&&V.dyn_ltree[Be*2]!==0)return r;if(V.dyn_ltree[9*2]!==0||V.dyn_ltree[10*2]!==0||V.dyn_ltree[13*2]!==0)return i;for(Be=32;Be0?(V.strm.data_type===a&&(V.strm.data_type=ye(V)),me(V,V.l_desc),me(V,V.d_desc),k=rt(V),ge=V.opt_len+3+7>>>3,Pe=V.static_len+3+7>>>3,Pe<=ge&&(ge=Pe)):ge=Pe=Be+5,Be+4<=ge&&Ie!==-1?Ee(V,Ie,Be,ke):V.strategy===t||Pe===ge?(X(V,(c<<1)+(ke?1:0),3),De(V,m,S)):(X(V,(l<<1)+(ke?1:0),3),et(V,V.l_desc.max_code+1,V.d_desc.max_code+1,k+1),De(V,V.dyn_ltree,V.dyn_dtree)),C(V),ke&&G(V)}function qe(V,Ie,Be){return V.pending_buf[V.d_buf+V.last_lit*2]=Ie>>>8&255,V.pending_buf[V.d_buf+V.last_lit*2+1]=Ie&255,V.pending_buf[V.l_buf+V.last_lit]=Be&255,V.last_lit++,Ie===0?V.dyn_ltree[Be*2]++:(V.matches++,Ie--,V.dyn_ltree[(H[Be]+R+1)*2]++,V.dyn_dtree[se(Ie)*2]++),V.last_lit===V.lit_bufsize-1}return co._tr_init=Y,co._tr_stored_block=Ee,co._tr_flush_block=$e,co._tr_tally=qe,co._tr_align=ve,co}var ah,Qb;function VE(){if(Qb)return ah;Qb=1;function e(t,r,i,a){for(var s=t&65535|0,f=t>>>16&65535|0,c=0;i!==0;){c=i>2e3?2e3:i,i-=c;do s=s+r[a++]|0,f=f+s|0;while(--c);s%=65521,f%=65521}return s|f<<16|0}return ah=e,ah}var sh,ev;function ZE(){if(ev)return sh;ev=1;function e(){for(var i,a=[],s=0;s<256;s++){i=s;for(var f=0;f<8;f++)i=i&1?3988292384^i>>>1:i>>>1;a[s]=i}return a}var t=e();function r(i,a,s,f){var c=t,l=f+s;i^=-1;for(var d=f;d>>8^c[(i^a[d])&255];return i^-1}return sh=r,sh}var fh,tv;function QF(){return tv||(tv=1,fh={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}),fh}var rv;function eU(){if(rv)return Tn;rv=1;var e=Sl(),t=YF(),r=VE(),i=ZE(),a=QF(),s=0,f=1,c=3,l=4,d=5,h=0,b=1,R=-2,A=-3,N=-5,ae=-1,K=1,I=2,y=3,ie=4,F=0,z=2,q=8,ne=9,v=15,w=8,E=29,J=256,_=J+1+E,m=30,S=19,L=2*_+1,H=15,M=3,W=258,P=W+M+1,T=32,re=42,j=69,Q=73,se=91,de=103,X=113,D=666,$=1,te=2,ue=3,B=4,U=3;function C(p,Ae){return p.msg=a[Ae],Ae}function G(p){return(p<<1)-(p>4?9:0)}function ce(p){for(var Ae=p.length;--Ae>=0;)p[Ae]=0}function Re(p){var Ae=p.state,Oe=Ae.pending;Oe>p.avail_out&&(Oe=p.avail_out),Oe!==0&&(e.arraySet(p.output,Ae.pending_buf,Ae.pending_out,Oe,p.next_out),p.next_out+=Oe,Ae.pending_out+=Oe,p.total_out+=Oe,p.avail_out-=Oe,Ae.pending-=Oe,Ae.pending===0&&(Ae.pending_out=0))}function Se(p,Ae){t._tr_flush_block(p,p.block_start>=0?p.block_start:-1,p.strstart-p.block_start,Ae),p.block_start=p.strstart,Re(p.strm)}function De(p,Ae){p.pending_buf[p.pending++]=Ae}function me(p,Ae){p.pending_buf[p.pending++]=Ae>>>8&255,p.pending_buf[p.pending++]=Ae&255}function Ye(p,Ae,Oe,Z){var he=p.avail_in;return he>Z&&(he=Z),he===0?0:(p.avail_in-=he,e.arraySet(Ae,p.input,p.next_in,he,Oe),p.state.wrap===1?p.adler=r(p.adler,Ae,he,Oe):p.state.wrap===2&&(p.adler=i(p.adler,Ae,he,Oe)),p.next_in+=he,p.total_in+=he,he)}function Je(p,Ae){var Oe=p.max_chain_length,Z=p.strstart,he,Te,Ke=p.prev_length,He=p.nice_match,We=p.strstart>p.w_size-P?p.strstart-(p.w_size-P):0,lt=p.window,Ut=p.w_mask,Rt=p.prev,dt=p.strstart+W,Pt=lt[Z+Ke-1],qt=lt[Z+Ke];p.prev_length>=p.good_match&&(Oe>>=2),He>p.lookahead&&(He=p.lookahead);do if(he=Ae,!(lt[he+Ke]!==qt||lt[he+Ke-1]!==Pt||lt[he]!==lt[Z]||lt[++he]!==lt[Z+1])){Z+=2,he++;do;while(lt[++Z]===lt[++he]&<[++Z]===lt[++he]&<[++Z]===lt[++he]&<[++Z]===lt[++he]&<[++Z]===lt[++he]&<[++Z]===lt[++he]&<[++Z]===lt[++he]&<[++Z]===lt[++he]&&ZKe){if(p.match_start=Ae,Ke=Te,Te>=He)break;Pt=lt[Z+Ke-1],qt=lt[Z+Ke]}}while((Ae=Rt[Ae&Ut])>We&&--Oe!==0);return Ke<=p.lookahead?Ke:p.lookahead}function rt(p){var Ae=p.w_size,Oe,Z,he,Te,Ke;do{if(Te=p.window_size-p.lookahead-p.strstart,p.strstart>=Ae+(Ae-P)){e.arraySet(p.window,p.window,Ae,Ae,0),p.match_start-=Ae,p.strstart-=Ae,p.block_start-=Ae,Z=p.hash_size,Oe=Z;do he=p.head[--Oe],p.head[Oe]=he>=Ae?he-Ae:0;while(--Z);Z=Ae,Oe=Z;do he=p.prev[--Oe],p.prev[Oe]=he>=Ae?he-Ae:0;while(--Z);Te+=Ae}if(p.strm.avail_in===0)break;if(Z=Ye(p.strm,p.window,p.strstart+p.lookahead,Te),p.lookahead+=Z,p.lookahead+p.insert>=M)for(Ke=p.strstart-p.insert,p.ins_h=p.window[Ke],p.ins_h=(p.ins_h<p.pending_buf_size-5&&(Oe=p.pending_buf_size-5);;){if(p.lookahead<=1){if(rt(p),p.lookahead===0&&Ae===s)return $;if(p.lookahead===0)break}p.strstart+=p.lookahead,p.lookahead=0;var Z=p.block_start+Oe;if((p.strstart===0||p.strstart>=Z)&&(p.lookahead=p.strstart-Z,p.strstart=Z,Se(p,!1),p.strm.avail_out===0)||p.strstart-p.block_start>=p.w_size-P&&(Se(p,!1),p.strm.avail_out===0))return $}return p.insert=0,Ae===l?(Se(p,!0),p.strm.avail_out===0?ue:B):(p.strstart>p.block_start&&(Se(p,!1),p.strm.avail_out===0),$)}function ye(p,Ae){for(var Oe,Z;;){if(p.lookahead=M&&(p.ins_h=(p.ins_h<=M)if(Z=t._tr_tally(p,p.strstart-p.match_start,p.match_length-M),p.lookahead-=p.match_length,p.match_length<=p.max_lazy_match&&p.lookahead>=M){p.match_length--;do p.strstart++,p.ins_h=(p.ins_h<=M&&(p.ins_h=(p.ins_h<4096)&&(p.match_length=M-1)),p.prev_length>=M&&p.match_length<=p.prev_length){he=p.strstart+p.lookahead-M,Z=t._tr_tally(p,p.strstart-1-p.prev_match,p.prev_length-M),p.lookahead-=p.prev_length-1,p.prev_length-=2;do++p.strstart<=he&&(p.ins_h=(p.ins_h<=M&&p.strstart>0&&(he=p.strstart-1,Z=Ke[he],Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he])){Te=p.strstart+W;do;while(Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he]&&Z===Ke[++he]&&hep.lookahead&&(p.match_length=p.lookahead)}if(p.match_length>=M?(Oe=t._tr_tally(p,1,p.match_length-M),p.lookahead-=p.match_length,p.strstart+=p.match_length,p.match_length=0):(Oe=t._tr_tally(p,0,p.window[p.strstart]),p.lookahead--,p.strstart++),Oe&&(Se(p,!1),p.strm.avail_out===0))return $}return p.insert=0,Ae===l?(Se(p,!0),p.strm.avail_out===0?ue:B):p.last_lit&&(Se(p,!1),p.strm.avail_out===0)?$:te}function Ee(p,Ae){for(var Oe;;){if(p.lookahead===0&&(rt(p),p.lookahead===0)){if(Ae===s)return $;break}if(p.match_length=0,Oe=t._tr_tally(p,0,p.window[p.strstart]),p.lookahead--,p.strstart++,Oe&&(Se(p,!1),p.strm.avail_out===0))return $}return p.insert=0,Ae===l?(Se(p,!0),p.strm.avail_out===0?ue:B):p.last_lit&&(Se(p,!1),p.strm.avail_out===0)?$:te}function ve(p,Ae,Oe,Z,he){this.good_length=p,this.max_lazy=Ae,this.nice_length=Oe,this.max_chain=Z,this.func=he}var $e;$e=[new ve(0,0,0,0,et),new ve(4,4,8,4,ye),new ve(4,5,16,8,ye),new ve(4,6,32,32,ye),new ve(4,4,16,16,O),new ve(8,16,32,32,O),new ve(8,16,128,128,O),new ve(8,32,128,256,O),new ve(32,128,258,1024,O),new ve(32,258,258,4096,O)];function qe(p){p.window_size=2*p.w_size,ce(p.head),p.max_lazy_match=$e[p.level].max_lazy,p.good_match=$e[p.level].good_length,p.nice_match=$e[p.level].nice_length,p.max_chain_length=$e[p.level].max_chain,p.strstart=0,p.block_start=0,p.lookahead=0,p.insert=0,p.match_length=p.prev_length=M-1,p.match_available=0,p.ins_h=0}function V(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=q,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new e.Buf16(L*2),this.dyn_dtree=new e.Buf16((2*m+1)*2),this.bl_tree=new e.Buf16((2*S+1)*2),ce(this.dyn_ltree),ce(this.dyn_dtree),ce(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new e.Buf16(H+1),this.heap=new e.Buf16(2*_+1),ce(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new e.Buf16(2*_+1),ce(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ie(p){var Ae;return!p||!p.state?C(p,R):(p.total_in=p.total_out=0,p.data_type=z,Ae=p.state,Ae.pending=0,Ae.pending_out=0,Ae.wrap<0&&(Ae.wrap=-Ae.wrap),Ae.status=Ae.wrap?re:X,p.adler=Ae.wrap===2?0:1,Ae.last_flush=s,t._tr_init(Ae),h)}function Be(p){var Ae=Ie(p);return Ae===h&&qe(p.state),Ae}function ke(p,Ae){return!p||!p.state||p.state.wrap!==2?R:(p.state.gzhead=Ae,h)}function ge(p,Ae,Oe,Z,he,Te){if(!p)return R;var Ke=1;if(Ae===ae&&(Ae=6),Z<0?(Ke=0,Z=-Z):Z>15&&(Ke=2,Z-=16),he<1||he>ne||Oe!==q||Z<8||Z>15||Ae<0||Ae>9||Te<0||Te>ie)return C(p,R);Z===8&&(Z=9);var He=new V;return p.state=He,He.strm=p,He.wrap=Ke,He.gzhead=null,He.w_bits=Z,He.w_size=1<d||Ae<0)return p?C(p,R):R;if(Z=p.state,!p.output||!p.input&&p.avail_in!==0||Z.status===D&&Ae!==l)return C(p,p.avail_out===0?N:R);if(Z.strm=p,Oe=Z.last_flush,Z.last_flush=Ae,Z.status===re)if(Z.wrap===2)p.adler=0,De(Z,31),De(Z,139),De(Z,8),Z.gzhead?(De(Z,(Z.gzhead.text?1:0)+(Z.gzhead.hcrc?2:0)+(Z.gzhead.extra?4:0)+(Z.gzhead.name?8:0)+(Z.gzhead.comment?16:0)),De(Z,Z.gzhead.time&255),De(Z,Z.gzhead.time>>8&255),De(Z,Z.gzhead.time>>16&255),De(Z,Z.gzhead.time>>24&255),De(Z,Z.level===9?2:Z.strategy>=I||Z.level<2?4:0),De(Z,Z.gzhead.os&255),Z.gzhead.extra&&Z.gzhead.extra.length&&(De(Z,Z.gzhead.extra.length&255),De(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(p.adler=i(p.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=j):(De(Z,0),De(Z,0),De(Z,0),De(Z,0),De(Z,0),De(Z,Z.level===9?2:Z.strategy>=I||Z.level<2?4:0),De(Z,U),Z.status=X);else{var Ke=q+(Z.w_bits-8<<4)<<8,He=-1;Z.strategy>=I||Z.level<2?He=0:Z.level<6?He=1:Z.level===6?He=2:He=3,Ke|=He<<6,Z.strstart!==0&&(Ke|=T),Ke+=31-Ke%31,Z.status=X,me(Z,Ke),Z.strstart!==0&&(me(Z,p.adler>>>16),me(Z,p.adler&65535)),p.adler=1}if(Z.status===j)if(Z.gzhead.extra){for(he=Z.pending;Z.gzindex<(Z.gzhead.extra.length&65535)&&!(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>he&&(p.adler=i(p.adler,Z.pending_buf,Z.pending-he,he)),Re(p),he=Z.pending,Z.pending===Z.pending_buf_size));)De(Z,Z.gzhead.extra[Z.gzindex]&255),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>he&&(p.adler=i(p.adler,Z.pending_buf,Z.pending-he,he)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=Q)}else Z.status=Q;if(Z.status===Q)if(Z.gzhead.name){he=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>he&&(p.adler=i(p.adler,Z.pending_buf,Z.pending-he,he)),Re(p),he=Z.pending,Z.pending===Z.pending_buf_size)){Te=1;break}Z.gzindexhe&&(p.adler=i(p.adler,Z.pending_buf,Z.pending-he,he)),Te===0&&(Z.gzindex=0,Z.status=se)}else Z.status=se;if(Z.status===se)if(Z.gzhead.comment){he=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>he&&(p.adler=i(p.adler,Z.pending_buf,Z.pending-he,he)),Re(p),he=Z.pending,Z.pending===Z.pending_buf_size)){Te=1;break}Z.gzindexhe&&(p.adler=i(p.adler,Z.pending_buf,Z.pending-he,he)),Te===0&&(Z.status=de)}else Z.status=de;if(Z.status===de&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&Re(p),Z.pending+2<=Z.pending_buf_size&&(De(Z,p.adler&255),De(Z,p.adler>>8&255),p.adler=0,Z.status=X)):Z.status=X),Z.pending!==0){if(Re(p),p.avail_out===0)return Z.last_flush=-1,h}else if(p.avail_in===0&&G(Ae)<=G(Oe)&&Ae!==l)return C(p,N);if(Z.status===D&&p.avail_in!==0)return C(p,N);if(p.avail_in!==0||Z.lookahead!==0||Ae!==s&&Z.status!==D){var We=Z.strategy===I?Ee(Z,Ae):Z.strategy===y?Y(Z,Ae):$e[Z.level].func(Z,Ae);if((We===ue||We===B)&&(Z.status=D),We===$||We===ue)return p.avail_out===0&&(Z.last_flush=-1),h;if(We===te&&(Ae===f?t._tr_align(Z):Ae!==d&&(t._tr_stored_block(Z,0,0,!1),Ae===c&&(ce(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),Re(p),p.avail_out===0))return Z.last_flush=-1,h}return Ae!==l?h:Z.wrap<=0?b:(Z.wrap===2?(De(Z,p.adler&255),De(Z,p.adler>>8&255),De(Z,p.adler>>16&255),De(Z,p.adler>>24&255),De(Z,p.total_in&255),De(Z,p.total_in>>8&255),De(Z,p.total_in>>16&255),De(Z,p.total_in>>24&255)):(me(Z,p.adler>>>16),me(Z,p.adler&65535)),Re(p),Z.wrap>0&&(Z.wrap=-Z.wrap),Z.pending!==0?h:b)}function Me(p){var Ae;return!p||!p.state?R:(Ae=p.state.status,Ae!==re&&Ae!==j&&Ae!==Q&&Ae!==se&&Ae!==de&&Ae!==X&&Ae!==D?C(p,R):(p.state=null,Ae===X?C(p,A):h))}function Ge(p,Ae){var Oe=Ae.length,Z,he,Te,Ke,He,We,lt,Ut;if(!p||!p.state||(Z=p.state,Ke=Z.wrap,Ke===2||Ke===1&&Z.status!==re||Z.lookahead))return R;for(Ke===1&&(p.adler=r(p.adler,Ae,Oe,0)),Z.wrap=0,Oe>=Z.w_size&&(Ke===0&&(ce(Z.head),Z.strstart=0,Z.block_start=0,Z.insert=0),Ut=new e.Buf8(Z.w_size),e.arraySet(Ut,Ae,Oe-Z.w_size,Z.w_size,0),Ae=Ut,Oe=Z.w_size),He=p.avail_in,We=p.next_in,lt=p.input,p.avail_in=Oe,p.next_in=0,p.input=Ae,rt(Z);Z.lookahead>=M;){he=Z.strstart,Te=Z.lookahead-(M-1);do Z.ins_h=(Z.ins_h<>>24,K>>>=ne,I-=ne,ne=q>>>16&255,ne===0)m[l++]=q&65535;else if(ne&16){v=q&65535,ne&=15,ne&&(I>>=ne,I-=ne),I<15&&(K+=_[f++]<>>24,K>>>=ne,I-=ne,ne=q>>>16&255,ne&16){if(w=q&65535,ne&=15,Ib){i.msg="invalid distance too far back",s.mode=e;break e}if(K>>>=ne,I-=ne,ne=l-d,w>ne){if(ne=w-ne,ne>A&&s.sane){i.msg="invalid distance too far back",s.mode=e;break e}if(E=0,J=ae,N===0){if(E+=R-ne,ne2;)m[l++]=J[E++],m[l++]=J[E++],m[l++]=J[E++],v-=3;v&&(m[l++]=J[E++],v>1&&(m[l++]=J[E++]))}else{E=l-w;do m[l++]=m[E++],m[l++]=m[E++],m[l++]=m[E++],v-=3;while(v>2);v&&(m[l++]=m[E++],v>1&&(m[l++]=m[E++]))}}else if(ne&64){i.msg="invalid distance code",s.mode=e;break e}else{q=ie[(q&65535)+(K&(1<>3,f-=v,I-=v<<3,K&=(1<=1&&Q[v]===0;v--);if(w>v&&(w=v),v===0)return K[I++]=1<<24|64<<16|0,K[I++]=1<<24|64<<16|0,ie.bits=1,0;for(ne=1;ne0&&(R===a||v!==1))return-1;for(se[1]=0,z=1;zr||R===f&&m>i)return 1;for(;;){D=z-J,y[q]j?($=de[X+y[q]],te=T[re+y[q]]):($=32+64,te=0),L=1<>J)+H]=D<<24|$<<16|te|0;while(H!==0);for(L=1<>=1;if(L!==0?(S&=L-1,S+=L):S=0,q++,--Q[z]===0){if(z===v)break;z=A[N+y[q]]}if(z>w&&(S&W)!==M){for(J===0&&(J=w),P+=ne,E=z-J,_=1<r||R===f&&m>i)return 1;M=S&W,K[M]=w<<24|E<<16|P-I|0}}return S!==0&&(K[P+S]=z-J<<24|64<<16|0),ie.bits=w,0},lh}var ov;function nU(){if(ov)return sn;ov=1;var e=Sl(),t=VE(),r=ZE(),i=tU(),a=rU(),s=0,f=1,c=2,l=4,d=5,h=6,b=0,R=1,A=2,N=-2,ae=-3,K=-4,I=-5,y=8,ie=1,F=2,z=3,q=4,ne=5,v=6,w=7,E=8,J=9,_=10,m=11,S=12,L=13,H=14,M=15,W=16,P=17,T=18,re=19,j=20,Q=21,se=22,de=23,X=24,D=25,$=26,te=27,ue=28,B=29,U=30,C=31,G=32,ce=852,Re=592,Se=15,De=Se;function me(ge){return(ge>>>24&255)+(ge>>>8&65280)+((ge&65280)<<8)+((ge&255)<<24)}function Ye(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Je(ge){var Pe;return!ge||!ge.state?N:(Pe=ge.state,ge.total_in=ge.total_out=Pe.total=0,ge.msg="",Pe.wrap&&(ge.adler=Pe.wrap&1),Pe.mode=ie,Pe.last=0,Pe.havedict=0,Pe.dmax=32768,Pe.head=null,Pe.hold=0,Pe.bits=0,Pe.lencode=Pe.lendyn=new e.Buf32(ce),Pe.distcode=Pe.distdyn=new e.Buf32(Re),Pe.sane=1,Pe.back=-1,b)}function rt(ge){var Pe;return!ge||!ge.state?N:(Pe=ge.state,Pe.wsize=0,Pe.whave=0,Pe.wnext=0,Je(ge))}function et(ge,Pe){var k,Me;return!ge||!ge.state||(Me=ge.state,Pe<0?(k=0,Pe=-Pe):(k=(Pe>>4)+1,Pe<48&&(Pe&=15)),Pe&&(Pe<8||Pe>15))?N:(Me.window!==null&&Me.wbits!==Pe&&(Me.window=null),Me.wrap=k,Me.wbits=Pe,rt(ge))}function ye(ge,Pe){var k,Me;return ge?(Me=new Ye,ge.state=Me,Me.window=null,k=et(ge,Pe),k!==b&&(ge.state=null),k):N}function O(ge){return ye(ge,De)}var Y=!0,Ee,ve;function $e(ge){if(Y){var Pe;for(Ee=new e.Buf32(512),ve=new e.Buf32(32),Pe=0;Pe<144;)ge.lens[Pe++]=8;for(;Pe<256;)ge.lens[Pe++]=9;for(;Pe<280;)ge.lens[Pe++]=7;for(;Pe<288;)ge.lens[Pe++]=8;for(a(f,ge.lens,0,288,Ee,0,ge.work,{bits:9}),Pe=0;Pe<32;)ge.lens[Pe++]=5;a(c,ge.lens,0,32,ve,0,ge.work,{bits:5}),Y=!1}ge.lencode=Ee,ge.lenbits=9,ge.distcode=ve,ge.distbits=5}function qe(ge,Pe,k,Me){var Ge,p=ge.state;return p.window===null&&(p.wsize=1<=p.wsize?(e.arraySet(p.window,Pe,k-p.wsize,p.wsize,0),p.wnext=0,p.whave=p.wsize):(Ge=p.wsize-p.wnext,Ge>Me&&(Ge=Me),e.arraySet(p.window,Pe,k-Me,Ge,p.wnext),Me-=Ge,Me?(e.arraySet(p.window,Pe,k-Me,Me,0),p.wnext=Me,p.whave=p.wsize):(p.wnext+=Ge,p.wnext===p.wsize&&(p.wnext=0),p.whave>>8&255,k.check=r(k.check,kt,2,0),he=0,Te=0,k.mode=F;break}if(k.flags=0,k.head&&(k.head.done=!1),!(k.wrap&1)||(((he&255)<<8)+(he>>8))%31){ge.msg="incorrect header check",k.mode=U;break}if((he&15)!==y){ge.msg="unknown compression method",k.mode=U;break}if(he>>>=4,Te-=4,Ct=(he&15)+8,k.wbits===0)k.wbits=Ct;else if(Ct>k.wbits){ge.msg="invalid window size",k.mode=U;break}k.dmax=1<>8&1),k.flags&512&&(kt[0]=he&255,kt[1]=he>>>8&255,k.check=r(k.check,kt,2,0)),he=0,Te=0,k.mode=z;case z:for(;Te<32;){if(Oe===0)break e;Oe--,he+=Me[p++]<>>8&255,kt[2]=he>>>16&255,kt[3]=he>>>24&255,k.check=r(k.check,kt,4,0)),he=0,Te=0,k.mode=q;case q:for(;Te<16;){if(Oe===0)break e;Oe--,he+=Me[p++]<>8),k.flags&512&&(kt[0]=he&255,kt[1]=he>>>8&255,k.check=r(k.check,kt,2,0)),he=0,Te=0,k.mode=ne;case ne:if(k.flags&1024){for(;Te<16;){if(Oe===0)break e;Oe--,he+=Me[p++]<>>8&255,k.check=r(k.check,kt,2,0)),he=0,Te=0}else k.head&&(k.head.extra=null);k.mode=v;case v:if(k.flags&1024&&(We=k.length,We>Oe&&(We=Oe),We&&(k.head&&(Ct=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),e.arraySet(k.head.extra,Me,p,We,Ct)),k.flags&512&&(k.check=r(k.check,Me,We,p)),Oe-=We,p+=We,k.length-=We),k.length))break e;k.length=0,k.mode=w;case w:if(k.flags&2048){if(Oe===0)break e;We=0;do Ct=Me[p+We++],k.head&&Ct&&k.length<65536&&(k.head.name+=String.fromCharCode(Ct));while(Ct&&We>9&1,k.head.done=!0),ge.adler=k.check=0,k.mode=S;break;case _:for(;Te<32;){if(Oe===0)break e;Oe--,he+=Me[p++]<>>=Te&7,Te-=Te&7,k.mode=te;break}for(;Te<3;){if(Oe===0)break e;Oe--,he+=Me[p++]<>>=1,Te-=1,he&3){case 0:k.mode=H;break;case 1:if($e(k),k.mode=j,Pe===h){he>>>=2,Te-=2;break e}break;case 2:k.mode=P;break;case 3:ge.msg="invalid block type",k.mode=U}he>>>=2,Te-=2;break;case H:for(he>>>=Te&7,Te-=Te&7;Te<32;){if(Oe===0)break e;Oe--,he+=Me[p++]<>>16^65535)){ge.msg="invalid stored block lengths",k.mode=U;break}if(k.length=he&65535,he=0,Te=0,k.mode=M,Pe===h)break e;case M:k.mode=W;case W:if(We=k.length,We){if(We>Oe&&(We=Oe),We>Z&&(We=Z),We===0)break e;e.arraySet(Ge,Me,p,We,Ae),Oe-=We,p+=We,Z-=We,Ae+=We,k.length-=We;break}k.mode=S;break;case P:for(;Te<14;){if(Oe===0)break e;Oe--,he+=Me[p++]<>>=5,Te-=5,k.ndist=(he&31)+1,he>>>=5,Te-=5,k.ncode=(he&15)+4,he>>>=4,Te-=4,k.nlen>286||k.ndist>30){ge.msg="too many length or distance symbols",k.mode=U;break}k.have=0,k.mode=T;case T:for(;k.have>>=3,Te-=3}for(;k.have<19;)k.lens[Bn[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,pr={bits:k.lenbits},tr=a(s,k.lens,0,19,k.lencode,0,k.work,pr),k.lenbits=pr.bits,tr){ge.msg="invalid code lengths set",k.mode=U;break}k.have=0,k.mode=re;case re:for(;k.have>>24,Pt=Rt>>>16&255,qt=Rt&65535,!(dt<=Te);){if(Oe===0)break e;Oe--,he+=Me[p++]<>>=dt,Te-=dt,k.lens[k.have++]=qt;else{if(qt===16){for(Ht=dt+2;Te>>=dt,Te-=dt,k.have===0){ge.msg="invalid bit length repeat",k.mode=U;break}Ct=k.lens[k.have-1],We=3+(he&3),he>>>=2,Te-=2}else if(qt===17){for(Ht=dt+3;Te>>=dt,Te-=dt,Ct=0,We=3+(he&7),he>>>=3,Te-=3}else{for(Ht=dt+7;Te>>=dt,Te-=dt,Ct=0,We=11+(he&127),he>>>=7,Te-=7}if(k.have+We>k.nlen+k.ndist){ge.msg="invalid bit length repeat",k.mode=U;break}for(;We--;)k.lens[k.have++]=Ct}}if(k.mode===U)break;if(k.lens[256]===0){ge.msg="invalid code -- missing end-of-block",k.mode=U;break}if(k.lenbits=9,pr={bits:k.lenbits},tr=a(f,k.lens,0,k.nlen,k.lencode,0,k.work,pr),k.lenbits=pr.bits,tr){ge.msg="invalid literal/lengths set",k.mode=U;break}if(k.distbits=6,k.distcode=k.distdyn,pr={bits:k.distbits},tr=a(c,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,pr),k.distbits=pr.bits,tr){ge.msg="invalid distances set",k.mode=U;break}if(k.mode=j,Pe===h)break e;case j:k.mode=Q;case Q:if(Oe>=6&&Z>=258){ge.next_out=Ae,ge.avail_out=Z,ge.next_in=p,ge.avail_in=Oe,k.hold=he,k.bits=Te,i(ge,He),Ae=ge.next_out,Ge=ge.output,Z=ge.avail_out,p=ge.next_in,Me=ge.input,Oe=ge.avail_in,he=k.hold,Te=k.bits,k.mode===S&&(k.back=-1);break}for(k.back=0;Rt=k.lencode[he&(1<>>24,Pt=Rt>>>16&255,qt=Rt&65535,!(dt<=Te);){if(Oe===0)break e;Oe--,he+=Me[p++]<>Kt)],dt=Rt>>>24,Pt=Rt>>>16&255,qt=Rt&65535,!(Kt+dt<=Te);){if(Oe===0)break e;Oe--,he+=Me[p++]<>>=Kt,Te-=Kt,k.back+=Kt}if(he>>>=dt,Te-=dt,k.back+=dt,k.length=qt,Pt===0){k.mode=$;break}if(Pt&32){k.back=-1,k.mode=S;break}if(Pt&64){ge.msg="invalid literal/length code",k.mode=U;break}k.extra=Pt&15,k.mode=se;case se:if(k.extra){for(Ht=k.extra;Te>>=k.extra,Te-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=de;case de:for(;Rt=k.distcode[he&(1<>>24,Pt=Rt>>>16&255,qt=Rt&65535,!(dt<=Te);){if(Oe===0)break e;Oe--,he+=Me[p++]<>Kt)],dt=Rt>>>24,Pt=Rt>>>16&255,qt=Rt&65535,!(Kt+dt<=Te);){if(Oe===0)break e;Oe--,he+=Me[p++]<>>=Kt,Te-=Kt,k.back+=Kt}if(he>>>=dt,Te-=dt,k.back+=dt,Pt&64){ge.msg="invalid distance code",k.mode=U;break}k.offset=qt,k.extra=Pt&15,k.mode=X;case X:if(k.extra){for(Ht=k.extra;Te>>=k.extra,Te-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){ge.msg="invalid distance too far back",k.mode=U;break}k.mode=D;case D:if(Z===0)break e;if(We=He-Z,k.offset>We){if(We=k.offset-We,We>k.whave&&k.sane){ge.msg="invalid distance too far back",k.mode=U;break}We>k.wnext?(We-=k.wnext,lt=k.wsize-We):lt=k.wnext-We,We>k.length&&(We=k.length),Ut=k.window}else Ut=Ge,lt=Ae-k.offset,We=k.length;We>Z&&(We=Z),Z-=We,k.length-=We;do Ge[Ae++]=Ut[lt++];while(--We);k.length===0&&(k.mode=Q);break;case $:if(Z===0)break e;Ge[Ae++]=k.length,Z--,k.mode=Q;break;case te:if(k.wrap){for(;Te<32;){if(Oe===0)break e;Oe--,he|=Me[p++]<e.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=h,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}d.prototype.close=function(){if(this.write_in_progress){this.pending_close=!0;return}this.pending_close=!1,t(this.init_done,"close before init"),t(this.mode<=e.UNZIP),this.mode===e.DEFLATE||this.mode===e.GZIP||this.mode===e.DEFLATERAW?i.deflateEnd(this.strm):(this.mode===e.INFLATE||this.mode===e.GUNZIP||this.mode===e.INFLATERAW||this.mode===e.UNZIP)&&a.inflateEnd(this.strm),this.mode=e.NONE,this.dictionary=null},d.prototype.write=function(h,b,R,A,N,ae,K){return this._write(!0,h,b,R,A,N,ae,K)},d.prototype.writeSync=function(h,b,R,A,N,ae,K){return this._write(!1,h,b,R,A,N,ae,K)},d.prototype._write=function(h,b,R,A,N,ae,K,I){if(t.equal(arguments.length,8),t(this.init_done,"write before init"),t(this.mode!==e.NONE,"already finalized"),t.equal(!1,this.write_in_progress,"write already in progress"),t.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,t.equal(!1,b===void 0,"must provide flush value"),this.write_in_progress=!0,b!==e.Z_NO_FLUSH&&b!==e.Z_PARTIAL_FLUSH&&b!==e.Z_SYNC_FLUSH&&b!==e.Z_FULL_FLUSH&&b!==e.Z_FINISH&&b!==e.Z_BLOCK)throw new Error("Invalid flush value");if(R==null&&(R=Ce.Buffer.alloc(0),N=0,A=0),this.strm.avail_in=N,this.strm.input=R,this.strm.next_in=A,this.strm.avail_out=I,this.strm.output=ae,this.strm.next_out=K,this.flush=b,!h)return this._process(),this._checkError()?this._afterSync():void 0;var y=this;return Ce.process.nextTick(function(){y._process(),y._after()}),this},d.prototype._afterSync=function(){var h=this.strm.avail_out,b=this.strm.avail_in;return this.write_in_progress=!1,[b,h]},d.prototype._process=function(){var h=null;switch(this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=i.deflate(this.strm,this.flush);break;case e.UNZIP:switch(this.strm.avail_in>0&&(h=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(h===null)break;if(this.strm.input[h]===c){if(this.gzip_id_bytes_read=1,h++,this.strm.avail_in===1)break}else{this.mode=e.INFLATE;break}case 1:if(h===null)break;this.strm.input[h]===l?(this.gzip_id_bytes_read=2,this.mode=e.GUNZIP):this.mode=e.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:for(this.err=a.inflate(this.strm,this.flush),this.err===e.Z_NEED_DICT&&this.dictionary&&(this.err=a.inflateSetDictionary(this.strm,this.dictionary),this.err===e.Z_OK?this.err=a.inflate(this.strm,this.flush):this.err===e.Z_DATA_ERROR&&(this.err=e.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===e.GUNZIP&&this.err===e.Z_STREAM_END&&this.strm.next_in[0]!==0;)this.reset(),this.err=a.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},d.prototype._checkError=function(){switch(this.err){case e.Z_OK:case e.Z_BUF_ERROR:if(this.strm.avail_out!==0&&this.flush===e.Z_FINISH)return this._error("unexpected end of file"),!1;break;case e.Z_STREAM_END:break;case e.Z_NEED_DICT:return this.dictionary==null?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},d.prototype._after=function(){if(this._checkError()){var h=this.strm.avail_out,b=this.strm.avail_in;this.write_in_progress=!1,this.callback(b,h),this.pending_close&&this.close()}},d.prototype._error=function(h){this.strm.msg&&(h=this.strm.msg),this.onerror(h,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},d.prototype.init=function(h,b,R,A,N){t(arguments.length===4||arguments.length===5,"init(windowBits, level, memLevel, strategy, [dictionary])"),t(h>=8&&h<=15,"invalid windowBits"),t(b>=-1&&b<=9,"invalid compression level"),t(R>=1&&R<=9,"invalid memlevel"),t(A===e.Z_FILTERED||A===e.Z_HUFFMAN_ONLY||A===e.Z_RLE||A===e.Z_FIXED||A===e.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(b,h,R,A,N),this._setDictionary()},d.prototype.params=function(){throw new Error("deflateParams Not supported")},d.prototype.reset=function(){this._reset(),this._setDictionary()},d.prototype._init=function(h,b,R,A,N){switch(this.level=h,this.windowBits=b,this.memLevel=R,this.strategy=A,this.flush=e.Z_NO_FLUSH,this.err=e.Z_OK,(this.mode===e.GZIP||this.mode===e.GUNZIP)&&(this.windowBits+=16),this.mode===e.UNZIP&&(this.windowBits+=32),(this.mode===e.DEFLATERAW||this.mode===e.INFLATERAW)&&(this.windowBits=-1*this.windowBits),this.strm=new r,this.mode){case e.DEFLATE:case e.GZIP:case e.DEFLATERAW:this.err=i.deflateInit2(this.strm,this.level,e.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case e.INFLATE:case e.GUNZIP:case e.INFLATERAW:case e.UNZIP:this.err=a.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==e.Z_OK&&this._error("Init error"),this.dictionary=N,this.write_in_progress=!1,this.init_done=!0},d.prototype._setDictionary=function(){if(this.dictionary!=null){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:this.err=i.deflateSetDictionary(this.strm,this.dictionary);break}this.err!==e.Z_OK&&this._error("Failed to set dictionary")}},d.prototype._reset=function(){switch(this.err=e.Z_OK,this.mode){case e.DEFLATE:case e.DEFLATERAW:case e.GZIP:this.err=i.deflateReset(this.strm);break;case e.INFLATE:case e.INFLATERAW:case e.GUNZIP:this.err=a.inflateReset(this.strm);break}this.err!==e.Z_OK&&this._error("Failed to reset stream")},e.Zlib=d}(nh)),nh}var fv;function aU(){return fv||(fv=1,function(e){var t=Vr.Buffer,r=kP.Transform,i=oU(),a=Zn,s=_u().ok,f=Vr.kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+f.toString(16)+" bytes";i.Z_MIN_WINDOWBITS=8,i.Z_MAX_WINDOWBITS=15,i.Z_DEFAULT_WINDOWBITS=15,i.Z_MIN_CHUNK=64,i.Z_MAX_CHUNK=1/0,i.Z_DEFAULT_CHUNK=16*1024,i.Z_MIN_MEMLEVEL=1,i.Z_MAX_MEMLEVEL=9,i.Z_DEFAULT_MEMLEVEL=8,i.Z_MIN_LEVEL=-1,i.Z_MAX_LEVEL=9,i.Z_DEFAULT_LEVEL=i.Z_DEFAULT_COMPRESSION;for(var l=Object.keys(i),d=0;d=f?re=new RangeError(c):T=t.concat(L,H),L=[],_.close(),S(re,T)}}function K(_,m){if(typeof m=="string"&&(m=t.from(m)),!t.isBuffer(m))throw new TypeError("Not a string or buffer");var S=_._finishFlushFlag;return _._processChunk(m,S)}function I(_){if(!(this instanceof I))return new I(_);w.call(this,_,i.DEFLATE)}function y(_){if(!(this instanceof y))return new y(_);w.call(this,_,i.INFLATE)}function ie(_){if(!(this instanceof ie))return new ie(_);w.call(this,_,i.GZIP)}function F(_){if(!(this instanceof F))return new F(_);w.call(this,_,i.GUNZIP)}function z(_){if(!(this instanceof z))return new z(_);w.call(this,_,i.DEFLATERAW)}function q(_){if(!(this instanceof q))return new q(_);w.call(this,_,i.INFLATERAW)}function ne(_){if(!(this instanceof ne))return new ne(_);w.call(this,_,i.UNZIP)}function v(_){return _===i.Z_NO_FLUSH||_===i.Z_PARTIAL_FLUSH||_===i.Z_SYNC_FLUSH||_===i.Z_FULL_FLUSH||_===i.Z_FINISH||_===i.Z_BLOCK}function w(_,m){var S=this;if(this._opts=_=_||{},this._chunkSize=_.chunkSize||e.Z_DEFAULT_CHUNK,r.call(this,_),_.flush&&!v(_.flush))throw new Error("Invalid flush flag: "+_.flush);if(_.finishFlush&&!v(_.finishFlush))throw new Error("Invalid flush flag: "+_.finishFlush);if(this._flushFlag=_.flush||i.Z_NO_FLUSH,this._finishFlushFlag=typeof _.finishFlush<"u"?_.finishFlush:i.Z_FINISH,_.chunkSize&&(_.chunkSizee.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+_.chunkSize);if(_.windowBits&&(_.windowBitse.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+_.windowBits);if(_.level&&(_.levele.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+_.level);if(_.memLevel&&(_.memLevele.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+_.memLevel);if(_.strategy&&_.strategy!=e.Z_FILTERED&&_.strategy!=e.Z_HUFFMAN_ONLY&&_.strategy!=e.Z_RLE&&_.strategy!=e.Z_FIXED&&_.strategy!=e.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+_.strategy);if(_.dictionary&&!t.isBuffer(_.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new i.Zlib(m);var L=this;this._hadError=!1,this._handle.onerror=function(W,P){E(L),L._hadError=!0;var T=new Error(W);T.errno=P,T.code=e.codes[P],L.emit("error",T)};var H=e.Z_DEFAULT_COMPRESSION;typeof _.level=="number"&&(H=_.level);var M=e.Z_DEFAULT_STRATEGY;typeof _.strategy=="number"&&(M=_.strategy),this._handle.init(_.windowBits||e.Z_DEFAULT_WINDOWBITS,H,_.memLevel||e.Z_DEFAULT_MEMLEVEL,M,_.dictionary),this._buffer=t.allocUnsafe(this._chunkSize),this._offset=0,this._level=H,this._strategy=M,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!S._handle},configurable:!0,enumerable:!0})}a.inherits(w,r),w.prototype.params=function(_,m,S){if(_e.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+_);if(m!=e.Z_FILTERED&&m!=e.Z_HUFFMAN_ONLY&&m!=e.Z_RLE&&m!=e.Z_FIXED&&m!=e.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+m);if(this._level!==_||this._strategy!==m){var L=this;this.flush(i.Z_SYNC_FLUSH,function(){s(L._handle,"zlib binding closed"),L._handle.params(_,m),L._hadError||(L._level=_,L._strategy=m,S&&S())})}else Ce.process.nextTick(S)},w.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},w.prototype._flush=function(_){this._transform(t.alloc(0),"",_)},w.prototype.flush=function(_,m){var S=this,L=this._writableState;(typeof _=="function"||_===void 0&&!m)&&(m=_,_=i.Z_FULL_FLUSH),L.ended?m&&Ce.process.nextTick(m):L.ending?m&&this.once("end",m):L.needDrain?m&&this.once("drain",function(){return S.flush(_,m)}):(this._flushFlag=_,this.write(t.alloc(0),"",m))},w.prototype.close=function(_){E(this,_),Ce.process.nextTick(J,this)};function E(_,m){m&&Ce.process.nextTick(m),_._handle&&(_._handle.close(),_._handle=null)}function J(_){_.emit("close")}w.prototype._transform=function(_,m,S){var L,H=this._writableState,M=H.ending||H.ended,W=M&&(!_||H.length===_.length);if(_!==null&&!t.isBuffer(_))return S(new Error("invalid input"));if(!this._handle)return S(new Error("zlib binding closed"));W?L=this._finishFlushFlag:(L=this._flushFlag,_.length>=H.length&&(this._flushFlag=this._opts.flush||i.Z_NO_FLUSH)),this._processChunk(_,L,S)},w.prototype._processChunk=function(_,m,S){var L=_&&_.length,H=this._chunkSize-this._offset,M=0,W=this,P=typeof S=="function";if(!P){var T=[],re=0,j;this.on("error",function(D){j=D}),s(this._handle,"zlib binding closed");do var Q=this._handle.writeSync(m,_,M,L,this._buffer,this._offset,H);while(!this._hadError&&X(Q[0],Q[1]));if(this._hadError)throw j;if(re>=f)throw E(this),new RangeError(c);var se=t.concat(T,re);return E(this),se}s(this._handle,"zlib binding closed");var de=this._handle.write(m,_,M,L,this._buffer,this._offset,H);de.buffer=_,de.callback=X;function X(D,$){if(this&&(this.buffer=null,this.callback=null),!W._hadError){var te=H-$;if(s(te>=0,"have should not go down"),te>0){var ue=W._buffer.slice(W._offset,W._offset+te);W._offset+=te,P?W.push(ue):(T.push(ue),re+=ue.length)}if(($===0||W._offset>=W._chunkSize)&&(H=W._chunkSize,W._offset=0,W._buffer=t.allocUnsafe(W._chunkSize)),$===0){if(M+=L-D,L=D,!P)return!0;var B=W._handle.write(m,_,M,L,W._buffer,W._offset,W._chunkSize);B.callback=X,B.buffer=_;return}if(!P)return!1;S()}}},a.inherits(I,w),a.inherits(y,w),a.inherits(ie,w),a.inherits(F,w),a.inherits(z,w),a.inherits(q,w),a.inherits(ne,w)}(rh)),rh}Object.defineProperty(Ao,"__esModule",{value:!0});Ao.InvalidStatusCodeError=Ao.InvalidCertError=void 0;const KE=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class Yh extends Error{constructor(t,r){super(t),this.fingerprint256=r}}Ao.InvalidCertError=Yh;class cg extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}Ao.InvalidStatusCodeError=cg;function JE(e,t){if(!t||t==="text"||t==="json")try{let r=new TextDecoder("utf8",{fatal:!0}).decode(e);if(t==="text")return r;try{return JSON.parse(r)}catch(i){if(t==="json")throw i;return r}}catch(r){if(t==="text"||t==="json")throw r}return e}let uv={};function Qh(e,t){var R;let r={...KE,...t};const i=GE(),a=JF(),s=aU(),{promisify:f}=Zn,{resolve:c}=lg,l=!!/^https/.test(e);let d={method:r.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const h=A=>A.replace(/:| /g,"").toLowerCase();if(r.keepAlive){const A={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},N=[l,l&&((R=r.sslPinnedCertificates)==null?void 0:R.map(ae=>h(ae)).sort())].join();d.agent=uv[N]||(uv[N]=new(l?a:i).Agent(A))}r.type==="json"&&(d.headers["Content-Type"]="application/json"),r.data&&(r.method||(d.method="POST"),d.body=r.type==="json"?JSON.stringify(r.data):r.data),d.headers={...d.headers,...r.headers},r.sslAllowSelfSigned&&(d.rejectUnauthorized=!1);const b=async A=>{const N=A.statusCode;if(r.redirect&&300<=N&&N<400&&A.headers.location){if(r._redirectCount==10)throw new Error("Request failed. Too much redirects.");return r._redirectCount+=1,await Qh(c(e,A.headers.location),r)}if(r.expectStatusCode&&N!==r.expectStatusCode)throw A.resume(),new cg(N);let ae=[];for await(const ie of A)ae.push(ie);let K=Ce.Buffer.concat(ae);const I=A.headers["content-encoding"];I==="br"&&(K=await f(s.brotliDecompress)(K)),(I==="gzip"||I==="deflate")&&(K=await f(s.unzip)(K));const y=JE(K,r.type);return r.full?{headers:A.headers,status:N,body:y}:y};return new Promise((A,N)=>{var ie;const ae=async F=>{if(F&&F.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await Qh(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(z){z&&z.fingerprint256&&(F=new Yh(`Self-signed SSL certificate: ${z.fingerprint256}`,z.fingerprint256))}N(F)},K=(l?a:i).request(e,d,F=>{F.on("error",ae),(async()=>{try{A(await b(F))}catch(z){N(z)}})()});K.on("error",ae);const I=(ie=r.sslPinnedCertificates)==null?void 0:ie.map(F=>h(F)),y=F=>{var q;const z=h(((q=F.getPeerCertificate())==null?void 0:q.fingerprint256)||"");if(!(!z&&F.isSessionReused())&&!I.includes(z))return K.emit("error",new Yh(`Invalid SSL certificate: ${z} Expected: ${I}`,z)),K.abort()};r.sslPinnedCertificates&&K.on("socket",F=>{F.listeners("secureConnect").map(q=>(q.name||"").replace("bound ","")).includes("mfetchSecureConnect")||F.on("secureConnect",y.bind(null,F))}),r.keepAlive&&K.setNoDelay(!0),d.body&&K.write(d.body),K.end()})}const sU=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(e=>e.toLowerCase())),fU=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(e=>e.toLowerCase()));async function uU(e,t){let r={...KE,...t};const i=new Headers;r.type==="json"&&i.set("Content-Type","application/json");let a=new URL(e);if(a.username){const l=btoa(`${a.username}:${a.password}`);i.set("Authorization",`Basic ${l}`),a.username="",a.password=""}e=""+a;for(let l in r.headers){const d=l.toLowerCase();(sU.has(d)||r.cors&&!fU.has(d))&&i.set(l,r.headers[l])}let s={headers:i,redirect:r.redirect?"follow":"manual"};r.referrer||(s.referrerPolicy="no-referrer"),r.cors&&(s.mode="cors"),r.data&&(r.method||(s.method="POST"),s.body=r.type==="json"?JSON.stringify(r.data):r.data);const f=await fetch(e,s);if(r.expectStatusCode&&f.status!==r.expectStatusCode)throw new cg(f.status);const c=JE(new Uint8Array(await f.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(f.headers.entries()),status:f.status,body:c}:c}const lU=!!(typeof Ce.process=="object"&&Ce.process.versions&&Ce.process.versions.node&&Ce.process.versions.v8);function cU(e,t){return(lU?Qh:uU)(e,t)}Ao.default=cU;Object.defineProperty(Ra,"__esModule",{value:!0});Ra.getProvider=Ra.fetchFromProvider=void 0;const dU=Ao,hU=async(e,t)=>(await(0,dU.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;Ra.fetchFromProvider=hU;const pU=e=>{var t;if(typeof e=="string")return e;if(((t=e==null?void 0:e.connection)==null?void 0:t.url)!==void 0)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};Ra.getProvider=pU;(function(e){var t=Qe&&Qe.__createBinding||(Object.create?function(a,s,f,c){c===void 0&&(c=f);var l=Object.getOwnPropertyDescriptor(s,f);(!l||("get"in l?!s.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return s[f]}}),Object.defineProperty(a,c,l)}:function(a,s,f,c){c===void 0&&(c=f),a[c]=s[f]}),r=Qe&&Qe.__exportStar||function(a,s){for(var f in a)f!=="default"&&!Object.prototype.hasOwnProperty.call(s,f)&&t(s,a,f)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(ul,e),r(yl,e),r(ag,e),r($s,e),r(bl,e),r(Sr,e),r(Co,e),r(ug,e),r(LE,e),r(ml,e);var i=Ft;Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return i.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),r(El,e),r(Ra,e)})(AD);var XE={exports:{}};(function(e){(function(t,r){e.exports?e.exports=r():t.log=r()})(Qe,function(){var t=function(){},r="undefined",i=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"];function s(ae,K){var I=ae[K];if(typeof I.bind=="function")return I.bind(ae);try{return Function.prototype.bind.call(I,ae)}catch{return function(){return Function.prototype.apply.apply(I,[ae,arguments])}}}function f(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(ae){return ae==="debug"&&(ae="log"),typeof console===r?!1:ae==="trace"&&i?f:console[ae]!==void 0?s(console,ae):console.log!==void 0?s(console,"log"):t}function l(ae,K){for(var I=0;I=0&&w<=y.levels.SILENT){if(ie=w,E!==!1&&z(w),l.call(y,w,ae),typeof console===r&&w-1}function Kt(fe,_e){var Le=this.__data__,Ve=Fr(Le,fe);return Ve<0?(++this.size,Le.push([fe,_e])):Le[Ve][1]=_e,this}Ut.prototype.clear=Rt,Ut.prototype.delete=dt,Ut.prototype.get=Pt,Ut.prototype.has=qt,Ut.prototype.set=Kt;function hr(fe){var _e=-1,Le=fe==null?0:fe.length;for(this.clear();++_e1?Le[bt-1]:void 0,ct=bt>2?Le[2]:void 0;for(Lt=fe.length>3&&typeof Lt=="function"?(bt--,Lt):void 0,ct&&Gs(Le[0],Le[1],ct)&&(Lt=bt<3?void 0:Lt,bt=1),_e=Object(_e);++Ve-1&&fe%1==0&&fe<_e}function Gs(fe,_e,Le){if(!vn(Le))return!1;var Ve=typeof _e;return(Ve=="number"?jo(Le)&&zs(_e,Le.length):Ve=="string"&&_e in Le)?Do(Le[_e],fe):!1}function $a(fe){var _e=typeof fe;return _e=="string"||_e=="number"||_e=="symbol"||_e=="boolean"?fe!=="__proto__":fe===null}function Ma(fe){return!!ye&&ye in fe}function Qn(fe){var _e=fe&&fe.constructor,Le=typeof _e=="function"&&_e.prototype||Ye;return fe===Le}function Vs(fe){var _e=[];if(fe!=null)for(var Le in Object(fe))_e.push(Le);return _e}function Zs(fe){return O.call(fe)}function Nl(fe,_e,Le){return _e=Ge(_e===void 0?fe.length-1:_e,0),function(){for(var Ve=arguments,bt=-1,Lt=Ge(Ve.length-_e,0),ct=Array(Lt);++bt0){if(++_e>=a)return arguments[0]}else _e=0;return fe.apply(void 0,arguments)}}function Xs(fe){if(fe!=null){try{return rt.call(fe)}catch{}try{return fe+""}catch{}}return""}function Do(fe,_e){return fe===_e||fe!==fe&&_e!==_e}var Da=Yn(function(){return arguments}())?Yn:function(fe){return eo(fe)&&et.call(fe,"callee")&&!ke.call(fe,"callee")},ja=Array.isArray;function jo(fe){return fe!=null&&Qs(fe.length)&&!Fa(fe)}function Cl(fe){return eo(fe)&&jo(fe)}var Ys=Me||$l;function Fa(fe){if(!vn(fe))return!1;var _e=xn(fe);return _e==A||_e==N||_e==d||_e==ie}function Qs(fe){return typeof fe=="number"&&fe>-1&&fe%1==0&&fe<=f}function vn(fe){var _e=typeof fe;return fe!=null&&(_e=="object"||_e=="function")}function eo(fe){return fe!=null&&typeof fe=="object"}function Bl(fe){if(!eo(fe)||xn(fe)!=y)return!1;var _e=Ie(fe);if(_e===null)return!0;var Le=et.call(_e,"constructor")&&_e.constructor;return typeof Le=="function"&&Le instanceof Le&&rt.call(Le)==Y}var ef=U?ce(U):Ri;function xl(fe){return qs(fe,tf(fe))}function tf(fe){return jo(fe)?Xi(fe,!0):Ol(fe)}var $t=Bo(function(fe,_e,Le){js(fe,_e,Le)});function Bt(fe){return function(){return fe}}function rf(fe){return fe}function $l(){return!1}e.exports=$t})(Lu,Lu.exports);Lu.exports;const gU=Pu.getLogger("http-helpers");gU.setLevel(YE.levels.INFO);var Nu={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 - */Nu.exports;(function(e,t){(function(){var r,i="4.17.21",a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",c="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",d=500,h="__lodash_placeholder__",b=1,R=2,A=4,N=1,ae=2,K=1,I=2,y=4,ie=8,F=16,z=32,q=64,ne=128,v=256,w=512,E=30,J="...",_=800,m=16,S=1,L=2,H=3,M=1/0,W=9007199254740991,P=17976931348623157e292,T=0/0,re=4294967295,j=re-1,Q=re>>>1,se=[["ary",ne],["bind",K],["bindKey",I],["curry",ie],["curryRight",F],["flip",w],["partial",z],["partialRight",q],["rearg",v]],de="[object Arguments]",X="[object Array]",D="[object AsyncFunction]",$="[object Boolean]",te="[object Date]",ue="[object DOMException]",B="[object Error]",U="[object Function]",C="[object GeneratorFunction]",G="[object Map]",ce="[object Number]",Re="[object Null]",Se="[object Object]",De="[object Promise]",me="[object Proxy]",Ye="[object RegExp]",Je="[object Set]",rt="[object String]",et="[object Symbol]",ye="[object Undefined]",O="[object WeakMap]",Y="[object WeakSet]",Ee="[object ArrayBuffer]",ve="[object DataView]",$e="[object Float32Array]",qe="[object Float64Array]",V="[object Int8Array]",Ie="[object Int16Array]",Be="[object Int32Array]",ke="[object Uint8Array]",ge="[object Uint8ClampedArray]",Pe="[object Uint16Array]",k="[object Uint32Array]",Me=/\b__p \+= '';/g,Ge=/\b(__p \+=) '' \+/g,p=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ae=/&(?:amp|lt|gt|quot|#39);/g,Oe=/[&<>"']/g,Z=RegExp(Ae.source),he=RegExp(Oe.source),Te=/<%-([\s\S]+?)%>/g,Ke=/<%([\s\S]+?)%>/g,He=/<%=([\s\S]+?)%>/g,We=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/[\\^$.*+?()[\]{}|]/g,dt=RegExp(Rt.source),Pt=/^\s+/,qt=/\s/,Kt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,hr=/\{\n\/\* \[wrapped with (.+)\] \*/,Zr=/,? & /,Ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tr=/[()=,{}\[\]\/\s]/,kt=/\\(\\)?/g,pr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ht=/\w*$/,Bn=/^[-+]0x[0-9a-f]+$/i,Vi=/^0b[01]+$/i,Zi=/^\[object .+?Constructor\]$/,Ki=/^0o[0-7]+$/i,Ji=/^(?:0|[1-9]\d*)$/,Xi=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kr=/($^)/,Yi=/['\n\r\u2028\u2029\\]/g,Fr="\\ud800-\\udfff",Xn="\\u0300-\\u036f",Qi="\\ufe20-\\ufe2f",xn="\\u20d0-\\u20ff",Yn=Xn+Qi+xn,Si="\\u2700-\\u27bf",Ri="a-z\\xdf-\\xf6\\xf8-\\xff",Ol="\\xac\\xb1\\xd7\\xf7",js="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Il="\\u2000-\\u206f",Pl=" \\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",Fs="A-Z\\xc0-\\xd6\\xd8-\\xde",Us="\\ufe0e\\ufe0f",ks=Ol+js+Il+Pl,Ba="['’]",Ll="["+Fr+"]",qs="["+ks+"]",Bo="["+Yn+"]",Hs="\\d+",xo="["+Si+"]",$o="["+Ri+"]",Ws="[^"+Fr+ks+Hs+Si+Ri+Fs+"]",xa="\\ud83c[\\udffb-\\udfff]",zs="(?:"+Bo+"|"+xa+")",Gs="[^"+Fr+"]",$a="(?:\\ud83c[\\udde6-\\uddff]){2}",Ma="[\\ud800-\\udbff][\\udc00-\\udfff]",Qn="["+Fs+"]",Vs="\\u200d",Zs="(?:"+$o+"|"+Ws+")",Nl="(?:"+Qn+"|"+Ws+")",Mo="(?:"+Ba+"(?:d|ll|m|re|s|t|ve))?",Ks="(?:"+Ba+"(?:D|LL|M|RE|S|T|VE))?",Js=zs+"?",Xs="["+Us+"]?",Do="(?:"+Vs+"(?:"+[Gs,$a,Ma].join("|")+")"+Xs+Js+")*",Da="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ja="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",jo=Xs+Js+Do,Cl="(?:"+[xo,$a,Ma].join("|")+")"+jo,Ys="(?:"+[Gs+Bo+"?",Bo,$a,Ma,Ll].join("|")+")",Fa=RegExp(Ba,"g"),Qs=RegExp(Bo,"g"),vn=RegExp(xa+"(?="+xa+")|"+Ys+jo,"g"),eo=RegExp([Qn+"?"+$o+"+"+Mo+"(?="+[qs,Qn,"$"].join("|")+")",Nl+"+"+Ks+"(?="+[qs,Qn+Zs,"$"].join("|")+")",Qn+"?"+Zs+"+"+Mo,Qn+"+"+Ks,ja,Da,Hs,Cl].join("|"),"g"),Bl=RegExp("["+Vs+Fr+Yn+Us+"]"),ef=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xl=["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"],tf=-1,$t={};$t[$e]=$t[qe]=$t[V]=$t[Ie]=$t[Be]=$t[ke]=$t[ge]=$t[Pe]=$t[k]=!0,$t[de]=$t[X]=$t[Ee]=$t[$]=$t[ve]=$t[te]=$t[B]=$t[U]=$t[G]=$t[ce]=$t[Se]=$t[Ye]=$t[Je]=$t[rt]=$t[O]=!1;var Bt={};Bt[de]=Bt[X]=Bt[Ee]=Bt[ve]=Bt[$]=Bt[te]=Bt[$e]=Bt[qe]=Bt[V]=Bt[Ie]=Bt[Be]=Bt[G]=Bt[ce]=Bt[Se]=Bt[Ye]=Bt[Je]=Bt[rt]=Bt[et]=Bt[ke]=Bt[ge]=Bt[Pe]=Bt[k]=!0,Bt[B]=Bt[U]=Bt[O]=!1;var rf={À:"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"},$l={"&":"&","<":"<",">":">",'"':""","'":"'"},fe={"&":"&","<":"<",">":">",""":'"',"'":"'"},_e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Le=parseFloat,Ve=parseInt,bt=typeof Qe=="object"&&Qe&&Qe.Object===Object&&Qe,Lt=typeof self=="object"&&self&&self.Object===Object&&self,ct=bt||Lt||Function("return this")(),gt=t&&!t.nodeType&&t,At=gt&&!0&&e&&!e.nodeType&&e,Rr=At&&At.exports===gt,gr=Rr&&bt.process,ar=function(){try{var be=At&&At.require&&At.require("util").types;return be||gr&&gr.binding&&gr.binding("util")}catch{}}(),Fo=ar&&ar.isArrayBuffer,Uo=ar&&ar.isDate,Ua=ar&&ar.isMap,yg=ar&&ar.isRegExp,_g=ar&&ar.isSet,bg=ar&&ar.isTypedArray;function Ur(be,xe,Ne){switch(Ne.length){case 0:return be.call(xe);case 1:return be.call(xe,Ne[0]);case 2:return be.call(xe,Ne[0],Ne[1]);case 3:return be.call(xe,Ne[0],Ne[1],Ne[2])}return be.apply(xe,Ne)}function a1(be,xe,Ne,Ze){for(var st=-1,Ot=be==null?0:be.length;++st-1}function Ml(be,xe,Ne){for(var Ze=-1,st=be==null?0:be.length;++Ze-1;);return Ne}function Tg(be,xe){for(var Ne=be.length;Ne--&&ko(xe,be[Ne],0)>-1;);return Ne}function g1(be,xe){for(var Ne=be.length,Ze=0;Ne--;)be[Ne]===xe&&++Ze;return Ze}var y1=Ul(rf),_1=Ul($l);function b1(be){return"\\"+_e[be]}function v1(be,xe){return be==null?r:be[xe]}function qo(be){return Bl.test(be)}function w1(be){return ef.test(be)}function m1(be){for(var xe,Ne=[];!(xe=be.next()).done;)Ne.push(xe.value);return Ne}function Wl(be){var xe=-1,Ne=Array(be.size);return be.forEach(function(Ze,st){Ne[++xe]=[st,Ze]}),Ne}function Og(be,xe){return function(Ne){return be(xe(Ne))}}function Oi(be,xe){for(var Ne=-1,Ze=be.length,st=0,Ot=[];++Ne-1}function fS(n,o){var u=this.__data__,g=mf(u,n);return g<0?(++this.size,u.push([n,o])):u[g][1]=o,this}ei.prototype.clear=iS,ei.prototype.delete=oS,ei.prototype.get=aS,ei.prototype.has=sS,ei.prototype.set=fS;function ti(n){var o=-1,u=n==null?0:n.length;for(this.clear();++o=o?n:o)),n}function Qr(n,o,u,g,x,oe){var le,pe=o&b,we=o&R,je=o&A;if(u&&(le=x?u(n,g,x,oe):u(n)),le!==r)return le;if(!Gt(n))return n;var Fe=ft(n);if(Fe){if(le=dR(n),!pe)return Nr(n,le)}else{var Ue=wr(n),ze=Ue==U||Ue==C;if(Bi(n))return u0(n,pe);if(Ue==Se||Ue==de||ze&&!x){if(le=we||ze?{}:I0(n),!pe)return we?tR(n,RS(le,n)):eR(n,Fg(le,n))}else{if(!Bt[Ue])return x?n:{};le=hR(n,Ue,pe)}}oe||(oe=new mn);var Xe=oe.get(n);if(Xe)return Xe;oe.set(n,le),ny(n)?n.forEach(function(ot){le.add(Qr(ot,o,u,ot,n,oe))}):ty(n)&&n.forEach(function(ot,vt){le.set(vt,Qr(ot,o,u,vt,n,oe))});var it=je?we?yc:gc:we?Br:sr,pt=Fe?r:it(n);return Jr(pt||n,function(ot,vt){pt&&(vt=ot,ot=n[vt]),Va(le,vt,Qr(ot,o,u,vt,n,oe))}),le}function AS(n){var o=sr(n);return function(u){return Ug(u,n,o)}}function Ug(n,o,u){var g=u.length;if(n==null)return!g;for(n=Mt(n);g--;){var x=u[g],oe=o[x],le=n[x];if(le===r&&!(x in n)||!oe(le))return!1}return!0}function kg(n,o,u){if(typeof n!="function")throw new Xr(f);return es(function(){n.apply(r,u)},o)}function Za(n,o,u,g){var x=-1,oe=nf,le=!0,pe=n.length,we=[],je=o.length;if(!pe)return we;u&&(o=Wt(o,kr(u))),g?(oe=Ml,le=!1):o.length>=a&&(oe=ka,le=!1,o=new no(o));e:for(;++xx?0:x+u),g=g===r||g>x?x:ht(g),g<0&&(g+=x),g=u>g?0:oy(g);u0&&u(pe)?o>1?yr(pe,o-1,u,g,x):Ti(x,pe):g||(x[x.length]=pe)}return x}var Xl=g0(),Wg=g0(!0);function $n(n,o){return n&&Xl(n,o,sr)}function Yl(n,o){return n&&Wg(n,o,sr)}function Sf(n,o){return Ai(o,function(u){return ai(n[u])})}function oo(n,o){o=Ni(o,n);for(var u=0,g=o.length;n!=null&&uo}function IS(n,o){return n!=null&&Nt.call(n,o)}function PS(n,o){return n!=null&&o in Mt(n)}function LS(n,o,u){return n>=vr(o,u)&&n=120&&Fe.length>=120)?new no(le&&Fe):r}Fe=n[0];var Ue=-1,ze=pe[0];e:for(;++Ue-1;)pe!==n&&pf.call(pe,we,1),pf.call(n,we,1);return n}function t0(n,o){for(var u=n?o.length:0,g=u-1;u--;){var x=o[u];if(u==g||x!==oe){var oe=x;oi(x)?pf.call(n,x,1):fc(n,x)}}return n}function oc(n,o){return n+_f($g()*(o-n+1))}function HS(n,o,u,g){for(var x=-1,oe=nr(yf((o-n)/(u||1)),0),le=Ne(oe);oe--;)le[g?oe:++x]=n,n+=u;return le}function ac(n,o){var u="";if(!n||o<1||o>W)return u;do o%2&&(u+=n),o=_f(o/2),o&&(n+=n);while(o);return u}function yt(n,o){return Sc(N0(n,o,xr),n+"")}function WS(n){return jg(Qo(n))}function zS(n,o){var u=Qo(n);return xf(u,io(o,0,u.length))}function Xa(n,o,u,g){if(!Gt(n))return n;o=Ni(o,n);for(var x=-1,oe=o.length,le=oe-1,pe=n;pe!=null&&++xx?0:x+o),u=u>x?x:u,u<0&&(u+=x),x=o>u?0:u-o>>>0,o>>>=0;for(var oe=Ne(x);++g>>1,le=n[oe];le!==null&&!Hr(le)&&(u?le<=o:le=a){var je=o?null:oR(n);if(je)return af(je);le=!1,x=ka,we=new no}else we=o?[]:pe;e:for(;++g=g?n:en(n,o,u)}var f0=M1||function(n){return ct.clearTimeout(n)};function u0(n,o){if(o)return n.slice();var u=n.length,g=Lg?Lg(u):new n.constructor(u);return n.copy(g),g}function dc(n){var o=new n.constructor(n.byteLength);return new df(o).set(new df(n)),o}function JS(n,o){var u=o?dc(n.buffer):n.buffer;return new n.constructor(u,n.byteOffset,n.byteLength)}function XS(n){var o=new n.constructor(n.source,Ht.exec(n));return o.lastIndex=n.lastIndex,o}function YS(n){return Ga?Mt(Ga.call(n)):{}}function l0(n,o){var u=o?dc(n.buffer):n.buffer;return new n.constructor(u,n.byteOffset,n.length)}function c0(n,o){if(n!==o){var u=n!==r,g=n===null,x=n===n,oe=Hr(n),le=o!==r,pe=o===null,we=o===o,je=Hr(o);if(!pe&&!je&&!oe&&n>o||oe&&le&&we&&!pe&&!je||g&&le&&we||!u&&we||!x)return 1;if(!g&&!oe&&!je&&n=pe)return we;var je=u[g];return we*(je=="desc"?-1:1)}}return n.index-o.index}function d0(n,o,u,g){for(var x=-1,oe=n.length,le=u.length,pe=-1,we=o.length,je=nr(oe-le,0),Fe=Ne(we+je),Ue=!g;++pe1?u[x-1]:r,le=x>2?u[2]:r;for(oe=n.length>3&&typeof oe=="function"?(x--,oe):r,le&&Tr(u[0],u[1],le)&&(oe=x<3?r:oe,x=1),o=Mt(o);++g-1?x[oe?o[le]:le]:r}}function b0(n){return ii(function(o){var u=o.length,g=u,x=Yr.prototype.thru;for(n&&o.reverse();g--;){var oe=o[g];if(typeof oe!="function")throw new Xr(f);if(x&&!le&&Cf(oe)=="wrapper")var le=new Yr([],!0)}for(g=le?g:u;++g1&&Et.reverse(),Fe&&wepe))return!1;var je=oe.get(n),Fe=oe.get(o);if(je&&Fe)return je==o&&Fe==n;var Ue=-1,ze=!0,Xe=u&ae?new no:r;for(oe.set(n,o),oe.set(o,n);++Ue1?"& ":"")+o[g],o=o.join(u>2?", ":" "),n.replace(Kt,`{ -/* [wrapped with `+o+`] */ -`)}function gR(n){return ft(n)||fo(n)||!!(Bg&&n&&n[Bg])}function oi(n,o){var u=typeof n;return o=o??W,!!o&&(u=="number"||u!="symbol"&&Ji.test(n))&&n>-1&&n%1==0&&n0){if(++o>=_)return arguments[0]}else o=0;return n.apply(r,arguments)}}function xf(n,o){var u=-1,g=n.length,x=g-1;for(o=o===r?g:o;++u1?n[o-1]:r;return u=typeof u=="function"?(n.pop(),u):r,H0(n,u)});function W0(n){var o=ee(n);return o.__chain__=!0,o}function TA(n,o){return o(n),n}function $f(n,o){return o(n)}var OA=ii(function(n){var o=n.length,u=o?n[0]:0,g=this.__wrapped__,x=function(oe){return Jl(oe,n)};return o>1||this.__actions__.length||!(g instanceof wt)||!oi(u)?this.thru(x):(g=g.slice(u,+u+(o?1:0)),g.__actions__.push({func:$f,args:[x],thisArg:r}),new Yr(g,this.__chain__).thru(function(oe){return o&&!oe.length&&oe.push(r),oe}))});function IA(){return W0(this)}function PA(){return new Yr(this.value(),this.__chain__)}function LA(){this.__values__===r&&(this.__values__=iy(this.value()));var n=this.__index__>=this.__values__.length,o=n?r:this.__values__[this.__index__++];return{done:n,value:o}}function NA(){return this}function CA(n){for(var o,u=this;u instanceof wf;){var g=D0(u);g.__index__=0,g.__values__=r,o?x.__wrapped__=g:o=g;var x=g;u=u.__wrapped__}return x.__wrapped__=n,o}function BA(){var n=this.__wrapped__;if(n instanceof wt){var o=n;return this.__actions__.length&&(o=new wt(this)),o=o.reverse(),o.__actions__.push({func:$f,args:[Rc],thisArg:r}),new Yr(o,this.__chain__)}return this.thru(Rc)}function xA(){return a0(this.__wrapped__,this.__actions__)}var $A=Of(function(n,o,u){Nt.call(n,u)?++n[u]:ri(n,u,1)});function MA(n,o,u){var g=ft(n)?vg:TS;return u&&Tr(n,o,u)&&(o=r),g(n,nt(o,3))}function DA(n,o){var u=ft(n)?Ai:Hg;return u(n,nt(o,3))}var jA=_0(j0),FA=_0(F0);function UA(n,o){return yr(Mf(n,o),1)}function kA(n,o){return yr(Mf(n,o),M)}function qA(n,o,u){return u=u===r?1:ht(u),yr(Mf(n,o),u)}function z0(n,o){var u=ft(n)?Jr:Pi;return u(n,nt(o,3))}function G0(n,o){var u=ft(n)?s1:qg;return u(n,nt(o,3))}var HA=Of(function(n,o,u){Nt.call(n,u)?n[u].push(o):ri(n,u,[o])});function WA(n,o,u,g){n=Cr(n)?n:Qo(n),u=u&&!g?ht(u):0;var x=n.length;return u<0&&(u=nr(x+u,0)),kf(n)?u<=x&&n.indexOf(o,u)>-1:!!x&&ko(n,o,u)>-1}var zA=yt(function(n,o,u){var g=-1,x=typeof o=="function",oe=Cr(n)?Ne(n.length):[];return Pi(n,function(le){oe[++g]=x?Ur(o,le,u):Ka(le,o,u)}),oe}),GA=Of(function(n,o,u){ri(n,u,o)});function Mf(n,o){var u=ft(n)?Wt:Kg;return u(n,nt(o,3))}function VA(n,o,u,g){return n==null?[]:(ft(o)||(o=o==null?[]:[o]),u=g?r:u,ft(u)||(u=u==null?[]:[u]),Qg(n,o,u))}var ZA=Of(function(n,o,u){n[u?0:1].push(o)},function(){return[[],[]]});function KA(n,o,u){var g=ft(n)?Dl:Sg,x=arguments.length<3;return g(n,nt(o,4),u,x,Pi)}function JA(n,o,u){var g=ft(n)?f1:Sg,x=arguments.length<3;return g(n,nt(o,4),u,x,qg)}function XA(n,o){var u=ft(n)?Ai:Hg;return u(n,Ff(nt(o,3)))}function YA(n){var o=ft(n)?jg:WS;return o(n)}function QA(n,o,u){(u?Tr(n,o,u):o===r)?o=1:o=ht(o);var g=ft(n)?mS:zS;return g(n,o)}function eT(n){var o=ft(n)?ES:VS;return o(n)}function tT(n){if(n==null)return 0;if(Cr(n))return kf(n)?Ho(n):n.length;var o=wr(n);return o==G||o==Je?n.size:rc(n).length}function rT(n,o,u){var g=ft(n)?jl:ZS;return u&&Tr(n,o,u)&&(o=r),g(n,nt(o,3))}var nT=yt(function(n,o){if(n==null)return[];var u=o.length;return u>1&&Tr(n,o[0],o[1])?o=[]:u>2&&Tr(o[0],o[1],o[2])&&(o=[o[0]]),Qg(n,yr(o,1),[])}),Df=D1||function(){return ct.Date.now()};function iT(n,o){if(typeof o!="function")throw new Xr(f);return n=ht(n),function(){if(--n<1)return o.apply(this,arguments)}}function V0(n,o,u){return o=u?r:o,o=n&&o==null?n.length:o,ni(n,ne,r,r,r,r,o)}function Z0(n,o){var u;if(typeof o!="function")throw new Xr(f);return n=ht(n),function(){return--n>0&&(u=o.apply(this,arguments)),n<=1&&(o=r),u}}var Tc=yt(function(n,o,u){var g=K;if(u.length){var x=Oi(u,Xo(Tc));g|=z}return ni(n,g,o,u,x)}),K0=yt(function(n,o,u){var g=K|I;if(u.length){var x=Oi(u,Xo(K0));g|=z}return ni(o,g,n,u,x)});function J0(n,o,u){o=u?r:o;var g=ni(n,ie,r,r,r,r,r,o);return g.placeholder=J0.placeholder,g}function X0(n,o,u){o=u?r:o;var g=ni(n,F,r,r,r,r,r,o);return g.placeholder=X0.placeholder,g}function Y0(n,o,u){var g,x,oe,le,pe,we,je=0,Fe=!1,Ue=!1,ze=!0;if(typeof n!="function")throw new Xr(f);o=rn(o)||0,Gt(u)&&(Fe=!!u.leading,Ue="maxWait"in u,oe=Ue?nr(rn(u.maxWait)||0,o):oe,ze="trailing"in u?!!u.trailing:ze);function Xe(Qt){var Sn=g,fi=x;return g=x=r,je=Qt,le=n.apply(fi,Sn),le}function it(Qt){return je=Qt,pe=es(vt,o),Fe?Xe(Qt):le}function pt(Qt){var Sn=Qt-we,fi=Qt-je,_y=o-Sn;return Ue?vr(_y,oe-fi):_y}function ot(Qt){var Sn=Qt-we,fi=Qt-je;return we===r||Sn>=o||Sn<0||Ue&&fi>=oe}function vt(){var Qt=Df();if(ot(Qt))return Et(Qt);pe=es(vt,pt(Qt))}function Et(Qt){return pe=r,ze&&g?Xe(Qt):(g=x=r,le)}function Wr(){pe!==r&&f0(pe),je=0,g=we=x=pe=r}function Or(){return pe===r?le:Et(Df())}function zr(){var Qt=Df(),Sn=ot(Qt);if(g=arguments,x=this,we=Qt,Sn){if(pe===r)return it(we);if(Ue)return f0(pe),pe=es(vt,o),Xe(we)}return pe===r&&(pe=es(vt,o)),le}return zr.cancel=Wr,zr.flush=Or,zr}var oT=yt(function(n,o){return kg(n,1,o)}),aT=yt(function(n,o,u){return kg(n,rn(o)||0,u)});function sT(n){return ni(n,w)}function jf(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new Xr(f);var u=function(){var g=arguments,x=o?o.apply(this,g):g[0],oe=u.cache;if(oe.has(x))return oe.get(x);var le=n.apply(this,g);return u.cache=oe.set(x,le)||oe,le};return u.cache=new(jf.Cache||ti),u}jf.Cache=ti;function Ff(n){if(typeof n!="function")throw new Xr(f);return function(){var o=arguments;switch(o.length){case 0:return!n.call(this);case 1:return!n.call(this,o[0]);case 2:return!n.call(this,o[0],o[1]);case 3:return!n.call(this,o[0],o[1],o[2])}return!n.apply(this,o)}}function fT(n){return Z0(2,n)}var uT=KS(function(n,o){o=o.length==1&&ft(o[0])?Wt(o[0],kr(nt())):Wt(yr(o,1),kr(nt()));var u=o.length;return yt(function(g){for(var x=-1,oe=vr(g.length,u);++x=o}),fo=Gg(function(){return arguments}())?Gg:function(n){return Jt(n)&&Nt.call(n,"callee")&&!Cg.call(n,"callee")},ft=Ne.isArray,RT=Fo?kr(Fo):CS;function Cr(n){return n!=null&&Uf(n.length)&&!ai(n)}function Yt(n){return Jt(n)&&Cr(n)}function AT(n){return n===!0||n===!1||Jt(n)&&Ar(n)==$}var Bi=F1||jc,TT=Uo?kr(Uo):BS;function OT(n){return Jt(n)&&n.nodeType===1&&!ts(n)}function IT(n){if(n==null)return!0;if(Cr(n)&&(ft(n)||typeof n=="string"||typeof n.splice=="function"||Bi(n)||Yo(n)||fo(n)))return!n.length;var o=wr(n);if(o==G||o==Je)return!n.size;if(Qa(n))return!rc(n).length;for(var u in n)if(Nt.call(n,u))return!1;return!0}function PT(n,o){return Ja(n,o)}function LT(n,o,u){u=typeof u=="function"?u:r;var g=u?u(n,o):r;return g===r?Ja(n,o,r,u):!!g}function Ic(n){if(!Jt(n))return!1;var o=Ar(n);return o==B||o==ue||typeof n.message=="string"&&typeof n.name=="string"&&!ts(n)}function NT(n){return typeof n=="number"&&xg(n)}function ai(n){if(!Gt(n))return!1;var o=Ar(n);return o==U||o==C||o==D||o==me}function ey(n){return typeof n=="number"&&n==ht(n)}function Uf(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=W}function Gt(n){var o=typeof n;return n!=null&&(o=="object"||o=="function")}function Jt(n){return n!=null&&typeof n=="object"}var ty=Ua?kr(Ua):$S;function CT(n,o){return n===o||tc(n,o,bc(o))}function BT(n,o,u){return u=typeof u=="function"?u:r,tc(n,o,bc(o),u)}function xT(n){return ry(n)&&n!=+n}function $T(n){if(bR(n))throw new st(s);return Vg(n)}function MT(n){return n===null}function DT(n){return n==null}function ry(n){return typeof n=="number"||Jt(n)&&Ar(n)==ce}function ts(n){if(!Jt(n)||Ar(n)!=Se)return!1;var o=hf(n);if(o===null)return!0;var u=Nt.call(o,"constructor")&&o.constructor;return typeof u=="function"&&u instanceof u&&uf.call(u)==B1}var Pc=yg?kr(yg):MS;function jT(n){return ey(n)&&n>=-W&&n<=W}var ny=_g?kr(_g):DS;function kf(n){return typeof n=="string"||!ft(n)&&Jt(n)&&Ar(n)==rt}function Hr(n){return typeof n=="symbol"||Jt(n)&&Ar(n)==et}var Yo=bg?kr(bg):jS;function FT(n){return n===r}function UT(n){return Jt(n)&&wr(n)==O}function kT(n){return Jt(n)&&Ar(n)==Y}var qT=Nf(nc),HT=Nf(function(n,o){return n<=o});function iy(n){if(!n)return[];if(Cr(n))return kf(n)?wn(n):Nr(n);if(qa&&n[qa])return m1(n[qa]());var o=wr(n),u=o==G?Wl:o==Je?af:Qo;return u(n)}function si(n){if(!n)return n===0?n:0;if(n=rn(n),n===M||n===-M){var o=n<0?-1:1;return o*P}return n===n?n:0}function ht(n){var o=si(n),u=o%1;return o===o?u?o-u:o:0}function oy(n){return n?io(ht(n),0,re):0}function rn(n){if(typeof n=="number")return n;if(Hr(n))return T;if(Gt(n)){var o=typeof n.valueOf=="function"?n.valueOf():n;n=Gt(o)?o+"":o}if(typeof n!="string")return n===0?n:+n;n=Rg(n);var u=Vi.test(n);return u||Ki.test(n)?Ve(n.slice(2),u?2:8):Bn.test(n)?T:+n}function ay(n){return Mn(n,Br(n))}function WT(n){return n?io(ht(n),-W,W):n===0?n:0}function It(n){return n==null?"":qr(n)}var zT=Ko(function(n,o){if(Qa(o)||Cr(o)){Mn(o,sr(o),n);return}for(var u in o)Nt.call(o,u)&&Va(n,u,o[u])}),sy=Ko(function(n,o){Mn(o,Br(o),n)}),qf=Ko(function(n,o,u,g){Mn(o,Br(o),n,g)}),GT=Ko(function(n,o,u,g){Mn(o,sr(o),n,g)}),VT=ii(Jl);function ZT(n,o){var u=Zo(n);return o==null?u:Fg(u,o)}var KT=yt(function(n,o){n=Mt(n);var u=-1,g=o.length,x=g>2?o[2]:r;for(x&&Tr(o[0],o[1],x)&&(g=1);++u1),oe}),Mn(n,yc(n),u),g&&(u=Qr(u,b|R|A,aR));for(var x=o.length;x--;)fc(u,o[x]);return u});function hO(n,o){return uy(n,Ff(nt(o)))}var pO=ii(function(n,o){return n==null?{}:kS(n,o)});function uy(n,o){if(n==null)return{};var u=Wt(yc(n),function(g){return[g]});return o=nt(o),e0(n,u,function(g,x){return o(g,x[0])})}function gO(n,o,u){o=Ni(o,n);var g=-1,x=o.length;for(x||(x=1,n=r);++go){var g=n;n=o,o=g}if(u||n%1||o%1){var x=$g();return vr(n+x*(o-n+Le("1e-"+((x+"").length-1))),o)}return oc(n,o)}var TO=Jo(function(n,o,u){return o=o.toLowerCase(),n+(u?dy(o):o)});function dy(n){return Cc(It(n).toLowerCase())}function hy(n){return n=It(n),n&&n.replace(Xi,y1).replace(Qs,"")}function OO(n,o,u){n=It(n),o=qr(o);var g=n.length;u=u===r?g:io(ht(u),0,g);var x=u;return u-=o.length,u>=0&&n.slice(u,x)==o}function IO(n){return n=It(n),n&&he.test(n)?n.replace(Oe,_1):n}function PO(n){return n=It(n),n&&dt.test(n)?n.replace(Rt,"\\$&"):n}var LO=Jo(function(n,o,u){return n+(u?"-":"")+o.toLowerCase()}),NO=Jo(function(n,o,u){return n+(u?" ":"")+o.toLowerCase()}),CO=y0("toLowerCase");function BO(n,o,u){n=It(n),o=ht(o);var g=o?Ho(n):0;if(!o||g>=o)return n;var x=(o-g)/2;return Lf(_f(x),u)+n+Lf(yf(x),u)}function xO(n,o,u){n=It(n),o=ht(o);var g=o?Ho(n):0;return o&&g>>0,u?(n=It(n),n&&(typeof o=="string"||o!=null&&!Pc(o))&&(o=qr(o),!o&&qo(n))?Ci(wn(n),0,u):n.split(o,u)):[]}var kO=Jo(function(n,o,u){return n+(u?" ":"")+Cc(o)});function qO(n,o,u){return n=It(n),u=u==null?0:io(ht(u),0,n.length),o=qr(o),n.slice(u,u+o.length)==o}function HO(n,o,u){var g=ee.templateSettings;u&&Tr(n,o,u)&&(o=r),n=It(n),o=qf({},o,g,S0);var x=qf({},o.imports,g.imports,S0),oe=sr(x),le=Hl(x,oe),pe,we,je=0,Fe=o.interpolate||Kr,Ue="__p += '",ze=zl((o.escape||Kr).source+"|"+Fe.source+"|"+(Fe===He?pr:Kr).source+"|"+(o.evaluate||Kr).source+"|$","g"),Xe="//# sourceURL="+(Nt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tf+"]")+` -`;n.replace(ze,function(ot,vt,Et,Wr,Or,zr){return Et||(Et=Wr),Ue+=n.slice(je,zr).replace(Yi,b1),vt&&(pe=!0,Ue+=`' + -__e(`+vt+`) + -'`),Or&&(we=!0,Ue+=`'; -`+Or+`; -__p += '`),Et&&(Ue+=`' + -((__t = (`+Et+`)) == null ? '' : __t) + -'`),je=zr+ot.length,ot}),Ue+=`'; -`;var it=Nt.call(o,"variable")&&o.variable;if(!it)Ue=`with (obj) { -`+Ue+` -} -`;else if(tr.test(it))throw new st(c);Ue=(we?Ue.replace(Me,""):Ue).replace(Ge,"$1").replace(p,"$1;"),Ue="function("+(it||"obj")+`) { -`+(it?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(pe?", __e = _.escape":"")+(we?`, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -`:`; -`)+Ue+`return __p -}`;var pt=gy(function(){return Ot(oe,Xe+"return "+Ue).apply(r,le)});if(pt.source=Ue,Ic(pt))throw pt;return pt}function WO(n){return It(n).toLowerCase()}function zO(n){return It(n).toUpperCase()}function GO(n,o,u){if(n=It(n),n&&(u||o===r))return Rg(n);if(!n||!(o=qr(o)))return n;var g=wn(n),x=wn(o),oe=Ag(g,x),le=Tg(g,x)+1;return Ci(g,oe,le).join("")}function VO(n,o,u){if(n=It(n),n&&(u||o===r))return n.slice(0,Ig(n)+1);if(!n||!(o=qr(o)))return n;var g=wn(n),x=Tg(g,wn(o))+1;return Ci(g,0,x).join("")}function ZO(n,o,u){if(n=It(n),n&&(u||o===r))return n.replace(Pt,"");if(!n||!(o=qr(o)))return n;var g=wn(n),x=Ag(g,wn(o));return Ci(g,x).join("")}function KO(n,o){var u=E,g=J;if(Gt(o)){var x="separator"in o?o.separator:x;u="length"in o?ht(o.length):u,g="omission"in o?qr(o.omission):g}n=It(n);var oe=n.length;if(qo(n)){var le=wn(n);oe=le.length}if(u>=oe)return n;var pe=u-Ho(g);if(pe<1)return g;var we=le?Ci(le,0,pe).join(""):n.slice(0,pe);if(x===r)return we+g;if(le&&(pe+=we.length-pe),Pc(x)){if(n.slice(pe).search(x)){var je,Fe=we;for(x.global||(x=zl(x.source,It(Ht.exec(x))+"g")),x.lastIndex=0;je=x.exec(Fe);)var Ue=je.index;we=we.slice(0,Ue===r?pe:Ue)}}else if(n.indexOf(qr(x),pe)!=pe){var ze=we.lastIndexOf(x);ze>-1&&(we=we.slice(0,ze))}return we+g}function JO(n){return n=It(n),n&&Z.test(n)?n.replace(Ae,A1):n}var XO=Jo(function(n,o,u){return n+(u?" ":"")+o.toUpperCase()}),Cc=y0("toUpperCase");function py(n,o,u){return n=It(n),o=u?r:o,o===r?w1(n)?I1(n):c1(n):n.match(o)||[]}var gy=yt(function(n,o){try{return Ur(n,r,o)}catch(u){return Ic(u)?u:new st(u)}}),YO=ii(function(n,o){return Jr(o,function(u){u=Dn(u),ri(n,u,Tc(n[u],n))}),n});function QO(n){var o=n==null?0:n.length,u=nt();return n=o?Wt(n,function(g){if(typeof g[1]!="function")throw new Xr(f);return[u(g[0]),g[1]]}):[],yt(function(g){for(var x=-1;++xW)return[];var u=re,g=vr(n,re);o=nt(o),n-=re;for(var x=ql(g,o);++u0||o<0)?new wt(u):(n<0?u=u.takeRight(-n):n&&(u=u.drop(n)),o!==r&&(o=ht(o),u=o<0?u.dropRight(-o):u.take(o-n)),u)},wt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},wt.prototype.toArray=function(){return this.take(re)},$n(wt.prototype,function(n,o){var u=/^(?:filter|find|map|reject)|While$/.test(o),g=/^(?:head|last)$/.test(o),x=ee[g?"take"+(o=="last"?"Right":""):o],oe=g||/^find/.test(o);x&&(ee.prototype[o]=function(){var le=this.__wrapped__,pe=g?[1]:arguments,we=le instanceof wt,je=pe[0],Fe=we||ft(le),Ue=function(vt){var Et=x.apply(ee,Ti([vt],pe));return g&&ze?Et[0]:Et};Fe&&u&&typeof je=="function"&&je.length!=1&&(we=Fe=!1);var ze=this.__chain__,Xe=!!this.__actions__.length,it=oe&&!ze,pt=we&&!Xe;if(!oe&&Fe){le=pt?le:new wt(this);var ot=n.apply(le,pe);return ot.__actions__.push({func:$f,args:[Ue],thisArg:r}),new Yr(ot,ze)}return it&&pt?n.apply(this,pe):(ot=this.thru(Ue),it?g?ot.value()[0]:ot.value():ot)})}),Jr(["pop","push","shift","sort","splice","unshift"],function(n){var o=sf[n],u=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",g=/^(?:pop|shift)$/.test(n);ee.prototype[n]=function(){var x=arguments;if(g&&!this.__chain__){var oe=this.value();return o.apply(ft(oe)?oe:[],x)}return this[u](function(le){return o.apply(ft(le)?le:[],x)})}}),$n(wt.prototype,function(n,o){var u=ee[o];if(u){var g=u.name+"";Nt.call(Vo,g)||(Vo[g]=[]),Vo[g].push({name:o,func:u})}}),Vo[If(r,I).name]=[{name:"wrapper",func:r}],wt.prototype.clone=J1,wt.prototype.reverse=X1,wt.prototype.value=Y1,ee.prototype.at=OA,ee.prototype.chain=IA,ee.prototype.commit=PA,ee.prototype.next=LA,ee.prototype.plant=CA,ee.prototype.reverse=BA,ee.prototype.toJSON=ee.prototype.valueOf=ee.prototype.value=xA,ee.prototype.first=ee.prototype.head,qa&&(ee.prototype[qa]=NA),ee},Wo=P1();At?((At.exports=Wo)._=Wo,gt._=Wo):ct._=Wo}).call(Qe)})(Nu,Nu.exports);Nu.exports;RD();const cs={IFRAME_STATUS:"iframe_status",CREATE_WINDOW:"create_window",CLOSE_WINDOW:"close_window",USER_LOGGED_IN:"user_logged_in",USER_LOGGED_OUT:"user_logged_out"},kn={LOGOUT:"logout",WALLET_INSTANCE_ID:"wallet_instance_id",USER_INFO:"user_info",SET_PROVIDER:"set_provider",TOPUP:"topup",IFRAME_STATUS:"iframe_status",OPENED_WINDOW:"opened_window",CLOSED_WINDOW:"closed_window",GET_PROVIDER_STATE:"get_provider_state",LOGIN_WITH_PRIVATE_KEY:"login_with_private_key"},yU={GET_PROVIDER_STATE:"wallet_get_provider_state"},dh={ACCOUNTS_CHANGED:"wallet_accounts_changed",CHAIN_CHANGED:"wallet_chain_changed",UNLOCK_STATE_CHANGED:"wallet_unlock_state_changed"};function _U(e){return function(r,i,a){a(s=>{i.error&&Pu.warn(`Error in RPC response: -`,i),!r.isTorusInternal&&(Pu.info(`RPC (${e.origin}):`,r,"->",i),s())})}}var lv;(function(e){e.approved="approved",e.cancelled="cancelled",e.confirmed="confirmed",e.failed="failed",e.finalized="finalized",e.processed="processed",e.rejected="rejected",e.signed="signed",e.submitted="submitted",e.unapproved="unapproved",e.dropped="dropped",e.expired="expired"})(lv||(lv={}));var bU={exports:{}},dg={},hg={};Object.defineProperty(hg,"__esModule",{value:!0});function vU(e){var t=4,r=e.length,i=r%t;if(!i)return e;var a=r,s=t-i,f=r+s,c=Ce.Buffer.alloc(f);for(c.write(e);s--;)c.write("=",a++);return c.toString()}hg.default=vU;Object.defineProperty(dg,"__esModule",{value:!0});var wU=hg;function QE(e,t){return t===void 0&&(t="utf8"),Ce.Buffer.isBuffer(e)?ep(e.toString("base64")):ep(Ce.Buffer.from(e,t).toString("base64"))}function mU(e,t){return t===void 0&&(t="utf8"),Ce.Buffer.from(pg(e),"base64").toString(t)}function pg(e){return e=e.toString(),wU.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function ep(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function EU(e){return Ce.Buffer.from(pg(e),"base64")}var Ca=QE;Ca.encode=QE;Ca.decode=mU;Ca.toBase64=pg;Ca.fromBase64=ep;Ca.toBuffer=EU;dg.default=Ca;(function(e){e.exports=dg.default,e.exports.default=e.exports})(bU);var e1={};const cv=[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];e1.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],b=e[9]^e[19]^e[29]^e[39]^e[49];let R=h^(a<<1|s>>>31),A=b^(s<<1|a>>>31);const N=e[0]^R,ae=e[1]^A,K=e[10]^R,I=e[11]^A,y=e[20]^R,ie=e[21]^A,F=e[30]^R,z=e[31]^A,q=e[40]^R,ne=e[41]^A;R=r^(f<<1|c>>>31),A=i^(c<<1|f>>>31);const v=e[2]^R,w=e[3]^A,E=e[12]^R,J=e[13]^A,_=e[22]^R,m=e[23]^A,S=e[32]^R,L=e[33]^A,H=e[42]^R,M=e[43]^A;R=a^(l<<1|d>>>31),A=s^(d<<1|l>>>31);const W=e[4]^R,P=e[5]^A,T=e[14]^R,re=e[15]^A,j=e[24]^R,Q=e[25]^A,se=e[34]^R,de=e[35]^A,X=e[44]^R,D=e[45]^A;R=f^(h<<1|b>>>31),A=c^(b<<1|h>>>31);const $=e[6]^R,te=e[7]^A,ue=e[16]^R,B=e[17]^A,U=e[26]^R,C=e[27]^A,G=e[36]^R,ce=e[37]^A,Re=e[46]^R,Se=e[47]^A;R=l^(r<<1|i>>>31),A=d^(i<<1|r>>>31);const De=e[8]^R,me=e[9]^A,Ye=e[18]^R,Je=e[19]^A,rt=e[28]^R,et=e[29]^A,ye=e[38]^R,O=e[39]^A,Y=e[48]^R,Ee=e[49]^A,ve=N,$e=ae,qe=I<<4|K>>>28,V=K<<4|I>>>28,Ie=y<<3|ie>>>29,Be=ie<<3|y>>>29,ke=z<<9|F>>>23,ge=F<<9|z>>>23,Pe=q<<18|ne>>>14,k=ne<<18|q>>>14,Me=v<<1|w>>>31,Ge=w<<1|v>>>31,p=J<<12|E>>>20,Ae=E<<12|J>>>20,Oe=_<<10|m>>>22,Z=m<<10|_>>>22,he=L<<13|S>>>19,Te=S<<13|L>>>19,Ke=H<<2|M>>>30,He=M<<2|H>>>30,We=P<<30|W>>>2,lt=W<<30|P>>>2,Ut=T<<6|re>>>26,Rt=re<<6|T>>>26,dt=Q<<11|j>>>21,Pt=j<<11|Q>>>21,qt=se<<15|de>>>17,Kt=de<<15|se>>>17,hr=D<<29|X>>>3,Zr=X<<29|D>>>3,Ct=$<<28|te>>>4,tr=te<<28|$>>>4,kt=B<<23|ue>>>9,pr=ue<<23|B>>>9,Ht=U<<25|C>>>7,Bn=C<<25|U>>>7,Vi=G<<21|ce>>>11,Zi=ce<<21|G>>>11,Ki=Se<<24|Re>>>8,Ji=Re<<24|Se>>>8,Xi=De<<27|me>>>5,Kr=me<<27|De>>>5,Yi=Ye<<20|Je>>>12,Fr=Je<<20|Ye>>>12,Xn=et<<7|rt>>>25,Qi=rt<<7|et>>>25,xn=ye<<8|O>>>24,Yn=O<<8|ye>>>24,Si=Y<<14|Ee>>>18,Ri=Ee<<14|Y>>>18;e[0]=ve^~p&dt,e[1]=$e^~Ae&Pt,e[10]=Ct^~Yi&Ie,e[11]=tr^~Fr&Be,e[20]=Me^~Ut&Ht,e[21]=Ge^~Rt&Bn,e[30]=Xi^~qe&Oe,e[31]=Kr^~V&Z,e[40]=We^~kt&Xn,e[41]=lt^~pr&Qi,e[2]=p^~dt&Vi,e[3]=Ae^~Pt&Zi,e[12]=Yi^~Ie&he,e[13]=Fr^~Be&Te,e[22]=Ut^~Ht&xn,e[23]=Rt^~Bn&Yn,e[32]=qe^~Oe&qt,e[33]=V^~Z&Kt,e[42]=kt^~Xn&ke,e[43]=pr^~Qi&ge,e[4]=dt^~Vi&Si,e[5]=Pt^~Zi&Ri,e[14]=Ie^~he&hr,e[15]=Be^~Te&Zr,e[24]=Ht^~xn&Pe,e[25]=Bn^~Yn&k,e[34]=Oe^~qt&Ki,e[35]=Z^~Kt&Ji,e[44]=Xn^~ke&Ke,e[45]=Qi^~ge&He,e[6]=Vi^~Si&ve,e[7]=Zi^~Ri&$e,e[16]=he^~hr&Ct,e[17]=Te^~Zr&tr,e[26]=xn^~Pe&Me,e[27]=Yn^~k&Ge,e[36]=qt^~Ki&Xi,e[37]=Kt^~Ji&Kr,e[46]=ke^~Ke&We,e[47]=ge^~He<,e[8]=Si^~ve&p,e[9]=Ri^~$e&Ae,e[18]=hr^~Ct&Yi,e[19]=Zr^~tr&Fr,e[28]=Pe^~Me&Ut,e[29]=k^~Ge&Rt,e[38]=Ki^~Xi&qe,e[39]=Ji^~Kr&V,e[48]=Ke^~We&kt,e[49]=He^~lt&pr,e[0]^=cv[t*2],e[1]^=cv[t*2+1]}};const Cu=e1;function Ds(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Ds.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};Ds.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Cu.p1600(this.state),this.count=0);return t};Ds.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};const SU=()=>cB(32).toString("hex");function tu(){}const dv="SYN",hh="ACK",hv="BRK";class pv extends Ta.Duplex{constructor(t){let{name:r,target:i,targetWindow:a=window,targetOrigin:s="*"}=t;if(super({objectMode:!0}),tt(this,"_init",void 0),tt(this,"_haveSyn",void 0),tt(this,"_name",void 0),tt(this,"_target",void 0),tt(this,"_targetWindow",void 0),tt(this,"_targetOrigin",void 0),tt(this,"_onMessage",void 0),tt(this,"_synIntervalId",void 0),!r||!i)throw new Error("Invalid input.");this._init=!1,this._haveSyn=!1,this._name=r,this._target=i,this._targetWindow=a,this._targetOrigin=s,this._onMessage=this.onMessage.bind(this),this._synIntervalId=null,window.addEventListener("message",this._onMessage,!1),this._handShake()}_break(){this.cork(),this._write(hv,null,tu),this._haveSyn=!1,this._init=!1}_handShake(){this._write(dv,null,tu),this.cork()}_onData(t){if(!this._init)t===dv?(this._haveSyn=!0,this._write(hh,null,tu)):t===hh&&(this._init=!0,this._haveSyn||this._write(hh,null,tu),this.uncork());else if(t===hv)this._break();else try{this.push(t)}catch(r){this.emit("error",r)}}_postMessage(t){const r=this._targetOrigin;this._targetWindow.postMessage({target:this._target,data:t},r)}onMessage(t){const r=t.data;this._targetOrigin!=="*"&&t.origin!==this._targetOrigin||t.source!==this._targetWindow||typeof r!="object"||r.target!==this._name||!r.data||this._onData(r.data)}_read(){}_write(t,r,i){this._postMessage(t),i()}_destroy(){window.removeEventListener("message",this._onMessage,!1)}}function gv(e,t,r){try{Reflect.apply(e,t,r)}catch(i){setTimeout(()=>{throw i})}}function RU(e){const t=e.length,r=new Array(t);for(let i=0;i1?a-1:0),f=1;f0&&([l]=s),l instanceof Error)throw l;const d=new Error(`Unhandled error.${l?` (${l.message})`:""}`);throw d.context=l,d}const c=i[t];if(c===void 0)return!1;if(typeof c=="function")gv(c,this,s);else{const l=c.length,d=RU(c);for(let h=0;h2&&arguments[2]!==void 0?arguments[2]:!0;return(i,a)=>{i||a.error?t(i||a.error):!r||Array.isArray(a)?e(a):e(a.result)}};function AU(){const e={};function t(){return!1}const r=new Rl;function i(l){const d=e[l.id];if(!d)throw new Error(`StreamMiddleware - Unknown response id "${l.id}"`);delete e[l.id],Object.assign(d.res,l),setTimeout(d.end)}function a(l){r.emit("notification",l)}function s(l,d,h){let b;try{!l.id?a(l):i(l)}catch(R){b=R}h(b)}const f=new Ta.Duplex({objectMode:!0,read:t,write:s});return{events:r,middleware:(l,d,h,b)=>{f.push(l),e[l.id]={req:l,res:d,next:h,end:b}},stream:f}}function TU(){return(e,t,r,i)=>{const a=e.id,s=SU();e.id=s,t.id=s,r(f=>{e.id=a,t.id=a,f()})}}function yv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function OU(e){for(var t=1;t{const f=l=>{const d=l||r.error;d&&(r.error=Ln.serializeError(d)),s([d,!0])},c=l=>{r.error?f(r.error):(l&&(typeof l!="function"&&f(new ds({code:-32603,message:"JRPCEngine: 'next' return handlers must be functions"})),a.push(l)),s([null,!1]))};try{i(t,r,c,f)}catch(l){f(l)}})}static async _runReturnHandlers(t){for(const r of t)await new Promise((i,a)=>{r(s=>s?a(s):i())})}static _checkForCompletion(t,r,i){if(!("result"in r)&&!("error"in r))throw new ds({code:-32603,message:"Response has no error or result for request"});if(!i)throw new ds({code:-32603,message:"Nothing ended request"})}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,i,a)=>{try{const[s,f,c]=await di._runAllMiddleware(t,r,this._middleware);return f?(await di._runReturnHandlers(c),a(s)):i(async l=>{try{await di._runReturnHandlers(c)}catch(d){return l(d)}return l()})}catch(s){return a(s)}}}async _handleBatch(t,r){try{const i=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,i):i}catch(i){if(r)return r(i);throw i}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(i,a)=>{r(a)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const f=new ds({code:-32603,message:"request must be plain object"});return r(f,{id:void 0,jsonrpc:"2.0",error:f})}if(typeof t.method!="string"){const f=new ds({code:-32603,message:"method must be string"});return r(f,{id:t.id,jsonrpc:"2.0",error:f})}const i=OU({},t),a={id:i.id,jsonrpc:i.jsonrpc};let s=null;try{await this._processRequest(i,a)}catch(f){s=f}return s&&(delete a.result,a.error||(a.error=Ln.serializeError(s))),r(s,a)}async _processRequest(t,r){const[i,a,s]=await di._runAllMiddleware(t,r,this._middleware);if(di._checkForCompletion(t,r,a),await di._runReturnHandlers(s),i)throw i}}class IU extends Ta.Duplex{constructor(t){let{parent:r,name:i}=t;super({objectMode:!0}),tt(this,"_parent",void 0),tt(this,"_name",void 0),this._parent=r,this._name=i}_read(){}_write(t,r,i){this._parent.push({name:this._name,data:t}),i()}}function _v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function bv(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:{};super(bv(bv({},t),{},{objectMode:!0})),tt(this,"_substreams",void 0),tt(this,"getStream",void 0),this._substreams={}}createStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);const r=new IU({parent:this,name:t});return this._substreams[t]=r,LU(this,i=>r.destroy(i||void 0)),r}ignoreStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);this._substreams[t]=vv}_read(){}_write(t,r,i){const{name:a,data:s}=t;if(!a)return window.console.warn(`ObjectMultiplex - malformed chunk without name "${t}"`),i();const f=this._substreams[a];return f?(f!==vv&&f.push(s),i()):(window.console.warn(`ObjectMultiplex - orphaned data for stream "${a}"`),i())}}function LU(e,t){const r=tD(t);Tb(e,{readable:!1},r),Tb(e,{writable:!1},r)}const Vn=e=>e!==null&&typeof e=="object"&&typeof e.pipe=="function";Vn.writable=e=>Vn(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object";Vn.readable=e=>Vn(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object";Vn.duplex=e=>Vn.writable(e)&&Vn.readable(e);Vn.transform=e=>Vn.duplex(e)&&typeof e._transform=="function";var NU=Vn,CU=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,a,s;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(a=i;a--!==0;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),i=s.length,i!==Object.keys(r).length)return!1;for(a=i;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=i;a--!==0;){var f=s[a];if(!e(t[f],r[f]))return!1}return!0}return t!==t&&r!==r};const BU=vi(CU);var xU="0.3.4",zn={errors:{disconnected:()=>"Torus: Lost connection to Torus.",permanentlyDisconnected:()=>"Torus: Disconnected from iframe. Page reload required.",unsupportedSync:e=>`Torus: The Torus Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidOptions:e=>`Invalid options. Received: { maxEventListeners: ${e}}`,invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`Torus: Connected to chain with ID "${e}".`},warnings:{}};const i4={MOONPAY:"moonpay",WYRE:"wyre",RAMPNETWORK:"rampnetwork",XANPOOL:"xanpool",MERCURYO:"mercuryo",TRANSAK:"transak"},$U={PRODUCTION:"production",DEVELOPMENT:"development",TESTING:"testing"},ps={BOTTOM_LEFT:"bottom-left",TOP_LEFT:"top-left",BOTTOM_RIGHT:"bottom-right",TOP_RIGHT:"top-right"},ph={GOOGLE:"google",FACEBOOK:"facebook",REDDIT:"reddit",DISCORD:"discord",TWITCH:"twitch",APPLE:"apple",LINE:"line",GITHUB:"github",KAKAO:"kakao",LINKEDIN:"linkedin",TWITTER:"twitter",WEIBO:"weibo",WECHAT:"wechat",EMAIL_PASSWORDLESS:"email_passwordless"},MU={en:{embed:{continue:"Continue",actionRequired:"Authorization required",pendingAction:"Click continue to proceed with your request in a popup",cookiesRequired:"Cookies Required",enableCookies:"Please enable cookies in your browser preferences to access Torus",clickHere:"More Info"}},de:{embed:{continue:"Fortsetzen",actionRequired:"Autorisierung erforderlich",pendingAction:"Klicken Sie in einem Popup auf Weiter, um mit Ihrer Anfrage fortzufahren",cookiesRequired:"Cookies benötigt",enableCookies:"Bitte aktivieren Sie Cookies in Ihren Browsereinstellungen, um auf Torus zuzugreifen",clickHere:"Mehr Info"}},ja:{embed:{continue:"継続する",actionRequired:"認証が必要です",pendingAction:"続行をクリックして、ポップアップでリクエストを続行します",cookiesRequired:"必要なクッキー",enableCookies:"Torusにアクセスするには、ブラウザの設定でCookieを有効にしてください。",clickHere:"詳しくは"}},ko:{embed:{continue:"계속하다",actionRequired:"승인 필요",pendingAction:"팝업에서 요청을 진행하려면 계속을 클릭하십시오.",cookiesRequired:"쿠키 필요",enableCookies:"브라우저 환경 설정에서 쿠키를 활성화하여 Torus에 액세스하십시오.",clickHere:"더 많은 정보"}},zh:{embed:{continue:"继续",actionRequired:"需要授权",pendingAction:"单击继续以在弹出窗口中继续您的请求",cookiesRequired:"必填Cookie",enableCookies:"请在您的浏览器首选项中启用cookie以访问Torus。",clickHere:"更多信息"}}};var gg={supportedVerifierList:[ph.GOOGLE,ph.REDDIT,ph.DISCORD],api:"https://api.tor.us",translations:MU,prodTorusUrl:"",localStorageKeyPrefix:"torus-"},Dt=Pu.getLogger("solana-embed");function DU(){return(e,t,r)=>{(typeof e.method!="string"||!e.method)&&(t.error=Ln.ethErrors.rpc.invalidRequest({message:"The request 'method' must be a non-empty string.",data:e})),r(i=>{const{error:a}=t;return a&&Dt.error(`Torus - RPC Error: ${a.message}`,a),i()})}}function jU(e,t,r){let i=`Torus: Lost connection to "${e}".`;t!=null&&t.stack&&(i+=` -${t.stack}`),Dt.warn(i),r&&r.listenerCount("error")>0&&r.emit("error",i)}const ru=()=>Math.random().toString(36).slice(2),t1=async e=>{let t,r;switch(e){case"testing":t="https://solana-testing.tor.us",r="debug";break;case"development":t="http://localhost:8080",r="debug";break;default:t="https://solana.tor.us",r="error";break}return{torusUrl:t,logLevel:r}},FU=()=>{let e=window.navigator.language||"en-US";const t=e.split("-");return e=Object.prototype.hasOwnProperty.call(gg.translations,t[0])?t[0]:"en",e},UU={height:660,width:375},kU={height:740,width:1315},qU={height:700,width:1200},r1={height:600,width:400};function HU(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return r&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}function ws(e){let{width:t,height:r}=e;const i=window.screenLeft!==void 0?window.screenLeft:window.screenX,a=window.screenTop!==void 0?window.screenTop:window.screenY,s=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,f=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,c=1,l=Math.abs((s-t)/2/c+i),d=Math.abs((f-r)/2/c+a);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${r/c},width=${t/c},top=${d},left=${l}`}class n1 extends Rl{constructor(t,r){let{maxEventListeners:i=100,jsonRpcStreamName:a="provider"}=r;if(super(),tt(this,"isTorus",void 0),tt(this,"_rpcEngine",void 0),tt(this,"jsonRpcConnectionEvents",void 0),tt(this,"_state",void 0),!NU.duplex(t))throw new Error(zn.errors.invalidDuplexStream());this.isTorus=!0,this.setMaxListeners(i),this._handleConnect=this._handleConnect.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this._initializeState=this._initializeState.bind(this),this.request=this.request.bind(this),this.sendAsync=this.sendAsync.bind(this);const s=new PU;Ib(t,s,t,this._handleStreamDisconnect.bind(this,"Torus")),s.ignoreStream("phishing");const f=AU();Ib(f.stream,s.createStream(a),f.stream,this._handleStreamDisconnect.bind(this,"Torus RpcProvider"));const c=new di;c.push(TU()),c.push(DU()),c.push(_U({origin:location.origin})),c.push(f.middleware),this._rpcEngine=c,this.jsonRpcConnectionEvents=f.events}async request(t){if(!t||typeof t!="object"||Array.isArray(t))throw Ln.ethErrors.rpc.invalidRequest({message:zn.errors.invalidRequestArgs(),data:t});const{method:r,params:i}=t;if(typeof r!="string"||r.length===0)throw Ln.ethErrors.rpc.invalidRequest({message:zn.errors.invalidRequestMethod(),data:t});if(i!==void 0&&!Array.isArray(i)&&(typeof i!="object"||i===null))throw Ln.ethErrors.rpc.invalidRequest({message:zn.errors.invalidRequestParams(),data:t});return new Promise((a,s)=>{this._rpcRequest({method:r,params:i},tp(a,s))})}send(t,r){this._rpcRequest(t,r)}sendAsync(t){return new Promise((r,i)=>{this._rpcRequest(t,tp(r,i))})}_handleStreamDisconnect(t,r){jU(t,r,this),this._handleDisconnect(!1,r?r.message:void 0)}}const WU=function(e,t,r){for(var i=arguments.length,a=new Array(i>3?i-3:0),s=3;s{r(...a),e.removeEventListener(t,f)};e.addEventListener(t,f)};async function i1(){return new Promise(e=>{document.readyState!=="loading"?e():WU(document,"DOMContentLoaded",e)})}const ga=e=>{const t=window.document.createElement("template"),r=e.trim();return t.innerHTML=r,t.content.firstChild};function nu(e){return e.version===void 0}class o1 extends Rl{constructor(t){let{url:r,target:i,features:a}=t;super(),tt(this,"url",void 0),tt(this,"target",void 0),tt(this,"features",void 0),tt(this,"window",void 0),tt(this,"windowTimer",void 0),tt(this,"iClosedWindow",void 0),this.url=r,this.target=i||"_blank",this.features=a||ws(qU),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval(()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0),this.window===void 0&&clearInterval(this.windowTimer)},500))}open(){var t;return this.window=window.open(this.url.href,this.target,this.features),(t=this.window)!=null&&t.focus&&this.window.focus(),Promise.resolve()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(t){t?window.location.replace(this.url.href):window.location.href=this.url.href}}function wv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function zU(e){for(var t=1;t{this._state.isConnected=!0});const f=c=>{const{method:l,params:d}=c;if(l===cs.IFRAME_STATUS){const{isFullScreen:h,rid:b}=d;this._displayIframe({isFull:h,rid:b})}else if(l===cs.CREATE_WINDOW){const{windowId:h,url:b}=d;this._createPopupBlockAlert(h,b)}else if(l===cs.CLOSE_WINDOW)this._handleCloseWindow(d);else if(l===cs.USER_LOGGED_IN){const{currentLoginProvider:h}=d;this._state.isLoggedIn=!0,this._state.currentLoginProvider=h}else l===cs.USER_LOGGED_OUT&&(this._state.isLoggedIn=!1,this._state.currentLoginProvider=null,this._displayIframe())};this.jsonRpcConnectionEvents.on("notification",f)}get isLoggedIn(){return this._state.isLoggedIn}get isIFrameFullScreen(){return this._state.isIFrameFullScreen}isConnected(){return this._state.isConnected}async _initializeState(t){try{const{torusUrl:r,dappStorageKey:i,torusAlertContainer:a,torusIframe:s}=t;this.torusUrl=r,this.dappStorageKey=i,this.torusAlertContainer=a,this.torusIframe=s,this.torusIframe.addEventListener("load",()=>{this._state.isIFrameFullScreen||this._displayIframe()});const{currentLoginProvider:f,isLoggedIn:c}=await this.request({method:kn.GET_PROVIDER_STATE,params:[]});this._handleConnect(f,c)}catch(r){Dt.error("Torus: Failed to get initial state. Please report this bug.",r)}finally{Dt.info("initialized communication state"),this._state.initialized=!0,this.emit("_initialized")}}_handleWindow(t){let{url:r,target:i,features:a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=new URL(r||`${this.torusUrl}/redirect?windowId=${t}`);this.dappStorageKey&&(s.hash?s.hash+=`&dappStorageKey=${this.dappStorageKey}`:s.hash=`#dappStorageKey=${this.dappStorageKey}`);const f=new o1({url:s,target:i,features:a});if(f.open(),!f.window){this._createPopupBlockAlert(t,s.href);return}this.windowRefs[t]=f,this.request({method:kn.OPENED_WINDOW,params:{windowId:t}}),f.once("close",()=>{delete this.windowRefs[t],this.request({method:kn.CLOSED_WINDOW,params:{windowId:t}})})}_displayIframe(){let{isFull:t=!1,rid:r=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const i={};if(t)i.display="block",i.width="100%",i.height="100%",i.top="0px",i.right="0px",i.left="0px",i.bottom="0px";else switch(i.display=this._state.torusWidgetVisibility?"block":"none",i.height="70px",i.width="70px",this._state.buttonPosition){case ps.TOP_LEFT:i.top="0px",i.left="0px",i.right="auto",i.bottom="auto";break;case ps.TOP_RIGHT:i.top="0px",i.right="0px",i.left="auto",i.bottom="auto";break;case ps.BOTTOM_RIGHT:i.bottom="0px",i.right="0px",i.top="auto",i.left="auto";break;case ps.BOTTOM_LEFT:default:i.bottom="0px",i.left="0px",i.top="auto",i.right="auto";break}Object.assign(this.torusIframe.style,i),this._state.isIFrameFullScreen=t,this.request({method:kn.IFRAME_STATUS,params:{isIFrameFullScreen:t,rid:r}})}hideTorusButton(){this._state.torusWidgetVisibility=!1,this._displayIframe()}showTorusButton(){this._state.torusWidgetVisibility=!0,this._displayIframe()}_rpcRequest(t,r){const i=r,a=t;Array.isArray(a)||a.jsonrpc||(a.jsonrpc="2.0"),this.tryWindowHandle(a,i)}_handleConnect(t,r){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{currentLoginProvider:t,isLoggedIn:r}),Dt.debug(zn.info.connected(t)))}_handleDisconnect(t,r){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){this._state.isConnected=!1;let i;t?(i=new Ln.EthereumRpcError(1013,r||zn.errors.disconnected()),Dt.debug(i)):(i=new Ln.EthereumRpcError(1011,r||zn.errors.permanentlyDisconnected()),Dt.error(i),this._state.currentLoginProvider=null,this._state.isLoggedIn=!1,this._state.torusWidgetVisibility=!1,this._state.isIFrameFullScreen=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",i)}}_handleCloseWindow(t){const{windowId:r}=t;this.windowRefs[r]&&(this.windowRefs[r].close(),delete this.windowRefs[r])}async _createPopupBlockAlert(t,r){const i=this.getLogoUrl(),a=ga(`

${this.embedTranslations.actionRequired}

${this.embedTranslations.pendingAction}

`),s=ga(``),f=ga('
');f.appendChild(s),a.appendChild(f);const c=()=>{s.addEventListener("click",()=>{this._handleWindow(t,{url:r,target:"_blank",features:ws(r1)}),a.remove(),this.torusAlertContainer.children.length===0&&(this.torusAlertContainer.style.display="none")})},l=()=>{this.torusAlertContainer.appendChild(a)};await i1(),l(),c(),this.torusAlertContainer.style.display="block"}getLogoUrl(){return`${this.torusUrl}/images/torus_icon-blue.svg`}}tt(Al,"_defaultState",{buttonPosition:"bottom-left",currentLoginProvider:null,isIFrameFullScreen:!1,hasEmittedConnection:!1,torusWidgetVisibility:!1,initialized:!1,isLoggedIn:!1,isPermanentlyDisconnected:!1,isConnected:!1});function mv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function GU(e){for(var t=1;t{this._state.isConnected=!0});const s=f=>{const{method:c,params:l}=f;c===dh.ACCOUNTS_CHANGED?this._handleAccountsChanged(l):c===dh.UNLOCK_STATE_CHANGED?this._handleUnlockStateChanged(l):c===dh.CHAIN_CHANGED&&this._handleChainChanged(l)};this.jsonRpcConnectionEvents.on("notification",s)}isConnected(){return this._state.isConnected}async _initializeState(){try{const{accounts:t,chainId:r,isUnlocked:i}=await this.request({method:yU.GET_PROVIDER_STATE,params:[]});this.emit("connect",{chainId:r}),this._handleChainChanged({chainId:r}),this._handleUnlockStateChanged({accounts:t,isUnlocked:i}),this._handleAccountsChanged(t)}catch(t){Dt.error("Torus: Failed to get initial state. Please report this bug.",t)}finally{Dt.info("initialized provider state"),this._state.initialized=!0,this.emit("_initialized")}}_rpcRequest(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=r;const s=t;if(!Array.isArray(s)){if(s.jsonrpc||(s.jsonrpc="2.0"),s.method==="solana_accounts"||s.method==="solana_requestAccounts")a=(f,c)=>{this._handleAccountsChanged(c.result||[],s.method==="solana_accounts",i),r(f,c)};else if(s.method==="wallet_getProviderState"){this._rpcEngine.handle(t,a);return}}this.tryWindowHandle(s,a)}_handleConnect(t){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:t}),Dt.debug(zn.info.connected(t)))}_handleDisconnect(t,r){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){this._state.isConnected=!1;let i;t?(i=new Ln.EthereumRpcError(1013,r||zn.errors.disconnected()),Dt.debug(i)):(i=new Ln.EthereumRpcError(1011,r||zn.errors.permanentlyDisconnected()),Dt.error(i),this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",i)}}_handleAccountsChanged(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=t;Array.isArray(a)||(Dt.error("Torus: Received non-array accounts parameter. Please report this bug.",a),a=[]);for(const s of t)if(typeof s!="string"){Dt.error("Torus: Received non-string account. Please report this bug.",t),a=[];break}BU(this._state.accounts,a)||(r&&Array.isArray(this._state.accounts)&&this._state.accounts.length>0&&!i&&Dt.error('Torus: "solana_accounts" unexpectedly updated accounts. Please report this bug.',a),this._state.accounts=a,this.emit("accountsChanged",a)),this.selectedAddress!==a[0]&&(this.selectedAddress=a[0]||null)}_handleChainChanged(){let{chainId:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!t){Dt.error("Torus: Received invalid network parameters. Please report this bug.",{chainId:t});return}t==="loading"?this._handleDisconnect(!0):(this._handleConnect(t),t!==this.chainId&&(this.chainId=t,this._state.initialized&&this.emit("chainChanged",this.chainId)))}_handleUnlockStateChanged(){let{accounts:t,isUnlocked:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof r!="boolean"){Dt.error("Torus: Received invalid isUnlocked parameter. Please report this bug.",{isUnlocked:r});return}r!==this._state.isUnlocked&&(this._state.isUnlocked=r,this._handleAccountsChanged(t||[]))}}tt(Tl,"_defaultState",{accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1,hasEmittedConnection:!1});function Ev(e){return new Promise((t,r)=>{try{const i=document.createElement("img");i.onload=()=>t(!0),i.onerror=()=>t(!1),i.src=e}catch(i){r(i)}})}const VU=e=>{const{document:t}=e,r=t.querySelector('head > meta[property="og:site_name"]');if(r)return r.content;const i=t.querySelector('head > meta[name="title"]');return i?i.content:t.title&&t.title.length>0?t.title:e.location.hostname};async function ZU(e){try{const{document:t}=e;let r=t.querySelector('head > link[rel="shortcut icon"]');return r&&await Ev(r.href)||(r=Array.from(t.querySelectorAll('head > link[rel="icon"]')).find(i=>!!i.href),r&&await Ev(r.href))?r.href:""}catch{return""}}const KU=async()=>({name:VU(window),icon:await ZU(window)});function Sv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,i)}return r}function gh(e){for(var t=1;t"u")return;const t=document.createElement("link"),{torusUrl:r}=await t1("production");t.href=`${r}/frame`,t.crossOrigin="anonymous",t.type="text/html",t.rel="prefetch",t.relList&&t.relList.supports&&t.relList.supports("prefetch")&&document.head.appendChild(t)}catch(t){Dt.warn(t)}})();class o4{constructor(){let{modalZIndex:t=99999}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tt(this,"isInitialized",void 0),tt(this,"torusAlert",void 0),tt(this,"modalZIndex",void 0),tt(this,"alertZIndex",void 0),tt(this,"requestedLoginProvider",void 0),tt(this,"provider",void 0),tt(this,"communicationProvider",void 0),tt(this,"dappStorageKey",void 0),tt(this,"isTopupHidden",!1),tt(this,"torusAlertContainer",void 0),tt(this,"torusUrl",void 0),tt(this,"torusIframe",void 0),tt(this,"styleLink",void 0),this.torusUrl="",this.isInitialized=!1,this.requestedLoginProvider=null,this.modalZIndex=t,this.alertZIndex=t+1e3,this.dappStorageKey=""}get isLoggedIn(){return this.communicationProvider?this.communicationProvider.isLoggedIn:!1}async init(){let{buildEnv:t=$U.PRODUCTION,enableLogging:r=!1,network:i,showTorusButton:a=!1,useLocalStorage:s=!1,buttonPosition:f=ps.BOTTOM_LEFT,apiKey:c="torus-default",extraParams:l={},whiteLabel:d}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.isInitialized)throw new Error("Already initialized");const{torusUrl:h,logLevel:b}=await t1(t);Dt.enableAll(),Dt.info(h,"url loaded"),Dt.info(`Solana Embed Version :${xU}`),this.torusUrl=h,Dt.setDefaultLevel(b),r?Dt.enableAll():Dt.disableAll();const R=this.handleDappStorageKey(s),A=new URL(h);A.pathname.endsWith("/")?A.pathname+="frame":A.pathname+="/frame";const N=new URLSearchParams;R&&N.append("dappStorageKey",R),N.append("origin",window.location.origin),A.hash=N.toString(),this.torusIframe=ga(``),this.torusAlertContainer=ga(``),this.styleLink=ga(``);const ae=async()=>new Promise((K,I)=>{try{window.document.head.appendChild(this.styleLink),window.document.body.appendChild(this.torusIframe),window.document.body.appendChild(this.torusAlertContainer),this.torusIframe.addEventListener("load",async()=>{const y=await KU();this.torusIframe.contentWindow.postMessage({buttonPosition:f,apiKey:c,network:i,dappMetadata:y,extraParams:l,whiteLabel:d},A.origin),await this._setupWeb3({torusUrl:h}),a&&this.showTorusButton(),d!=null&&d.topupHide?this.isTopupHidden=d.topupHide:this.hideTorusButton(),this.isInitialized=!0,window.torus=this,K()})}catch(y){I(y)}});await i1(),await ae()}async login(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.isInitialized)throw new Error("Call init() first");try{this.requestedLoginProvider=t.loginProvider||null,this.requestedLoginProvider||this.communicationProvider._displayIframe({isFull:!0});const r=await new Promise((i,a)=>{this.provider._rpcRequest({method:"solana_requestAccounts",params:[this.requestedLoginProvider,t.login_hint]},tp(i,a))});if(Array.isArray(r)&&r.length>0)return r;throw new Error("Login failed")}catch(r){throw Dt.error("login failed",r),r}finally{this.communicationProvider.isIFrameFullScreen&&this.communicationProvider._displayIframe()}}async loginWithPrivateKey(t){if(!this.isInitialized)throw new Error("Call init() first");const{privateKey:r,userInfo:i}=t,{success:a}=await this.communicationProvider.request({method:"login_with_private_key",params:{privateKey:r,userInfo:i}});if(!a)throw new Error("Login Failed")}async logout(){if(!this.communicationProvider.isLoggedIn)throw new Error("Not logged in");await this.communicationProvider.request({method:kn.LOGOUT,params:[]}),this.requestedLoginProvider=null}async cleanUp(){this.communicationProvider.isLoggedIn&&await this.logout(),this.clearInit()}clearInit(){function t(r){return r instanceof Element||r instanceof Document}t(this.styleLink)&&window.document.body.contains(this.styleLink)&&(this.styleLink.remove(),this.styleLink=void 0),t(this.torusIframe)&&window.document.body.contains(this.torusIframe)&&(this.torusIframe.remove(),this.torusIframe=void 0),t(this.torusAlertContainer)&&window.document.body.contains(this.torusAlertContainer)&&(this.torusAlert=void 0,this.torusAlertContainer.remove(),this.torusAlertContainer=void 0),this.isInitialized=!1}hideTorusButton(){this.communicationProvider.hideTorusButton()}showTorusButton(){this.communicationProvider.showTorusButton()}async setProvider(t){await this.communicationProvider.request({method:kn.SET_PROVIDER,params:gh({},t)})}async showWallet(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=await this.communicationProvider.request({method:kn.WALLET_INSTANCE_ID,params:[]}),a=t?`/${t}`:"",s=new URL(`${this.torusUrl}/wallet${a}`);s.searchParams.append("instanceId",i),Object.keys(r).forEach(c=>{s.searchParams.append(c,r[c])}),this.dappStorageKey&&(s.hash=`#dappStorageKey=${this.dappStorageKey}`),new o1({url:s,features:ws(kU)}).open()}async getUserInfo(){return await this.communicationProvider.request({method:kn.USER_INFO,params:[]})}async initiateTopup(t,r){if(!this.isInitialized)throw new Error("Torus is not initialized");const i=ru();return this.communicationProvider._handleWindow(i),await this.communicationProvider.request({method:kn.TOPUP,params:{provider:t,params:r,windowId:i}})}async getAccounts(){return await this.provider.request({method:"getAccounts",params:[]})}async sendTransaction(t){const r=nu(t),i=r?t.serialize({requireAllSignatures:!1}).toString("hex"):Ce.Buffer.from(t.serialize()).toString("hex");return await this.provider.request({method:"send_transaction",params:{message:i,isLegacyTransaction:r}})}async signAndSendTransaction(t,r){const i=nu(t),a=i?t.serialize({requireAllSignatures:!1}).toString("hex"):Ce.Buffer.from(t.serialize()).toString("hex");return{signature:await this.provider.request({method:"send_transaction",params:{message:a,options:r,isLegacyTransaction:i}})}}async signTransaction(t){const r=nu(t),i=r?t.serializeMessage().toString("hex"):Ce.Buffer.from(t.message.serialize()).toString("hex"),a=await this.provider.request({method:"sign_transaction",params:{message:i,messageOnly:!0,isLegacyTransaction:r}}),s=JSON.parse(a),f={publicKey:new by(s.publicKey),signature:Ce.Buffer.from(s.signature,"hex")};return t.addSignature(f.publicKey,f.signature),t}async signAllTransactions(t){let r;const i=t.map(f=>(r=nu(f),r?f.serializeMessage().toString("hex"):Ce.Buffer.from(f.message.serialize()).toString("hex"))),s=(await this.provider.request({method:"sign_all_transactions",params:{message:i,messageOnly:!0,isLegacyTransaction:r}})).map(f=>{const c=JSON.parse(f);return{publicKey:new by(c.publicKey),signature:Ce.Buffer.from(c.signature,"hex")}});return t.forEach((f,c)=>(f.addSignature(s[c].publicKey,s[c].signature),f)),t}async signMessage(t){return await this.provider.request({method:"sign_message",params:{data:t}})}async getGaslessPublicKey(){return await this.provider.request({method:"get_gasless_public_key",params:[]})}handleDappStorageKey(t){const r=`${gg.localStorageKeyPrefix}${window.location.hostname}`;let i="";if(YU&&t){const a=window.localStorage.getItem(r);if(a)i=a;else{const s=`torus-app-${ru()}`;window.localStorage.setItem(r,s),i=s}}return this.dappStorageKey=i,i}async _setupWeb3(t){Dt.info("setupWeb3 running");const r=new pv({name:"embed_torus",target:"iframe_torus",targetWindow:this.torusIframe.contentWindow}),i=new pv({name:"embed_communication",target:"iframe_communication",targetWindow:this.torusIframe.contentWindow}),a=new Tl(r,{}),s=new Al(i,{});a.tryWindowHandle=(d,h)=>{const b=d;if(!Array.isArray(b)&&JU.includes(b.method)){if(!this.communicationProvider.isLoggedIn)throw new Error("User Not Logged In");const R=ru();s._handleWindow(R,{target:"_blank",features:ws(r1)}),b.windowId=R}a._rpcEngine.handle(b,h)},s.tryWindowHandle=(d,h)=>{const b=d;if(!Array.isArray(b)&&XU.includes(b.method)){const R=ru();s._handleWindow(R,{target:"_blank",features:ws(UU)}),b.params.windowId=R}s._rpcEngine.handle(b,h)};const f=d=>{const h=a[d],b=this;a[d]=function(A,N){const{method:ae,params:K=[]}=A;if(ae==="solana_requestAccounts"){if(!N)return b.login({loginProvider:K[0]});b.login({loginProvider:K[0]}).then(I=>N(null,I)).catch(I=>N(I))}return h.apply(this,[A,N])}};f("request"),f("sendAsync"),f("send");const c=new Proxy(a,{deleteProperty:()=>!0}),l=new Proxy(s,{deleteProperty:()=>!0});this.provider=c,this.communicationProvider=l,await Promise.all([a._initializeState(),s._initializeState(gh(gh({},t),{},{dappStorageKey:this.dappStorageKey,torusAlertContainer:this.torusAlertContainer,torusIframe:this.torusIframe}))]),Dt.debug("Torus - injected provider")}}export{ps as BUTTON_POSITION,ph as LOGIN_PROVIDER,i4 as PAYMENT_PROVIDER,$U as TORUS_BUILD_ENV,Tl as TorusInPageProvider,o4 as default}; diff --git a/preview-build/assets/widget-93dd4fab.js b/preview-build/assets/widget-93dd4fab.js deleted file mode 100644 index 42122cd..0000000 --- a/preview-build/assets/widget-93dd4fab.js +++ /dev/null @@ -1,9 +0,0 @@ -import{r as je,C as aE,R as uE,a as cE,g as _5,i as E5,j as ee,u as lE,b as hE,c as fE,W as dE,S as pE,d as gE,t as Lr,T as Dh,P as Kt,e as x5,f as yE,h as Ae,k as mE,l as zh,s as p1,m as Dc,n as py,o as jh,p as Nt,q as wE,v as A5,w as bE,B as g1,x as vE,y as _E,z as B0,A as Zr,D as Fh,E as M0,F as k5,G as EE,N as gy,H as xE,L as AE,I as kE}from"./index-fa8ce1ea.js";const SE=({children:r,endpoint:e,config:t={commitment:"confirmed"}})=>{const n=je.useMemo(()=>new aE(e,t),[e,t]);return uE.createElement(cE.Provider,{value:{connection:n}},r)};function IE(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return o}const y1=_5(E5);var BE=function(r){return function(e,t){var n=je.useRef(!1);r(function(){return function(){n.current=!1}},[]),r(function(){if(!n.current)n.current=!0;else return e()},t)}},P0=function(r){return typeof r=="function"},ME=function(r){return typeof r>"u"},PE=!1;const LE=PE;function CE(r){LE&&(P0(r)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof r)));var e=je.useRef(r);e.current=je.useMemo(function(){return r},[r]);var t=je.useRef();return t.current||(t.current=function(){for(var n=[],i=0;i{},emptyCart:()=>{},removeFromCart:()=>{},referrerKey:void 0}),zE=({children:r,referrerKey:e}={})=>{const[t={},n]=DE("bonfida-widget-cart",{defaultValue:{}}),i=u=>{n({...t,[u.domain]:u})},o=u=>{const l={...t};delete l[u],n(l)},s=()=>n({}),a=!Object.values(t).length;return ee.jsx(zc.Provider,{value:{cart:t,addToCart:i,removeFromCart:o,isCartEmpty:a,emptyCart:s,referrerKey:e},children:r})},$h=je.createContext({status:null,setStatus:()=>{},setError:()=>{}}),jE=({children:r})=>{const[e,t]=je.useState(null),n=i=>{t({status:"error",message:i})};return ee.jsx($h.Provider,{value:{status:e,setStatus:t,setError:n},children:r})},m1=je.createContext({connection:null});function jc(){return je.useContext(m1)}const FE=({children:r})=>{const{connection:e}=lE();return ee.jsx(m1.Provider,{value:{connection:e},children:r})},$E=({children:r,connection:e})=>e?e?ee.jsx(m1.Provider,{value:{connection:e},children:r}):ee.jsx(ee.Fragment,{children:r}):ee.jsx(FE,{children:r}),KE={publicKey:null,wallets:[],wallet:null,connect:async()=>{},select:()=>{},connecting:!1,connected:!1,disconnect:async()=>{},visible:!1,setVisible:()=>{},connection:null,signAllTransactions:async r=>r},w1=je.createContext(KE);function Kh(){return je.useContext(w1)}const VE=({children:r})=>{const e=hE(),{connection:t}=jc(),{visible:n,setVisible:i}=fE(),o={visible:n,setVisible:i,connection:t,...e};return ee.jsx(w1.Provider,{value:o,children:r})},qE=({children:r,passthroughWallet:e})=>{const{connection:t}=jc();return e?e?ee.jsx(w1.Provider,{value:{...e,connection:t},children:r}):ee.jsx(ee.Fragment,{children:r}):ee.jsx(VE,{children:r})},HE=({children:r,endpoint:e,connection:t,passthroughWallet:n})=>{const i=je.useMemo(()=>e&&!t?({children:s})=>ee.jsx(SE,{endpoint:e,children:s}):je.Fragment,[e,t]),o=je.useMemo(()=>n?je.Fragment:({children:s})=>ee.jsx(dE,{wallets:[new pE],autoConnect:!0,children:s}),[n]);return ee.jsx(i,{children:ee.jsx(o,{children:ee.jsx(gE,{children:ee.jsx($E,{connection:t,children:ee.jsx(qE,{passthroughWallet:n,children:r})})})})})},WE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.56 3.06a3.092 3.092 0 0 0-.56.206c-.266.13-.398.244-1.17 1.008l-.87.86.184.343c1.138 2.12 2.165 3.161 4.24 4.3l.476.261.823-.822c.478-.477.879-.913.955-1.039.337-.556.438-1.178.288-1.772-.149-.588-.273-.758-1.342-1.838-1.043-1.054-1.36-1.307-1.816-1.448a2.668 2.668 0 0 0-1.208-.059M9.873 9.233c-3.16 3.169-3.114 3.117-3.29 3.667-.068.213-.583 3.732-.583 3.986C6 17.435 6.565 18 7.114 18c.254 0 3.773-.515 3.986-.583.55-.176.498-.13 3.667-3.29l2.986-2.979-.478-.274c-1.888-1.082-3.003-2.19-4.104-4.081l-.319-.547-2.979 2.987M3.394 19.601c-.284.15-.426.445-.376.779.035.236.278.518.497.579.201.056 16.769.056 16.97 0 .219-.061.462-.343.497-.579.051-.339-.094-.633-.384-.781-.153-.078-.272-.079-8.606-.077-8.276.001-8.455.003-8.598.079"})),S5=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",d:"M19.748 9.058a.75.75 0 0 0-1.496-.116l1.496.116Zm-1.464 9.249.748.057-.748-.057Zm-12.568 0-.748.057.748-.057Zm.032-9.365a.75.75 0 1 0-1.496.116l1.496-.116ZM20.67 7.674a.75.75 0 0 0 .658-1.348l-.658 1.348Zm-18-1.348a.75.75 0 1 0 .658 1.348L2.67 6.326ZM9.25 5a.75.75 0 0 0 1.5 0h-1.5Zm4 0a.75.75 0 0 0 1.5 0h-1.5Zm-2.5 6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.5-6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.002-8.058-.716 9.307 1.496.115.716-9.306-1.496-.116ZM14.296 21.25H9.704v1.5h4.592v-1.5Zm-7.832-3-.716-9.308-1.496.116.716 9.306 1.496-.115Zm3.24 3a3.25 3.25 0 0 1-3.24-3l-1.496.114a4.75 4.75 0 0 0 4.736 4.386v-1.5Zm7.832-3a3.25 3.25 0 0 1-3.24 3v1.5a4.75 4.75 0 0 0 4.736-4.386l-1.496-.115ZM12 5.75c3.204 0 6.18.71 8.671 1.924l.658-1.348C18.624 5.008 15.423 4.25 12 4.25v1.5ZM3.329 7.674C5.82 6.46 8.796 5.75 12 5.75v-1.5c-3.423 0-6.624.758-9.329 2.076l.658 1.348ZM10.75 5V4h-1.5v1h1.5Zm2.5-1v1h1.5V4h-1.5ZM12 2.75c.69 0 1.25.56 1.25 1.25h1.5A2.75 2.75 0 0 0 12 1.25v1.5ZM10.75 4c0-.69.56-1.25 1.25-1.25v-1.5A2.75 2.75 0 0 0 9.25 4h1.5Zm-1.5 7v6h1.5v-6h-1.5Zm4 0v6h1.5v-6h-1.5Z"})),I5=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M22 7a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v10a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V7Z"}),je.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12a3 3 0 0 0-3-3H2v6h3a3 3 0 0 0 3-3Z"})),ZE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",d:"M2.587 9.25a.75.75 0 1 0 0 1.5v-1.5Zm18.826 1.5a.75.75 0 0 0 0-1.5v1.5ZM18.035 6v.75V6Zm3.882 4.808.735.15-.735-.15Zm-19.834 0 .735-.15-.735.15ZM5.965 6v-.75V6ZM7.6 22v-.75.75Zm-3.882-3.192.735-.15-.735.15ZM16.4 22v.75V22Zm3.882-3.192-.735-.15.735.15ZM8 13.25a.75.75 0 0 0 0 1.5v-1.5Zm8 1.5a.75.75 0 0 0 0-1.5v1.5Zm-7 2.5a.75.75 0 0 0 0 1.5v-1.5Zm6 1.5a.75.75 0 0 0 0-1.5v1.5ZM9.6 2.45a.75.75 0 1 0-1.2-.9l1.2.9Zm-4.2 3.1a.75.75 0 1 0 1.2.9l-1.2-.9Zm10.2-4a.75.75 0 1 0-1.2.9l1.2-.9Zm1.8 4.9a.75.75 0 1 0 1.2-.9l-1.2.9Zm-1 14.8H7.6v1.5h8.8v-1.5ZM4.453 18.658l-1.635-8-1.47.3 1.635 8 1.47-.3ZM5.965 6.75h12.07v-1.5H5.965v1.5Zm15.217 3.908-1.635 8 1.47.3 1.635-8-1.47-.3Zm-18.595.092h18.826v-1.5H2.587v1.5Zm15.448-4c2.028 0 3.56 1.883 3.147 3.908l1.47.3c.6-2.938-1.623-5.708-4.617-5.708v1.5ZM2.818 10.658C2.404 8.633 3.938 6.75 5.965 6.75v-1.5c-2.994 0-5.217 2.77-4.617 5.708l1.47-.3ZM7.6 21.25a3.222 3.222 0 0 1-3.147-2.592l-1.47.3c.45 2.203 2.375 3.792 4.617 3.792v-1.5Zm8.8 1.5c2.242 0 4.167-1.589 4.617-3.792l-1.47-.3A3.223 3.223 0 0 1 16.4 21.25v1.5Zm-8.4-8h8v-1.5H8v1.5Zm1 4h6v-1.5H9v1.5Zm-.6-17.2-3 4 1.2.9 3-4-1.2-.9Zm6 .9 3 4 1.2-.9-3-4-1.2.9Z"})),GE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",d:"M5.469 12.414a.75.75 0 0 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM4.53 13.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),B5=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.12 2.039c-2.479.248-4.706 1.323-6.359 3.068a9.985 9.985 0 0 0-1.624 11.516 9.432 9.432 0 0 0 1.801 2.438c.992.99 2.1 1.728 3.334 2.217 3.362 1.332 7.041.802 9.928-1.433.437-.338 1.307-1.208 1.645-1.645C21.256 16.378 22 14.236 22 12c0-4.568-3.158-8.613-7.57-9.697-.984-.241-2.402-.355-3.31-.264m1.285 5.342c.08.051.188.162.24.246.091.146.095.184.095.88v.726l-.121.172c-.166.236-.346.334-.619.334s-.453-.098-.619-.334l-.121-.172v-.726c0-.691.005-.734.093-.876.233-.375.691-.484 1.052-.25m-.113 3.433c.155.065.375.305.417.457.017.06.031 1.201.031 2.536v2.426l-.121.172c-.166.237-.346.334-.619.334s-.453-.097-.619-.334l-.121-.172v-2.426c0-1.335.014-2.476.031-2.536.041-.147.259-.39.408-.455a.881.881 0 0 1 .593-.002"})),M5=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",d:"M16.773 8.288a.75.75 0 0 0-1.06-1.061l1.06 1.06Zm-9.546 7.424a.75.75 0 0 0 1.06 1.061l-1.06-1.06Zm8.485 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM8.288 7.228a.75.75 0 0 0-1.061 1.06l1.06-1.06Zm7.424 0-8.485 8.485 1.06 1.061 8.486-8.485-1.06-1.061Zm1.06 8.485L8.289 7.227l-1.061 1.06 8.485 8.486 1.06-1.06Z"})),YE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",d:"m18.63 21.422.53-.53-.53.53Zm2.792-2.793.53-.53-.53.53Zm-1.392-2.452a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm-2.792 2.793a.75.75 0 0 0-1.06 1.06l1.06-1.06ZM2.75 10.5a7.75 7.75 0 0 1 7.75-7.75v-1.5a9.25 9.25 0 0 0-9.25 9.25h1.5Zm7.75-7.75a7.75 7.75 0 0 1 7.75 7.75h1.5a9.25 9.25 0 0 0-9.25-9.25v1.5Zm7.75 7.75a7.75 7.75 0 0 1-7.75 7.75v1.5a9.25 9.25 0 0 0 9.25-9.25h-1.5Zm-7.75 7.75a7.75 7.75 0 0 1-7.75-7.75h-1.5a9.25 9.25 0 0 0 9.25 9.25v-1.5Zm10.391 2.641a1.224 1.224 0 0 1-1.731 0l-1.061 1.061a2.725 2.725 0 0 0 3.853 0l-1.06-1.06Zm0-1.731a1.224 1.224 0 0 1 0 1.731l1.061 1.061a2.725 2.725 0 0 0 0-3.853l-1.06 1.06Zm-1.921-1.922 1.921 1.922 1.061-1.061-1.922-1.922-1.06 1.06Zm.19 3.653-1.922-1.921-1.06 1.06 1.92 1.922 1.062-1.06Z"})),JE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{fill:"currentColor",d:"M16.625 3.987a.75.75 0 1 0 .75-1.298l-.75 1.298Zm5.448 4.25a.75.75 0 1 0-1.405.526l1.405-.526ZM7.469 9.414a.75.75 0 1 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM21.25 12A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75c1.686 0 3.265.45 4.625 1.237l.75-1.298A10.704 10.704 0 0 0 12 1.25v1.5Zm8.668 6.013A9.228 9.228 0 0 1 21.25 12h1.5c0-1.322-.24-2.59-.677-3.763l-1.405.526ZM6.53 10.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),XE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m10 8-4 4m0 0 4 4m-4-4h12"})),QE=r=>je.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},je.createElement("circle",{cx:12,cy:7,r:1,fill:"currentColor"}),je.createElement("path",{fill:"currentColor",d:"M11 9.25a.75.75 0 0 0 0 1.5v-1.5Zm1 .75h.75a.75.75 0 0 0-.75-.75V10Zm-.75 7a.75.75 0 0 0 1.5 0h-1.5Zm10-5A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75A9.25 9.25 0 0 1 21.25 12h1.5c0-5.937-4.813-10.75-10.75-10.75v1.5Zm-1 8h1v-1.5h-1v1.5Zm.25-.75v7h1.5v-7h-1.5Z"})),ex=r=>ee.jsx("svg",{width:r.width||20,height:r.height||20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:ee.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29279 7.29302C5.48031 7.10555 5.73462 7.00023 5.99979 7.00023C6.26495 7.00023 6.51926 7.10555 6.70679 7.29302L9.99979 10.586L13.2928 7.29302C13.385 7.19751 13.4954 7.12133 13.6174 7.06892C13.7394 7.01651 13.8706 6.98892 14.0034 6.98777C14.1362 6.98662 14.2678 7.01192 14.3907 7.0622C14.5136 7.11248 14.6253 7.18673 14.7192 7.28062C14.8131 7.37452 14.8873 7.48617 14.9376 7.60907C14.9879 7.73196 15.0132 7.86364 15.012 7.99642C15.0109 8.1292 14.9833 8.26042 14.9309 8.38242C14.8785 8.50443 14.8023 8.61477 14.7068 8.70702L10.7068 12.707C10.5193 12.8945 10.265 12.9998 9.99979 12.9998C9.73462 12.9998 9.48031 12.8945 9.29279 12.707L5.29279 8.70702C5.10532 8.51949 5 8.26518 5 8.00002C5 7.73486 5.10532 7.48055 5.29279 7.29302Z",fill:"currentColor"})}),tx=r=>ee.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",...r,children:ee.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 4.5h-3A1.5 1.5 0 0 0 3 6v7.5A1.5 1.5 0 0 0 4.5 15H12a1.5 1.5 0 0 0 1.5-1.5v-3m-3-7.5H15m0 0v4.5M15 3l-7.5 7.5"})}),rx=r=>ee.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...r,children:ee.jsx("path",{fill:"currentColor",d:"M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.09.09 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.09 16.09 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09-.01-.02-.04-.03-.07-.03-1.5.26-2.93.71-4.27 1.33-.01 0-.02.01-.03.02-2.72 4.07-3.47 8.03-3.1 11.95 0 .02.01.04.03.05 1.8 1.32 3.53 2.12 5.24 2.65.03.01.06 0 .07-.02.4-.55.76-1.13 1.07-1.74.02-.04 0-.08-.04-.09-.57-.22-1.11-.48-1.64-.78-.04-.02-.04-.08-.01-.11.11-.08.22-.17.33-.25.02-.02.05-.02.07-.01 3.44 1.57 7.15 1.57 10.55 0 .02-.01.05-.01.07.01.11.09.22.17.33.26.04.03.04.09-.01.11-.52.31-1.07.56-1.64.78-.04.01-.05.06-.04.09.32.61.68 1.19 1.07 1.74.03.01.06.02.09.01 1.72-.53 3.45-1.33 5.25-2.65.02-.01.03-.03.03-.05.44-4.53-.73-8.46-3.1-11.95-.01-.01-.02-.02-.04-.02ZM8.52 14.91c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.84 2.12-1.89 2.12Zm6.97 0c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.83 2.12-1.89 2.12Z"})}),nx=({type:r="text",value:e,className:t,errorMessage:n,...i}={})=>{const o=je.useRef(null);return ee.jsxs("div",{className:Lr("flex-grow",r==="search"&&"relative"),children:[ee.jsx("input",{...i,ref:o,value:e,className:Lr("w-full h-full px-3 py-4 text-sm border border-opacity-25 rounded-xl border-field-border dark:border-interactive-border bg-background-secondary text-ellipsis",t,r==="search"&&"pr-8"),type:r==="search"?"text":r}),r==="search"&&e&&ee.jsx("button",{type:"button",className:"absolute p-1 top-3 right-1","aria-label":"Clear",tabIndex:0,onClick:()=>{o.current&&(o.current.value="")},children:ee.jsx(M5,{width:24,height:24})}),n&&ee.jsx("p",{className:"absolute top-[calc(100%+4px)] text-error font-medium tracking-widest pl-3 text-xs animate-[fade-in_300ms_ease-out]",children:n})]})};var Vh={};Object.defineProperty(Vh,"__esModule",{value:!0});Vh.arabic=void 0;var ix="ؠ-يٮ-ٯٱ-ەۮ-ۯۺ-ۿ",ox="ݐ-ݿ",sx="[".concat(ix).concat(ox,"]"),ax="[ً-ٰٟ]",ux="".concat(sx).concat(ax,"*");Vh.arabic=ux;var qh={};Object.defineProperty(qh,"__esModule",{value:!0});qh.bengali=void 0;var yy="[\\u{0980}-\\u{09FF}]",cx="[\\u{0980}-\\u{0983}\\u{09BC}-\\u{09D7}\\u{09E2}\\u{09E3}\\u{09FE}]",lx="\\u{09CD}",hx="".concat(yy,"(").concat(lx).concat(yy,"|").concat(cx,")*");qh.bengali=hx;var Hh={};Object.defineProperty(Hh,"__esModule",{value:!0});Hh.devanagari=void 0;var my="[\\u{0900}-\\u{097F}]",fx="[\\u{0900}-\\u{0903}\\u{093A}-\\u{0957}\\u{0962}\\u{0963}]",dx="\\u{094D}",px="".concat(my,"(").concat(dx).concat(my,"|").concat(fx,")*");Hh.devanagari=px;var Wh={};Object.defineProperty(Wh,"__esModule",{value:!0});Wh.gujarati=void 0;var wy="[\\u{0A80}-\\u{0AFF}]",gx="[\\u{0A81}-\\u{0A83}\\u{0ABC}\\u{0ABE}-\\u{0ACD}\\u{0AE2}\\u{0AE3}\\u{0AFA}-\\u{0AFF}]",yx="\\u{0ACD}",mx="".concat(wy,"(").concat(yx).concat(wy,"|").concat(gx,")*");Wh.gujarati=mx;var Zh={};Object.defineProperty(Zh,"__esModule",{value:!0});Zh.hebrew=void 0;var wx="[א-ת]",bx="[֑-ׇֽֿׁׂׅׄ]",vx="".concat(wx).concat(bx,"*");Zh.hebrew=vx;var Gh={};Object.defineProperty(Gh,"__esModule",{value:!0});Gh.japaneseKana=void 0;var _x="[\\u{3041}-\\u{3096}\\u{309D}-\\u{309F}]",Ex="[\\u{30A0}-\\u{30FF}]",xx="[\\u{3099}-\\u{309A}]",Ax="[\\u{309B}-\\u{309C}]",kx="((".concat(Ex,"|").concat(_x,")").concat(xx,"?|").concat(Ax,")");Gh.japaneseKana=kx;var Yh={};Object.defineProperty(Yh,"__esModule",{value:!0});Yh.kannada=void 0;var by="[\\u{0C80}-\\u{0CFF}]",Sx="[\\u{0C81}-\\u{0C83}\\u{0CBC}\\u{0CBE}-\\u{0CCD}\\u{0CD5}\\u{0CD6}\\u{0CE2}\\u{0CE3}]",Ix="\\u{0CCD}",Bx="".concat(by,"(").concat(Ix).concat(by,"|").concat(Sx,")*");Yh.kannada=Bx;var Jh={};Object.defineProperty(Jh,"__esModule",{value:!0});Jh.khmer=void 0;var vy="[\\u{1780}-\\u{17FF}]",Mx="[\\u{17B6}-\\u{17D1}\\u{17D3}\\u{17DD}]",Px="\\u{17D2}",Lx="".concat(vy,"(").concat(Px).concat(vy,"|").concat(Mx,")*");Jh.khmer=Lx;var Xh={};Object.defineProperty(Xh,"__esModule",{value:!0});Xh.lao=void 0;var Cx="[\\u{0E80}-\\u{0EFF}]",Tx="[\\u{0EB1}\\u{0EB4}-\\u{0EBC}\\u{0EC8}-\\u{0ECD}]",Ox="".concat(Cx).concat(Tx,"*");Xh.lao=Ox;var Qh={};Object.defineProperty(Qh,"__esModule",{value:!0});Qh.malayalam=void 0;var _y="[\\u{0D00}-\\u{0D7F}]",Rx="[\\u{0D00}-\\u{0D03}\\u{0D3B}\\u{0D3C}\\u{0D3E}-\\u{0D4D}\\u{0D57}\\u{0D62}-\\u{0D63}]",Ux="\\u{0D4D}",Nx="".concat(_y,"(").concat(Ux).concat(_y,"|").concat(Rx,")*");Qh.malayalam=Nx;var ef={};Object.defineProperty(ef,"__esModule",{value:!0});ef.myanmar=void 0;var Ey="[\\u{1000}-\\u{109F}]",Dx=["\\u{102B}-\\u{1038}","\\u{103A}-\\u{103E}","\\u{1056}-\\u{1059}","\\u{105E}-\\u{1060}","\\u{1062}-\\u{1064}","\\u{1067}-\\u{106D}","\\u{1071}-\\u{1074}","\\u{1082}-\\u{108D}","\\u{108F}","\\u{109A}-\\u{109D}"],zx="[".concat(Dx.join(""),"]"),jx="\\u{1039}",Fx="".concat(Ey,"(").concat(jx).concat(Ey,"|").concat(zx,")*");ef.myanmar=Fx;var tf={};Object.defineProperty(tf,"__esModule",{value:!0});tf.tamil=void 0;var $x="[\\u{0B80}-\\u{0BFF}]",Kx="[\\u{0B82}-\\u{0B83}\\u{0BBE}-\\u{0BD7}\\u{0962}\\u{0963}]",Vx="".concat($x).concat(Kx,"*");tf.tamil=Vx;var rf={};Object.defineProperty(rf,"__esModule",{value:!0});rf.telugu=void 0;var xy="[\\u{0C00}-\\u{0C7F}]",qx="[\\u{0C00}-\\u{0C04}\\u{0C3E}-\\u{0C56}\\u{0C62}\\u{0C63}]",Hx="\\u{0C4D}",Wx="".concat(xy,"(").concat(Hx).concat(xy,"|").concat(qx,")*");rf.telugu=Wx;var nf={};Object.defineProperty(nf,"__esModule",{value:!0});nf.thai=void 0;var Zx="[\\u0E00-\\u0E7F]",Gx="[\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E]",Yx="".concat(Zx).concat(Gx,"*");nf.thai=Yx;var of={};Object.defineProperty(of,"__esModule",{value:!0});of.tibetan=void 0;var Jx="[\\u{0F00}-\\u{0FFF}]",Xx="[\\0F18\\0F19\\0F35\\0F37\\0F39\\0F3E\\0F3F\\u{0F71}-\\u{0F87}\\u{0F8D}-\\u{0FBC}\\u{0FC6}]",Qx="".concat(Jx).concat(Xx,"*");of.tibetan=Qx;var $o={};Object.defineProperty($o,"__esModule",{value:!0});$o.emojiVariation=$o.keyCap=$o.countryFlag=void 0;var eA="[\\u{1F1E6}-\\u{1F1FF}]{2}";$o.countryFlag=eA;var tA="[0-9#\\*][\\u{FE0F}]?\\u{20E3}";$o.keyCap=tA;var rA=["[\\u{2600}-\\u{26FF}]","[\\u{2700}-\\u{27BF}]","[\\u{1F300}-\\u{1F5FF}]","[\\u{1F600}-\\u{1F64F}]","[\\u{1F680}-\\u{1F6FF}]","[\\u{1F700}-\\u{1F77F}]","[\\u{1F900}-\\u{1F9FF}]"],Ay="(".concat(rA.join("|"),")"),nA="\\u{200D}",iA="[\\u{FE0E}\\u{FE0F}]",oA="[\\u{1F3FB}-\\u{1F3FF}]",sA="".concat(Ay,"(").concat(nA).concat(Ay,"|").concat(oA,"|").concat(iA,")*");$o.emojiVariation=sA;var aA=Vh,uA=qh,cA=Hh,lA=Wh,hA=Zh,fA=Gh,dA=Yh,pA=Jh,gA=Xh,yA=Qh,mA=ef,wA=tf,bA=rf,vA=nf,_A=of,Df=$o,EA=[Df.countryFlag,Df.keyCap,Df.emojiVariation,aA.arabic,uA.bengali,cA.devanagari,lA.gujarati,hA.hebrew,fA.japaneseKana,dA.kannada,pA.khmer,gA.lao,yA.malayalam,mA.myanmar,wA.tamil,bA.telugu,vA.thai,_A.tibetan,"."],xA=new RegExp("(".concat(EA.join("|"),")"),"gu");function AA(r){return r.match(xA)||[]}var kA={splitGraphemes:AA};const P5=(r,e=1)=>{switch(kA.splitGraphemes(r).length){case 1:return 750*e;case 2:return 700*e;case 3:return 640*e;case 4:return 160*e;default:return 20*e}},SA=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),ul=(r,e)=>{const t=SA.format(r);return e?t.replace("$",""):t},ic=[{decimals:6,tokenSymbol:"USDC",mintAddress:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",tokenName:"USD Coin",pythFeed:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",icon:"https://raw.githubusercontent.com/trustwallet/assets/f3ffd0b9ae2165336279ce2f8db1981a55ce30f8/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{decimals:9,tokenSymbol:"SOL",mintAddress:"So11111111111111111111111111111111111111112",pythFeed:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",tokenName:"Wrapped SOL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{decimals:6,tokenSymbol:"FIDA",mintAddress:"EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",tokenName:"Bonfida Token",pythFeed:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp/logo.svg"},{decimals:6,tokenSymbol:"USDT",mintAddress:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",tokenName:"USDT",pythFeed:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/D3KdBta3p53RV5FoahnJM5tP45h6Fd3AyFYgXTJvGCaK/logo.svg"},{decimals:9,tokenSymbol:"mSOL",mintAddress:"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",tokenName:"mSOL",pythFeed:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So/logo.png"},{decimals:5,tokenSymbol:"BONK",mintAddress:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",tokenName:"BONK",pythFeed:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",icon:"https://solana.fm/api/image-proxy?imageUrl=https://arweave.net/hQiPZOsRZXGXBJd_82PhVdlM_hACsT_q6wqwf5cSY7I"},{decimals:8,tokenSymbol:"BAT",mintAddress:"EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",tokenName:"BAT",pythFeed:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz/logo.png"}],IA=r=>{var e;return(e=ic.find(t=>t.tokenSymbol===r))==null?void 0:e.icon},cl="EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",L5=1232,BA=(r,e,t="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{const n=[];let i=[];for(const o of r)MA([...i,o],e,t)>L5?(n.push(i),i=[o]):i.push(o);return i.length>0&&n.push(i),n},MA=(r,e,t="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{try{const n=new Dh().add(...r);return n.recentBlockhash=t,n.feePayer=e,n.serialize({requireAllSignatures:!1,verifySignatures:!1}).length}catch{return L5+1}},Fc=new Kt("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new Kt("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const b1=new Kt("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),v1=new Kt("So11111111111111111111111111111111111111112");new Kt("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const _1=r=>{const e=r.decode.bind(r),t=r.encode.bind(r);return{decode:e,encode:t}},PA=r=>e=>{const t=x5(r,e),{encode:n,decode:i}=_1(t),o=t;return o.decode=(s,a)=>{const u=i(s,a);return yE(Ae.Buffer.from(u))},o.encode=(s,a,u)=>{const l=mE(s,r);return n(l,a,u)},o},LA=PA(8),CA=r=>{const e=zh(r),{encode:t,decode:n}=_1(e),i=e;return i.decode=(o,s)=>!!n(o,s),i.encode=(o,s,a)=>{const u=Number(o);return t(u,s,a)},i},ky=r=>{const e=x5(32,r),{encode:t,decode:n}=_1(e),i=e;return i.decode=(o,s)=>{const a=n(o,s);return new Kt(a)},i.encode=(o,s,a)=>{const u=o.toBuffer();return t(u,s,a)},i};class TA extends Error{constructor(e){super(e)}}class OA extends TA{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var oh;(function(r){r[r.InitializeMint=0]="InitializeMint",r[r.InitializeAccount=1]="InitializeAccount",r[r.InitializeMultisig=2]="InitializeMultisig",r[r.Transfer=3]="Transfer",r[r.Approve=4]="Approve",r[r.Revoke=5]="Revoke",r[r.SetAuthority=6]="SetAuthority",r[r.MintTo=7]="MintTo",r[r.Burn=8]="Burn",r[r.CloseAccount=9]="CloseAccount",r[r.FreezeAccount=10]="FreezeAccount",r[r.ThawAccount=11]="ThawAccount",r[r.TransferChecked=12]="TransferChecked",r[r.ApproveChecked=13]="ApproveChecked",r[r.MintToChecked=14]="MintToChecked",r[r.BurnChecked=15]="BurnChecked",r[r.InitializeAccount2=16]="InitializeAccount2",r[r.SyncNative=17]="SyncNative",r[r.InitializeAccount3=18]="InitializeAccount3",r[r.InitializeMultisig2=19]="InitializeMultisig2",r[r.InitializeMint2=20]="InitializeMint2",r[r.GetAccountDataSize=21]="GetAccountDataSize",r[r.InitializeImmutableOwner=22]="InitializeImmutableOwner",r[r.AmountToUiAmount=23]="AmountToUiAmount",r[r.UiAmountToAmount=24]="UiAmountToAmount",r[r.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",r[r.TransferFeeExtension=26]="TransferFeeExtension",r[r.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",r[r.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",r[r.Reallocate=29]="Reallocate",r[r.MemoTransferExtension=30]="MemoTransferExtension",r[r.CreateNativeMint=31]="CreateNativeMint",r[r.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",r[r.InterestBearingMintExtension=33]="InterestBearingMintExtension",r[r.CpiGuardExtension=34]="CpiGuardExtension",r[r.InitializePermanentDelegate=35]="InitializePermanentDelegate"})(oh||(oh={}));function RA(r,e,t){if(t.length){r.push({pubkey:e,isSigner:!1,isWritable:!1});for(const n of t)r.push({pubkey:n instanceof Kt?n:n.publicKey,isSigner:!0,isWritable:!1})}else r.push({pubkey:e,isSigner:!0,isWritable:!1});return r}const Sy=p1([zh("instruction")]);function UA(r,e,t,n=[],i=Fc){const o=RA([{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0}],t,n),s=Ae.Buffer.alloc(Sy.span);return Sy.encode({instruction:oh.CloseAccount},s),new Dc({keys:o,programId:i,data:s})}const NA=p1([py("mintAuthorityOption"),ky("mintAuthority"),LA("supply"),zh("decimals"),CA("isInitialized"),py("freezeAuthorityOption"),ky("freezeAuthority")]);NA.span;function C5(r,e,t=!1,n=Fc,i=b1){if(!t&&!Kt.isOnCurve(e.toBuffer()))throw new OA;const[o]=Kt.findProgramAddressSync([e.toBuffer(),n.toBuffer(),r.toBuffer()],i);return o}function DA(r,e,t,n,i=Fc,o=b1){return zA(r,e,t,n,Ae.Buffer.alloc(0),i,o)}function zA(r,e,t,n,i,o=Fc,s=b1){const a=[{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:jh.programId,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1}];return new Dc({keys:a,programId:s,data:i})}const Iy=p1([zh("instruction")]);function jA(r,e=Fc){const t=[{pubkey:r,isSigner:!1,isWritable:!0}],n=Ae.Buffer.alloc(Iy.span);return Iy.encode({instruction:oh.SyncNative},n),new Dc({keys:t,programId:e,data:n})}const FA=async(r,e,t,n)=>{let i=n;const o=[],s=await r.getBalance(t),a=await r.getAccountInfo(e);if(!a||!a.data){const l=DA(t,e,t,v1);o.push(l)}else{const l=await r.getTokenAccountBalance(e,"processed");if(s+parseInt(l.value.amount)[UA(r,e,e)];function KA(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var VA="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",qA="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",E1=0,T5=-3;function oc(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function HA(r,e){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new oc,this.dtree=new oc}var O5=new oc,R5=new oc,L0=new Uint8Array(30),C0=new Uint16Array(30),U5=new Uint8Array(30),N5=new Uint16Array(30),WA=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),By=new oc,Ei=new Uint8Array(320);function My(r,e,t,n){var i,o;for(i=0;i>>=1,e}function Ri(r,e,t){if(!e)return t;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>16-e;return r.tag>>>=e,r.bitcount-=e,n+t}function T0(r,e){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>=1,++i,t+=e.table[i],n-=e.table[i];while(n>=0);return r.tag=o,r.bitcount-=i,e.trans[t+n]}function GA(r,e,t){var n,i,o,s,a,u;for(n=Ri(r,5,257),i=Ri(r,5,1),o=Ri(r,4,4),s=0;s<19;++s)Ei[s]=0;for(s=0;s8;)r.sourceIndex--,r.bitcount-=8;if((e=256*(e=r.source[r.sourceIndex+1])+r.source[r.sourceIndex])!==(65535&~(256*r.source[r.sourceIndex+3]+r.source[r.sourceIndex+2])))return T5;for(r.sourceIndex+=4,t=e;t;--t)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,E1}(function(r,e){var t;for(t=0;t<7;++t)r.table[t]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,t=0;t<24;++t)r.trans[t]=256+t;for(t=0;t<144;++t)r.trans[24+t]=t;for(t=0;t<8;++t)r.trans[168+t]=280+t;for(t=0;t<112;++t)r.trans[176+t]=144+t;for(t=0;t<5;++t)e.table[t]=0;for(e.table[5]=32,t=0;t<32;++t)e.trans[t]=t})(O5,R5),My(L0,C0,4,3),My(U5,N5,2,1),L0[28]=0,C0[28]=258;var JA=function(r,e){var t,n,i=new HA(r,e);do{switch(t=ZA(i),Ri(i,2,0)){case 0:n=YA(i);break;case 1:n=Ly(i,O5,R5);break;case 2:GA(i,i.ltree,i.dtree),n=Ly(i,i.ltree,i.dtree);break;default:n=T5}if(n!==E1)throw new Error("Data error")}while(!t);return i.destLen{let n=r[e];r[e]=r[t],r[t]=n};var QA={swap32LE:r=>{XA&&(e=>{const t=e.length;for(let n=0;n1114111?this.errorValue:e<55296||e>56319&&e<=65535?(t=(this.data[e>>5]<<2)+(31&e),this.data[t]):e<=65535?(t=(this.data[2048+(e-55296>>5)]<<2)+(31&e),this.data[t]):e>11)],t=this.data[t+(e>>5&63)],t=(t<<2)+(31&e),this.data[t]):this.data[this.data.length-4]}},D5={exports:{}};D5.exports=(Ry=Oy="3.7.5",Uy=typeof atob=="function",Ny=typeof btoa=="function",is=typeof Ae.Buffer=="function",jf=typeof TextDecoder=="function"?new TextDecoder:void 0,Ff=typeof TextEncoder=="function"?new TextEncoder:void 0,Dy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ta=Array.prototype.slice.call(Dy),id={},ta.forEach(function(r,e){return id[r]=e}),gu=id,zy=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,$r=String.fromCharCode.bind(String),$f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},Kf=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,function(e){return e=="+"?"-":"_"})},Vf=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},qf=function(r){for(var e,t,n,i,o="",s=r.length%3,a=0;a255||(n=r.charCodeAt(a++))>255||(i=r.charCodeAt(a++))>255)throw new TypeError("invalid character found");o+=ta[(e=t<<16|n<<8|i)>>18&63]+ta[e>>12&63]+ta[e>>6&63]+ta[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},ll=is?function(r){return Ae.Buffer.from(r).toString("base64")}:function(r){for(var e=4096,t=[],n=0,i=r.length;n>>6)+$r(128|63&e):$r(224|e>>>12&15)+$r(128|e>>>6&63)+$r(128|63&e);var e=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return $r(240|e>>>18&7)+$r(128|e>>>12&63)+$r(128|e>>>6&63)+$r(128|63&e)},Fy=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Wf=is?function(r){return Ae.Buffer.from(r,"utf8").toString("base64")}:Ff?function(r){return ll(Ff.encode(r))}:function(r){return Hf($y(r))},Zf=function(r){return ra(r,!0)},Ky=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Vy=function(r){switch(r.length){case 4:var e=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return $r(55296+(e>>>10))+$r(56320+(1023&e));case 3:return $r((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return $r((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},Gf=function(r){if(r=r.replace(/\s+/g,""),!zy.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var e,t,n,i="",o=0;o>16&255):n===64?$r(e>>16&255,e>>8&255):$r(e>>16&255,e>>8&255,255&e);return i},Jf=is?function(r){return $f(Ae.Buffer.from(r,"base64"))}:function(r){return $f(Yf(r).split("").map(function(e){return e.charCodeAt(0)}))},Xf=function(r){return Jf(Qf(r))},Hy=is?function(r){return Ae.Buffer.from(r,"base64").toString("utf8")}:jf?function(r){return jf.decode(Jf(r))}:function(r){return qy(Yf(r))},Qf=function(r){return Vf(r.replace(/[-_]/g,function(e){return e=="-"?"+":"/"}))},td=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},rd=function(){var r=function(e,t){return Object.defineProperty(String.prototype,e,td(t))};r("fromBase64",function(){return ed(this)}),r("toBase64",function(e){return ra(this,e)}),r("toBase64URI",function(){return ra(this,!0)}),r("toBase64URL",function(){return ra(this,!0)}),r("toUint8Array",function(){return Xf(this)})},nd=function(){var r=function(e,t){return Object.defineProperty(Uint8Array.prototype,e,td(t))};r("toBase64",function(e){return hl(this,e)}),r("toBase64URI",function(){return hl(this,!0)}),r("toBase64URL",function(){return hl(this,!0)})},Wy=function(){rd(),nd()},yu={version:Oy,VERSION:Ry,atob:Yf=Uy?function(r){return atob(Vf(r))}:is?function(r){return Ae.Buffer.from(r,"base64").toString("binary")}:Gf,atobPolyfill:Gf,btoa:Hf=Ny?function(r){return btoa(r)}:is?function(r){return Ae.Buffer.from(r,"binary").toString("base64")}:qf,btoaPolyfill:qf,fromBase64:ed=function(r){return Hy(Qf(r))},toBase64:ra=function(r,e){return e===void 0&&(e=!1),e?Kf(Wf(r)):Wf(r)},encode:ra,encodeURI:Zf,encodeURL:Zf,utob:$y=function(r){return r.replace(Fy,jy)},btou:qy=function(r){return r.replace(Ky,Vy)},decode:ed,isValid:function(r){if(typeof r!="string")return!1;var e=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:hl=function(r,e){return e===void 0&&(e=!1),e?Kf(ll(r)):ll(r)},toUint8Array:Xf,extendString:rd,extendUint8Array:nd,extendBuiltins:Wy,Base64:{}},Object.keys(yu).forEach(function(r){return yu.Base64[r]=yu[r]}),yu);const Qt={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},rk=VA,nk=qA,z5=tk,j5=D5.exports.Base64,ik=new z5(j5.toUint8Array(rk)),ok=new z5(j5.toUint8Array(nk));function Tr(r,e){return(r&e)!=0}const fl=0,od=1,sd=2;function sk(r,e){const t=r.length;let n=0,i=fl;for(let o=e;o+165535?2:1,t.push(i)}for(let i=0;ick.has(r),$5=/a-z/,K5=/абвгдеёжзийклмнопрстуфхцчшщъыьэюя/,V5=/\u4e00-\u9fa5/,q5=/ぁ-んァ-ン/,es=/0-9/,ts=/\_\-/,H5=/\u1100-\u115E\u1161-\u11FF\u302E\u302F\u3131-\u3163\u3165-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD158\uD160-\uD172\uD17B-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA1-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/,W5=/\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061D-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F/,hk=new RegExp("^["+($5.source+K5.source+V5.source+q5.source+H5.source+W5.source+es.source+ts.source)+"]+$"),xo=(r,e)=>r?!!e.test(r):!0,x1=r=>xo(r,hk),fk=r=>{const e=new RegExp("^["+$5.source+es.source+ts.source+"]+$");return xo(r,e)},dk=r=>{const e=new RegExp("^["+V5.source+es.source+ts.source+"]+$");return xo(r,e)},pk=r=>{const e=new RegExp("^["+q5.source+es.source+ts.source+"]+$");return xo(r,e)},gk=r=>{const e=new RegExp("^["+K5.source+es.source+ts.source+"]+$");return xo(r,e)},yk=r=>{const e=new RegExp("^["+es.source+"]+$");return xo(r,e)},mk=r=>{const e=new RegExp("^["+ts.source+"]+$");return xo(r,e)},wk=r=>{const e=new RegExp("^["+H5.source+es.source+ts.source+"]+$");return xo(r,e)},bk=r=>{const e=new RegExp("^["+W5.source+es.source+ts.source+"]+$");return xo(r,e)},vk=["🥷","🦣","🦬"],Zy=r=>ak.has(r),Z5=r=>{if(!r)return!1;if(Zy(r))return!0;const e=F5(r);for(let t of e){if(vk.includes(t)||t.length===0||lk(t)||uk.has(t))return!1;if(!x1(t)&&!Zy(t))return!1}return!0};var Ci;(function(r){r[r.English=0]="English",r[r.Cyrillic=1]="Cyrillic",r[r.Chinese=2]="Chinese",r[r.Japanese=3]="Japanese",r[r.Emoji=4]="Emoji",r[r.Unauthorized=5]="Unauthorized",r[r.Korean=6]="Korean",r[r.Arabic=7]="Arabic"})(Ci||(Ci={}));const G5=r=>(r.length>1&&Ci.Unauthorized,fk(r)?Ci.English:dk(r)?Ci.Chinese:gk(r)?Ci.Cyrillic:pk(r)?Ci.Japanese:wk(r)?Ci.Korean:bk(r)?Ci.Arabic:Ci.Unauthorized),_k=(r,e)=>{const t=F5(r);for(let n of t){const i=x1(n),o=Z5(n);if((i||!o)&&!mk(n)&&!yk(n)&&e!==G5(n))return!1}return!0},Ek=["","."],xk=({value:r,prev:e,onError:t})=>{if(Ek.includes(r))return"";r.endsWith(".sol")&&(r=r.split(".sol")[0]);const n=r.toLowerCase().trim(),i=n.split(".");if(i.length>2)return t==null||t(),e;for(const s of i){const a=x1(s),u=Z5(s);if(!a&&!u||!_k(s,G5(r[0]||"")))return t==null||t(),e}return n},Y5=(r,e,t=5)=>r?r.length<=e?r:r.slice(0,e-t)+"..."+r.slice(-t):"",Ak=r=>[...new Set(r)],kk=["-","_"],Sk=()=>{const r=Math.floor(2*Math.random());return kk[r]},J5=(r,e=4)=>{const t=[];for(let n=0;nee.jsxs("div",{className:"flex flex-row items-center gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary min-h-[72px]",children:[ee.jsxs("div",{className:"flex flex-col mr-auto",children:[ee.jsx("span",{className:"text-base text-content-secondary font-primary",children:Y5(`${r}.sol`,25,3)}),e&&ee.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium",children:[ee.jsx("img",{className:"w-4 h-4",src:IA("USDC"),alt:"$"}),t]})]}),n]}),Gy=({domain:r,available:e=!1,price:t})=>{const{cart:n,addToCart:i,removeFromCart:o}=je.useContext(zc);t=t??P5(r);const s=!!n[r],[a,u]=je.useState(s),l=d=>{u(!1),o(d)};return je.useEffect(()=>{let d;return s&&!a&&(d=setTimeout(()=>{u(!0)},1500)),()=>clearTimeout(d)},[s,a]),ee.jsxs(X5,{domain:r,available:e,price:t,children:[!e&&ee.jsx("div",{className:"px-3 rounded-lg bg-accent bg-opacity-10",children:ee.jsx("span",{className:"text-xs font-semibold leading-6 tracking-widest text-accent",children:"Registered"})}),e&&ee.jsx("div",{className:Lr("flex items-center flex-row justify-between min-w-[93px]",e?"gap-2":"gap-1"),children:ee.jsx("button",{type:"button",className:Lr("flex items-center gap-2 px-3 py-1 text-sm text-base-button-content rounded-lg font-primary bg-theme-primary",s&&a&&"bg-transparent text-theme-primary dark:text-theme-secondary"),tabIndex:0,onClick:()=>s?l(r):i({domain:r,storage:1e3,price:Number(t)}),children:s?ee.jsx(ee.Fragment,{children:a?ee.jsxs(ee.Fragment,{children:["Remove",ee.jsx(S5,{width:24,height:24})]}):ee.jsxs(ee.Fragment,{children:["Added",ee.jsx(GE,{width:24,height:24})]})}):ee.jsxs(ee.Fragment,{children:["Add to cart",ee.jsx(ZE,{width:20,height:20})]})})})]})},Yy=()=>ee.jsxs("div",{className:"flex flex-row items-center justify-between gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary h-[72px] animate-pulse",children:[ee.jsx("div",{className:"w-[80px] h-4 rounded-full bg-background-skeleton"}),ee.jsx("div",{className:"h-4 rounded-full w-[120px] bg-background-skeleton"})]}),O0=({className:r,children:e,size:t="full",disabled:n,...i})=>ee.jsx("button",{type:"button",disabled:n,...i,tabIndex:0,className:Lr("flex items-center gap-2 px-3 justify-center text-white font-primary bg-theme-primary",t==="full"&&"py-2.5 rounded-xl tracking-wide",t==="small"&&"text-sm py-1 rounded-lg",n&&"bg-theme-secondary",r),children:e}),Jy=()=>ee.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 69 20",className:"h-full",children:[ee.jsx("path",{d:"m8.843.27-.124.001.005 4.563h.124L8.843.27ZM16.8 14.917l-3.71-2.271.062-.125 3.71 2.27-.063.126ZM.788 14.917l-.061-.125 3.709-2.271.062.125-3.71 2.27Z"}),ee.jsx("path",{d:"M8.784 10.104c-.021 0-.042 0-.042-.02L4.415 7.478a.159.159 0 0 1-.041-.083c0-.042.02-.063.041-.084l4.327-2.604c.021-.02.062-.02.103 0l4.328 2.625c.02.021.04.063.04.084 0 .041-.02.062-.04.083l-4.328 2.604h-.061Zm-4.142-2.73 4.121 2.5 4.121-2.478-4.121-2.5-4.121 2.479Z"}),ee.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021l-4.327-2.584a.159.159 0 0 1-.041-.083V7.396c0-.042.02-.063.041-.083.02-.021.062-.021.103 0l4.327 2.604c.021.02.042.062.042.083v5.188c0 .041-.021.062-.042.083-.04.02-.061.02-.061.02Zm-4.225-2.75 4.122 2.479v-4.959l-4.122-2.5v4.98Z"}),ee.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021a.159.159 0 0 1-.04-.084V10c0-.042.02-.063.04-.083l4.328-2.604c.02-.021.062-.021.103 0 .02.02.04.062.04.083v5.229c0 .042-.02.063-.04.083l-4.328 2.584h-.061Zm.082-5.23v4.959l4.121-2.459v-5l-4.12 2.5Z"}),ee.jsx("path",{d:"M8.784 20 .5 15V5l8.284-5 8.283 5v10l-8.283 5Zm-7.83-5.27 7.809 4.728 7.81-4.729V5.271L8.783.563.954 5.27v9.458Z"}),ee.jsx("path",{d:"M8.763 10.292.623 5.354C.522 5.292.48 5.146.542 5.021c.062-.125.206-.146.31-.084L8.762 9.73l7.954-4.792c.103-.062.247-.02.31.084.06.125.02.27-.083.333l-8.181 4.938Z"}),ee.jsx("path",{d:"M8.784 19.958c-.124 0-.227-.104-.227-.25V10c0-.125.103-.25.227-.25.123 0 .226.104.226.25v9.708c0 .146-.103.25-.226.25ZM30.4 12.125c0 1.5-1.154 2.438-3.01 2.438h-3.585V5.979h3.38c1.834 0 2.988.854 2.988 2.25a1.97 1.97 0 0 1-1.32 1.875c.949.271 1.546 1.063 1.546 2.021Zm-3.215-2.562c.886 0 1.422-.438 1.422-1.167 0-.688-.536-1.125-1.422-1.125H25.35v2.292h1.834Zm.165 3.708c.886 0 1.442-.458 1.442-1.208 0-.73-.577-1.209-1.525-1.209h-1.916v2.417h1.999ZM31.327 11.167c0-2.209 1.277-3.542 3.38-3.542 2.1 0 3.378 1.333 3.378 3.542 0 2.208-1.277 3.541-3.379 3.541-2.102 0-3.38-1.333-3.38-3.541Zm3.38 2.333c1.194 0 1.915-.896 1.915-2.333 0-1.459-.72-2.334-1.916-2.334-1.195 0-1.937.896-1.937 2.334 0 1.458.742 2.333 1.937 2.333ZM42.825 8.875c-.804 0-1.463.5-1.937 1.604v4.084h-1.463V7.77h1.401l.041 1c.557-.77 1.36-1.167 2.205-1.167 1.525 0 2.473 1.042 2.473 2.625v4.313h-1.443v-4.209c.021-.895-.494-1.458-1.277-1.458ZM49.09 14.563h-1.443V8.957H46.43V7.771h1.216v-.73c0-1.374.783-2.229 2.06-2.229h1.628V6h-1.133c-.804 0-1.113.25-1.113 1v.75h4.08v6.792h-1.442V8.958h-2.638v5.604ZM59.763 8.604V5.5h1.443v9.063h-1.381l-.041-.855c-.454.625-1.237 1-2.123 1-1.772 0-3.008-1.5-3.008-3.541 0-2.042 1.236-3.542 3.008-3.542.886 0 1.628.375 2.102.98ZM57.991 13.5c.824 0 1.463-.52 1.772-1.333v-2c-.288-.813-.948-1.334-1.772-1.334-1.133 0-1.916.98-1.916 2.334.02 1.354.783 2.333 1.916 2.333ZM67.078 13.646c-.453.708-1.236 1.062-2.184 1.062-1.298 0-2.164-.791-2.164-2 0-1.395 1.092-2.208 2.926-2.208h1.402v-.417c0-.854-.577-1.395-1.525-1.395-.907 0-1.505.479-1.566 1.25h-1.422c.103-1.438 1.277-2.334 3.05-2.334 1.792 0 2.905.938 2.905 2.542v4.396h-1.38l-.042-.896Zm-1.854-.104c.803 0 1.421-.438 1.834-1.188v-.791l-1.443.02c-.906 0-1.442.355-1.442 1.063 0 .52.35.896 1.05.896Z"})]});var vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ae.global<"u"?Ae.global:typeof self<"u"?self:{};function _i(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function $c(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}for(var Ze={},R0={byteLength:function(r){var e=Qy(r),t=e[0],n=e[1];return 3*(t+n)/4-n}},Q5=R0.toByteArray=function(r){var e,t,n=Qy(r),i=n[0],o=n[1],s=new Ik(function(l,d,_){return 3*(d+_)/4-_}(0,i,o)),a=0,u=o>0?i-4:i;for(t=0;t>16&255,s[a++]=e>>8&255,s[a++]=255&e;return o===2&&(e=Yn[r.charCodeAt(t)]<<2|Yn[r.charCodeAt(t+1)]>>4,s[a++]=255&e),o===1&&(e=Yn[r.charCodeAt(t)]<<10|Yn[r.charCodeAt(t+1)]<<4|Yn[r.charCodeAt(t+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},U0=R0.fromByteArray=function(r){for(var e,t=r.length,n=t%3,i=[],o=16383,s=0,a=t-n;sa?a:s+o));return n===1?(e=r[t-1],i.push(Ni[e>>2]+Ni[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Ni[e>>10]+Ni[e>>4&63]+Ni[e<<2&63]+"=")),i.join("")},Ni=[],Yn=[],Ik=typeof Uint8Array<"u"?Uint8Array:Array,Xy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",na=0;na<64;++na)Ni[na]=Xy[na],Yn[Xy.charCodeAt(na)]=na;function Qy(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");return t===-1&&(t=e),[t,t===e?0:4-t%4]}function Bk(r,e,t){for(var n,i,o=[],s=e;s>18&63]+Ni[i>>12&63]+Ni[i>>6&63]+Ni[63&i]);return o.join("")}Yn["-".charCodeAt(0)]=62,Yn["_".charCodeAt(0)]=63;var ad={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function sh(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function A1(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function Fa(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function e6(r,e){A1(r);const t=e.outputLen;if(r.length>1,d=-7,_=t?i-1:0,E=t?-1:1,m=r[e+_];for(_+=E,o=m&(1<<-d)-1,m>>=-d,d+=a;d>0;o=256*o+r[e+_],_+=E,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=n;d>0;s=256*s+r[e+_],_+=E,d-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:1/0*(m?-1:1);s+=Math.pow(2,n),o-=l}return(m?-1:1)*s*Math.pow(2,o-n)},ad.write=function(r,e,t,n,i,o){var s,a,u,l=8*o-i-1,d=(1<>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,w=n?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+_>=1?E/u:E*Math.pow(2,1-_))*u>=2&&(s++,u/=2),s+_>=d?(a=0,s=d):s+_>=1?(a=(e*u-1)*Math.pow(2,i),s+=_):(a=e*Math.pow(2,_-1)*Math.pow(2,i),s=0));i>=8;r[t+m]=255&a,m+=w,a/=256,i-=8);for(s=s<0;r[t+m]=255&s,m+=w,s/=256,l-=8);r[t+m-w]|=128*v},function(r){const e=R0,t=ad,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=function(f){return+f!=f&&(f=0),s.alloc(+f)},r.INSPECT_MAX_BYTES=50;const i=2147483647;function o(f){if(f>i)throw new RangeError('The value "'+f+'" is invalid for option "size"');const b=new Uint8Array(f);return Object.setPrototypeOf(b,s.prototype),b}function s(f,b,k){if(typeof f=="number"){if(typeof b=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return l(f)}return a(f,b,k)}function a(f,b,k){if(typeof f=="string")return function($,Y){if(typeof Y=="string"&&Y!==""||(Y="utf8"),!s.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);const de=0|m($,Y);let Ke=o(de);const Oe=Ke.write($,Y);return Oe!==de&&(Ke=Ke.slice(0,Oe)),Ke}(f,b);if(ArrayBuffer.isView(f))return function($){if(me($,Uint8Array)){const Y=new Uint8Array($);return _(Y.buffer,Y.byteOffset,Y.byteLength)}return d($)}(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(me(f,ArrayBuffer)||f&&me(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(me(f,SharedArrayBuffer)||f&&me(f.buffer,SharedArrayBuffer)))return _(f,b,k);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const T=f.valueOf&&f.valueOf();if(T!=null&&T!==f)return s.from(T,b,k);const U=function($){if(s.isBuffer($)){const Y=0|E($.length),de=o(Y);return de.length===0||$.copy(de,0,0,Y),de}if($.length!==void 0)return typeof $.length!="number"||se($.length)?o(0):d($);if($.type==="Buffer"&&Array.isArray($.data))return d($.data)}(f);if(U)return U;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return s.from(f[Symbol.toPrimitive]("string"),b,k);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}function u(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function l(f){return u(f),o(f<0?0:0|E(f))}function d(f){const b=f.length<0?0:0|E(f.length),k=o(b);for(let T=0;T=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|f}function m(f,b){if(s.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||me(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const k=f.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&k===0)return 0;let U=!1;for(;;)switch(b){case"ascii":case"latin1":case"binary":return k;case"utf8":case"utf-8":return we(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*k;case"hex":return k>>>1;case"base64":return $e(f).length;default:if(U)return T?-1:we(f).length;b=(""+b).toLowerCase(),U=!0}}function w(f,b,k){let T=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((k===void 0||k>this.length)&&(k=this.length),k<=0)||(k>>>=0)<=(b>>>=0))return"";for(f||(f="utf8");;)switch(f){case"hex":return x(this,b,k);case"utf8":case"utf-8":return H(this,b,k);case"ascii":return c(this,b,k);case"latin1":case"binary":return p(this,b,k);case"base64":return j(this,b,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,b,k);default:if(T)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),T=!0}}function v(f,b,k){const T=f[b];f[b]=f[k],f[k]=T}function A(f,b,k,T,U){if(f.length===0)return-1;if(typeof k=="string"?(T=k,k=0):k>2147483647?k=2147483647:k<-2147483648&&(k=-2147483648),se(k=+k)&&(k=U?0:f.length-1),k<0&&(k=f.length+k),k>=f.length){if(U)return-1;k=f.length-1}else if(k<0){if(!U)return-1;k=0}if(typeof b=="string"&&(b=s.from(b,T)),s.isBuffer(b))return b.length===0?-1:I(f,b,k,T,U);if(typeof b=="number")return b&=255,typeof Uint8Array.prototype.indexOf=="function"?U?Uint8Array.prototype.indexOf.call(f,b,k):Uint8Array.prototype.lastIndexOf.call(f,b,k):I(f,[b],k,T,U);throw new TypeError("val must be string, number or Buffer")}function I(f,b,k,T,U){let $,Y=1,de=f.length,Ke=b.length;if(T!==void 0&&((T=String(T).toLowerCase())==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(f.length<2||b.length<2)return-1;Y=2,de/=2,Ke/=2,k/=2}function Oe(xe,nt){return Y===1?xe[nt]:xe.readUInt16BE(nt*Y)}if(U){let xe=-1;for($=k;$de&&(k=de-Ke),$=k;$>=0;$--){let xe=!0;for(let nt=0;ntU&&(T=U):T=U;const $=b.length;let Y;for(T>$/2&&(T=$/2),Y=0;Y>8,Ke=Y%256,Oe.push(Ke),Oe.push(de);return Oe}(b,f.length-k),f,k,T)}function j(f,b,k){return b===0&&k===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(b,k))}function H(f,b,k){k=Math.min(f.length,k);const T=[];let U=b;for(;U239?4:$>223?3:$>191?2:1;if(U+de<=k){let Ke,Oe,xe,nt;switch(de){case 1:$<128&&(Y=$);break;case 2:Ke=f[U+1],(192&Ke)==128&&(nt=(31&$)<<6|63&Ke,nt>127&&(Y=nt));break;case 3:Ke=f[U+1],Oe=f[U+2],(192&Ke)==128&&(192&Oe)==128&&(nt=(15&$)<<12|(63&Ke)<<6|63&Oe,nt>2047&&(nt<55296||nt>57343)&&(Y=nt));break;case 4:Ke=f[U+1],Oe=f[U+2],xe=f[U+3],(192&Ke)==128&&(192&Oe)==128&&(192&xe)==128&&(nt=(15&$)<<18|(63&Ke)<<12|(63&Oe)<<6|63&xe,nt>65535&&nt<1114112&&(Y=nt))}}Y===null?(Y=65533,de=1):Y>65535&&(Y-=65536,T.push(Y>>>10&1023|55296),Y=56320|1023&Y),T.push(Y),U+=de}return function($){const Y=$.length;if(Y<=N)return String.fromCharCode.apply(String,$);let de="",Ke=0;for(;Ke"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(f,b,k){return a(f,b,k)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(f,b,k){return function(T,U,$){return u(T),T<=0?o(T):U!==void 0?typeof $=="string"?o(T).fill(U,$):o(T).fill(U):o(T)}(f,b,k)},s.allocUnsafe=function(f){return l(f)},s.allocUnsafeSlow=function(f){return l(f)},s.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==s.prototype},s.compare=function(f,b){if(me(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),me(b,Uint8Array)&&(b=s.from(b,b.offset,b.byteLength)),!s.isBuffer(f)||!s.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===b)return 0;let k=f.length,T=b.length;for(let U=0,$=Math.min(k,T);U<$;++U)if(f[U]!==b[U]){k=f[U],T=b[U];break}return kT.length?(s.isBuffer($)||($=s.from($)),$.copy(T,U)):Uint8Array.prototype.set.call(T,$,U);else{if(!s.isBuffer($))throw new TypeError('"list" argument must be an Array of Buffers');$.copy(T,U)}U+=$.length}return T},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const f=this.length;if(f%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;bb&&(f+=" ... "),""},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(f,b,k,T,U){if(me(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(b===void 0&&(b=0),k===void 0&&(k=f?f.length:0),T===void 0&&(T=0),U===void 0&&(U=this.length),b<0||k>f.length||T<0||U>this.length)throw new RangeError("out of range index");if(T>=U&&b>=k)return 0;if(T>=U)return-1;if(b>=k)return 1;if(this===f)return 0;let $=(U>>>=0)-(T>>>=0),Y=(k>>>=0)-(b>>>=0);const de=Math.min($,Y),Ke=this.slice(T,U),Oe=f.slice(b,k);for(let xe=0;xe>>=0,isFinite(k)?(k>>>=0,T===void 0&&(T="utf8")):(T=k,k=void 0)}const U=this.length-b;if((k===void 0||k>U)&&(k=U),f.length>0&&(k<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let $=!1;for(;;)switch(T){case"hex":return B(this,f,b,k);case"utf8":case"utf-8":return S(this,f,b,k);case"ascii":case"latin1":case"binary":return P(this,f,b,k);case"base64":return C(this,f,b,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,f,b,k);default:if($)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),$=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function c(f,b,k){let T="";k=Math.min(f.length,k);for(let U=b;UT)&&(k=T);let U="";for(let $=b;$k)throw new RangeError("Trying to access beyond buffer length")}function y(f,b,k,T,U,$){if(!s.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>U||b<$)throw new RangeError('"value" argument is out of bounds');if(k+T>f.length)throw new RangeError("Index out of range")}function L(f,b,k,T,U){X(b,T,U,f,k,7);let $=Number(b&BigInt(4294967295));f[k++]=$,$>>=8,f[k++]=$,$>>=8,f[k++]=$,$>>=8,f[k++]=$;let Y=Number(b>>BigInt(32)&BigInt(4294967295));return f[k++]=Y,Y>>=8,f[k++]=Y,Y>>=8,f[k++]=Y,Y>>=8,f[k++]=Y,k}function F(f,b,k,T,U){X(b,T,U,f,k,7);let $=Number(b&BigInt(4294967295));f[k+7]=$,$>>=8,f[k+6]=$,$>>=8,f[k+5]=$,$>>=8,f[k+4]=$;let Y=Number(b>>BigInt(32)&BigInt(4294967295));return f[k+3]=Y,Y>>=8,f[k+2]=Y,Y>>=8,f[k+1]=Y,Y>>=8,f[k]=Y,k+8}function K(f,b,k,T,U,$){if(k+T>f.length)throw new RangeError("Index out of range");if(k<0)throw new RangeError("Index out of range")}function V(f,b,k,T,U){return b=+b,k>>>=0,U||K(f,0,k,4),t.write(f,b,k,T,23,4),k+4}function W(f,b,k,T,U){return b=+b,k>>>=0,U||K(f,0,k,8),t.write(f,b,k,T,52,8),k+8}s.prototype.slice=function(f,b){const k=this.length;(f=~~f)<0?(f+=k)<0&&(f=0):f>k&&(f=k),(b=b===void 0?k:~~b)<0?(b+=k)<0&&(b=0):b>k&&(b=k),b>>=0,b>>>=0,k||h(f,b,this.length);let T=this[f],U=1,$=0;for(;++$>>=0,b>>>=0,k||h(f,b,this.length);let T=this[f+--b],U=1;for(;b>0&&(U*=256);)T+=this[f+--b]*U;return T},s.prototype.readUint8=s.prototype.readUInt8=function(f,b){return f>>>=0,b||h(f,1,this.length),this[f]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(f,b){return f>>>=0,b||h(f,2,this.length),this[f]|this[f+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(f,b){return f>>>=0,b||h(f,2,this.length),this[f]<<8|this[f+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(f,b){return f>>>=0,b||h(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+16777216*this[f+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(f,b){return f>>>=0,b||h(f,4,this.length),16777216*this[f]+(this[f+1]<<16|this[f+2]<<8|this[f+3])},s.prototype.readBigUInt64LE=oe(function(f){te(f>>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=b+256*this[++f]+65536*this[++f]+this[++f]*2**24,U=this[++f]+256*this[++f]+65536*this[++f]+k*2**24;return BigInt(T)+(BigInt(U)<>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=b*2**24+65536*this[++f]+256*this[++f]+this[++f],U=this[++f]*2**24+65536*this[++f]+256*this[++f]+k;return(BigInt(T)<>>=0,b>>>=0,k||h(f,b,this.length);let T=this[f],U=1,$=0;for(;++$=U&&(T-=Math.pow(2,8*b)),T},s.prototype.readIntBE=function(f,b,k){f>>>=0,b>>>=0,k||h(f,b,this.length);let T=b,U=1,$=this[f+--T];for(;T>0&&(U*=256);)$+=this[f+--T]*U;return U*=128,$>=U&&($-=Math.pow(2,8*b)),$},s.prototype.readInt8=function(f,b){return f>>>=0,b||h(f,1,this.length),128&this[f]?-1*(255-this[f]+1):this[f]},s.prototype.readInt16LE=function(f,b){f>>>=0,b||h(f,2,this.length);const k=this[f]|this[f+1]<<8;return 32768&k?4294901760|k:k},s.prototype.readInt16BE=function(f,b){f>>>=0,b||h(f,2,this.length);const k=this[f+1]|this[f]<<8;return 32768&k?4294901760|k:k},s.prototype.readInt32LE=function(f,b){return f>>>=0,b||h(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},s.prototype.readInt32BE=function(f,b){return f>>>=0,b||h(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},s.prototype.readBigInt64LE=oe(function(f){te(f>>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=this[f+4]+256*this[f+5]+65536*this[f+6]+(k<<24);return(BigInt(T)<>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=(b<<24)+65536*this[++f]+256*this[++f]+this[++f];return(BigInt(T)<>>=0,b||h(f,4,this.length),t.read(this,f,!0,23,4)},s.prototype.readFloatBE=function(f,b){return f>>>=0,b||h(f,4,this.length),t.read(this,f,!1,23,4)},s.prototype.readDoubleLE=function(f,b){return f>>>=0,b||h(f,8,this.length),t.read(this,f,!0,52,8)},s.prototype.readDoubleBE=function(f,b){return f>>>=0,b||h(f,8,this.length),t.read(this,f,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(f,b,k,T){f=+f,b>>>=0,k>>>=0,!T&&y(this,f,b,k,Math.pow(2,8*k)-1,0);let U=1,$=0;for(this[b]=255&f;++$>>=0,k>>>=0,!T&&y(this,f,b,k,Math.pow(2,8*k)-1,0);let U=k-1,$=1;for(this[b+U]=255&f;--U>=0&&($*=256);)this[b+U]=f/$&255;return b+k},s.prototype.writeUint8=s.prototype.writeUInt8=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,1,255,0),this[b]=255&f,b+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,65535,0),this[b]=255&f,this[b+1]=f>>>8,b+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,65535,0),this[b]=f>>>8,this[b+1]=255&f,b+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,4294967295,0),this[b+3]=f>>>24,this[b+2]=f>>>16,this[b+1]=f>>>8,this[b]=255&f,b+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,4294967295,0),this[b]=f>>>24,this[b+1]=f>>>16,this[b+2]=f>>>8,this[b+3]=255&f,b+4},s.prototype.writeBigUInt64LE=oe(function(f,b=0){return L(this,f,b,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=oe(function(f,b=0){return F(this,f,b,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(f,b,k,T){if(f=+f,b>>>=0,!T){const de=Math.pow(2,8*k-1);y(this,f,b,k,de-1,-de)}let U=0,$=1,Y=0;for(this[b]=255&f;++U>0)-Y&255;return b+k},s.prototype.writeIntBE=function(f,b,k,T){if(f=+f,b>>>=0,!T){const de=Math.pow(2,8*k-1);y(this,f,b,k,de-1,-de)}let U=k-1,$=1,Y=0;for(this[b+U]=255&f;--U>=0&&($*=256);)f<0&&Y===0&&this[b+U+1]!==0&&(Y=1),this[b+U]=(f/$>>0)-Y&255;return b+k},s.prototype.writeInt8=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,1,127,-128),f<0&&(f=255+f+1),this[b]=255&f,b+1},s.prototype.writeInt16LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,32767,-32768),this[b]=255&f,this[b+1]=f>>>8,b+2},s.prototype.writeInt16BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,32767,-32768),this[b]=f>>>8,this[b+1]=255&f,b+2},s.prototype.writeInt32LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,2147483647,-2147483648),this[b]=255&f,this[b+1]=f>>>8,this[b+2]=f>>>16,this[b+3]=f>>>24,b+4},s.prototype.writeInt32BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[b]=f>>>24,this[b+1]=f>>>16,this[b+2]=f>>>8,this[b+3]=255&f,b+4},s.prototype.writeBigInt64LE=oe(function(f,b=0){return L(this,f,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=oe(function(f,b=0){return F(this,f,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeFloatLE=function(f,b,k){return V(this,f,b,!0,k)},s.prototype.writeFloatBE=function(f,b,k){return V(this,f,b,!1,k)},s.prototype.writeDoubleLE=function(f,b,k){return W(this,f,b,!0,k)},s.prototype.writeDoubleBE=function(f,b,k){return W(this,f,b,!1,k)},s.prototype.copy=function(f,b,k,T){if(!s.isBuffer(f))throw new TypeError("argument should be a Buffer");if(k||(k=0),T||T===0||(T=this.length),b>=f.length&&(b=f.length),b||(b=0),T>0&&T=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),f.length-b>>=0,k=k===void 0?this.length:k>>>0,f||(f=0),typeof f=="number")for(U=b;U=T+4;k-=3)b=`_${f.slice(k-3,k)}${b}`;return`${f.slice(0,k)}${b}`}function X(f,b,k,T,U,$){if(f>k||f3?b===0||b===BigInt(0)?`>= 0${Y} and < 2${Y} ** ${8*($+1)}${Y}`:`>= -(2${Y} ** ${8*($+1)-1}${Y}) and < 2 ** ${8*($+1)-1}${Y}`:`>= ${b}${Y} and <= ${k}${Y}`,new Z.ERR_OUT_OF_RANGE("value",de,f)}(function(Y,de,Ke){te(de,"offset"),Y[de]!==void 0&&Y[de+Ke]!==void 0||ge(de,Y.length-(Ke+1))})(T,U,$)}function te(f,b){if(typeof f!="number")throw new Z.ERR_INVALID_ARG_TYPE(b,"number",f)}function ge(f,b,k){throw Math.floor(f)!==f?(te(f,k),new Z.ERR_OUT_OF_RANGE(k||"offset","an integer",f)):b<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(k||"offset",`>= ${k?1:0} and <= ${b}`,f)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(f,b){return`The "${f}" argument must be of type number. Received type ${typeof b}`},TypeError),G("ERR_OUT_OF_RANGE",function(f,b,k){let T=`The value of "${f}" is out of range.`,U=k;return Number.isInteger(k)&&Math.abs(k)>2**32?U=ne(String(k)):typeof k=="bigint"&&(U=String(k),(k>BigInt(2)**BigInt(32)||k<-(BigInt(2)**BigInt(32)))&&(U=ne(U)),U+="n"),T+=` It must be ${b}. Received ${U}`,T},RangeError);const ce=/[^+/0-9A-Za-z-_]/g;function we(f,b){let k;b=b||1/0;const T=f.length;let U=null;const $=[];for(let Y=0;Y55295&&k<57344){if(!U){if(k>56319){(b-=3)>-1&&$.push(239,191,189);continue}if(Y+1===T){(b-=3)>-1&&$.push(239,191,189);continue}U=k;continue}if(k<56320){(b-=3)>-1&&$.push(239,191,189),U=k;continue}k=65536+(U-55296<<10|k-56320)}else U&&(b-=3)>-1&&$.push(239,191,189);if(U=null,k<128){if((b-=1)<0)break;$.push(k)}else if(k<2048){if((b-=2)<0)break;$.push(k>>6|192,63&k|128)}else if(k<65536){if((b-=3)<0)break;$.push(k>>12|224,k>>6&63|128,63&k|128)}else{if(!(k<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;$.push(k>>18|240,k>>12&63|128,k>>6&63|128,63&k|128)}}return $}function $e(f){return e.toByteArray(function(b){if((b=(b=b.split("=")[0]).trim().replace(ce,"")).length<2)return"";for(;b.length%4!=0;)b+="=";return b}(f))}function be(f,b,k,T){let U;for(U=0;U=b.length||U>=f.length);++U)b[U+k]=f[U];return U}function me(f,b){return f instanceof b||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===b.name}function se(f){return f!=f}const ie=function(){const f="0123456789abcdef",b=new Array(256);for(let k=0;k<16;++k){const T=16*k;for(let U=0;U<16;++U)b[T+U]=f[k]+f[U]}return b}();function oe(f){return typeof BigInt>"u"?Fe:f}function Fe(){throw new Error("BigInt not supported")}}(Ze);const ud=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,t6=r=>r instanceof Uint8Array,cd=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),xi=(r,e)=>r<<32-e|r>>>e;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function Mk(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function sf(r){if(typeof r=="string"&&(r=Mk(r)),!t6(r))throw new Error("expected Uint8Array, got "+typeof r);return r}function Pk(...r){const e=new Uint8Array(r.reduce((n,i)=>n+i.length,0));let t=0;return r.forEach(n=>{if(!t6(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}class k1{clone(){return this._cloneInto()}}function S1(r){const e=n=>r().update(sf(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function r6(r=32){if(ud&&typeof ud.getRandomValues=="function")return ud.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}class n6 extends k1{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,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=cd(this.buffer)}update(e){Fa(this);const{view:t,buffer:n,blockLen:i}=this,o=(e=sf(e)).length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let _=s;_>v&A),B=Number(m&A),S=w?4:0,P=w?0:4;_.setUint32(E+S,I,w),_.setUint32(E+P,B,w)})(n,i-8,BigInt(8*this.length),o),this.process(n,0);const a=cd(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 _=0;_>N0&dl)}:{h:0|Number(r>>N0&dl),l:0|Number(r&dl)}}function o6(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;ir<>>32-t,a6=(r,e,t)=>e<>>32-t,u6=(r,e,t)=>e<>>64-t,c6=(r,e,t)=>r<>>64-t,Lk={fromBig:i6,split:o6,toBig:(r,e)=>BigInt(r>>>0)<>>0),shrSH:(r,e,t)=>r>>>t,shrSL:(r,e,t)=>r<<32-t|e>>>t,rotrSH:(r,e,t)=>r>>>t|e<<32-t,rotrSL:(r,e,t)=>r<<32-t|e>>>t,rotrBH:(r,e,t)=>r<<64-t|e>>>t-32,rotrBL:(r,e,t)=>r>>>t-32|e<<64-t,rotr32H:(r,e)=>e,rotr32L:(r,e)=>r,rotlSH:s6,rotlSL:a6,rotlBH:u6,rotlBL:c6,add:function(r,e,t,n){const i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:0|i}},add3L:(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),add3H:(r,e,t,n)=>e+t+n+(r/2**32|0)|0,add4L:(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),add4H:(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,add5H:(r,e,t,n,i,o)=>e+t+n+i+o+(r/2**32|0)|0,add5L:(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0)};var Tt=Lk;const[Ck,Tk]=(()=>Tt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),So=new Uint32Array(80),Io=new Uint32Array(80);class Ok extends n6{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:d,Fh:_,Fl:E,Gh:m,Gl:w,Hh:v,Hl:A}=this;return[e,t,n,i,o,s,a,u,l,d,_,E,m,w,v,A]}set(e,t,n,i,o,s,a,u,l,d,_,E,m,w,v,A){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|i,this.Ch=0|o,this.Cl=0|s,this.Dh=0|a,this.Dl=0|u,this.Eh=0|l,this.El=0|d,this.Fh=0|_,this.Fl=0|E,this.Gh=0|m,this.Gl=0|w,this.Hh=0|v,this.Hl=0|A}process(e,t){for(let S=0;S<16;S++,t+=4)So[S]=e.getUint32(t),Io[S]=e.getUint32(t+=4);for(let S=16;S<80;S++){const P=0|So[S-15],C=0|Io[S-15],R=Tt.rotrSH(P,C,1)^Tt.rotrSH(P,C,8)^Tt.shrSH(P,C,7),j=Tt.rotrSL(P,C,1)^Tt.rotrSL(P,C,8)^Tt.shrSL(P,C,7),H=0|So[S-2],N=0|Io[S-2],c=Tt.rotrSH(H,N,19)^Tt.rotrBH(H,N,61)^Tt.shrSH(H,N,6),p=Tt.rotrSL(H,N,19)^Tt.rotrBL(H,N,61)^Tt.shrSL(H,N,6),x=Tt.add4L(j,p,Io[S-7],Io[S-16]),g=Tt.add4H(x,R,c,So[S-7],So[S-16]);So[S]=0|g,Io[S]=0|x}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:d,Eh:_,El:E,Fh:m,Fl:w,Gh:v,Gl:A,Hh:I,Hl:B}=this;for(let S=0;S<80;S++){const P=Tt.rotrSH(_,E,14)^Tt.rotrSH(_,E,18)^Tt.rotrBH(_,E,41),C=Tt.rotrSL(_,E,14)^Tt.rotrSL(_,E,18)^Tt.rotrBL(_,E,41),R=_&m^~_&v,j=E&w^~E&A,H=Tt.add5L(B,C,j,Tk[S],Io[S]),N=Tt.add5H(H,I,P,R,Ck[S],So[S]),c=0|H,p=Tt.rotrSH(n,i,28)^Tt.rotrBH(n,i,34)^Tt.rotrBH(n,i,39),x=Tt.rotrSL(n,i,28)^Tt.rotrBL(n,i,34)^Tt.rotrBL(n,i,39),g=n&o^n&a^o&a,h=i&s^i&u^s&u;I=0|v,B=0|A,v=0|m,A=0|w,m=0|_,w=0|E,{h:_,l:E}=Tt.add(0|l,0|d,0|N,0|c),l=0|a,d=0|u,a=0|o,u=0|s,o=0|n,s=0|i;const y=Tt.add3L(c,x,h);n=Tt.add3H(y,N,p,g),i=0|y}({h:n,l:i}=Tt.add(0|this.Ah,0|this.Al,0|n,0|i)),{h:o,l:s}=Tt.add(0|this.Bh,0|this.Bl,0|o,0|s),{h:a,l:u}=Tt.add(0|this.Ch,0|this.Cl,0|a,0|u),{h:l,l:d}=Tt.add(0|this.Dh,0|this.Dl,0|l,0|d),{h:_,l:E}=Tt.add(0|this.Eh,0|this.El,0|_,0|E),{h:m,l:w}=Tt.add(0|this.Fh,0|this.Fl,0|m,0|w),{h:v,l:A}=Tt.add(0|this.Gh,0|this.Gl,0|v,0|A),{h:I,l:B}=Tt.add(0|this.Hh,0|this.Hl,0|I,0|B),this.set(n,i,o,s,a,u,l,d,_,E,m,w,v,A,I,B)}roundClean(){So.fill(0),Io.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Rk=S1(()=>new Ok),em=BigInt(0),ql=BigInt(1),Uk=BigInt(2),af=r=>r instanceof Uint8Array,Nk=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ds(r){if(!af(r))throw new Error("Uint8Array expected");let e="";for(let t=0;tn+i.length,0));let t=0;return r.forEach(n=>{if(!af(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}const B1=r=>(Uk<new Uint8Array(r),rm=r=>Uint8Array.from(r);function l6(r,e,t){if(typeof r!="number"||r<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 t!="function")throw new Error("hmacFn must be a function");let n=ld(r),i=ld(r),o=0;const s=()=>{n.fill(1),i.fill(0),o=0},a=(...d)=>t(i,n,...d),u=(d=ld())=>{i=a(rm([0]),d),n=a(),d.length!==0&&(i=a(rm([1]),d),n=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const _=[];for(;d{let E;for(s(),u(d);!(E=_(l()));)u();return s(),E}}const Dk={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Ka(r,e,t={}){const n=(i,o,s)=>{const a=Dk[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);const u=r[i];if(!(s&&u===void 0||a(u,r)))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${o}`)};for(const[i,o]of Object.entries(e))n(i,o,!1);for(const[i,o]of Object.entries(t))n(i,o,!0);return r}var zk=Object.freeze({__proto__:null,bytesToHex:Ds,numberToHexUnpadded:tm,hexToNumber:I1,hexToBytes:$a,bytesToNumberBE:bs,bytesToNumberLE:Ea,numberToBytesBE:xa,numberToBytesLE:sc,numberToVarBytesBE:function(r){return $a(tm(r))},ensureBytes:zr,concatBytes:zs,equalBytes:function(r,e){if(r.length!==e.length)return!1;for(let t=0;tem;r>>=ql,e+=1);return e},bitGet:function(r,e){return r>>BigInt(e)&ql},bitSet:(r,e,t)=>r|(t?ql:em)<=Wr?t:e+t}function Fk(r,e,t){if(t<=Wr||e 0");if(t===Er)return Wr;let n=Er;for(;e>Wr;)e&Er&&(n=n*r%t),r=r*r%t,e>>=Er;return n}function Ir(r,e,t){let n=r;for(;e-- >Wr;)n*=n,n%=t;return n}function D0(r,e){if(r===Wr||e<=Wr)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=wr(r,e),n=e,i=Wr,o=Er;for(;t!==Wr;){const s=n%t,a=i-o*(n/t);n=t,t=s,i=o,o=a}if(n!==Er)throw new Error("invert: does not exist");return wr(i,e)}function $k(r){if(r%hd===jk){const e=(r+Er)/hd;return function(t,n){const i=t.pow(n,e);if(!t.eql(t.sqr(i),n))throw new Error("Cannot find square root");return i}}if(r%im===nm){const e=(r-nm)/im;return function(t,n){const i=t.mul(n,os),o=t.pow(i,e),s=t.mul(n,o),a=t.mul(t.mul(s,os),o),u=t.mul(s,t.sub(a,t.ONE));if(!t.eql(t.sqr(u),n))throw new Error("Cannot find square root");return u}}return function(e){const t=(e-Er)/os;let n,i,o;for(n=e-Er,i=0;n%os===Wr;n/=os,i++);for(o=os;o 0, got ${r}`);const{nBitLength:i,nByteLength:o}=h6(r,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=$k(r),a=Object.freeze({ORDER:r,BITS:i,BYTES:o,MASK:B1(i),ZERO:Wr,ONE:Er,create:u=>wr(u,r),isValid:u=>{if(typeof u!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof u);return Wr<=u&&uu===Wr,isOdd:u=>(u&Er)===Er,neg:u=>wr(-u,r),eql:(u,l)=>u===l,sqr:u=>wr(u*u,r),add:(u,l)=>wr(u+l,r),sub:(u,l)=>wr(u-l,r),mul:(u,l)=>wr(u*l,r),pow:(u,l)=>function(d,_,E){if(E 0");if(E===Wr)return d.ONE;if(E===Er)return _;let m=d.ONE,w=_;for(;E>Wr;)E&Er&&(m=d.mul(m,w)),w=d.sqr(w),E>>=Er;return m}(a,u,l),div:(u,l)=>wr(u*D0(l,r),r),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>D0(u,r),sqrt:n.sqrt||(u=>s(a,u)),invertBatch:u=>function(l,d){const _=new Array(d.length),E=d.reduce((w,v,A)=>l.is0(v)?w:(_[A]=w,l.mul(w,v)),l.ONE),m=l.inv(E);return d.reduceRight((w,v,A)=>l.is0(v)?w:(_[A]=l.mul(w,_[A]),l.mul(w,v)),m),_}(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>t?sc(u,o):xa(u,o),fromBytes:u=>{if(u.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${u.length}`);return t?Ea(u):bs(u)}});return Object.freeze(a)}function d6(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const e=r.toString(2).length;return Math.ceil(e/8)}function om(r){const e=d6(r);return e+Math.ceil(e/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vk=BigInt(0),fd=BigInt(1);function p6(r,e){const t=(i,o)=>{const s=o.negate();return i?s:o},n=i=>({windows:Math.ceil(e/i)+1,windowSize:2**(i-1)});return{constTimeNegate:t,unsafeLadder(i,o){let s=r.ZERO,a=i;for(;o>Vk;)o&fd&&(s=s.add(a)),a=a.double(),o>>=fd;return s},precomputeWindow(i,o){const{windows:s,windowSize:a}=n(o),u=[];let l=i,d=l;for(let _=0;_>=m,A>u&&(A-=E,s+=fd);const I=v,B=v+Math.abs(A)-1,S=w%2!=0,P=A<0;A===0?d=d.add(t(S,o[I])):l=l.add(t(P,o[B]))}return{p:l,f:d}},wNAFCached(i,o,s,a){const u=i._WINDOW_SIZE||1;let l=o.get(i);return l||(l=this.precomputeWindow(i,u),u!==1&&o.set(i,a(l))),this.wNAF(u,l,s)}}}function M1(r){return Ka(r.Fp,Kk.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Ka(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...h6(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ci=BigInt(0),On=BigInt(1),pl=BigInt(2),qk=BigInt(8),Hk={zip215:!0};function Wk(r){const e=function(h){const y=M1(h);return Ka(h,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...y})}(r),{Fp:t,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,l=pl<{try{return{isValid:!0,value:t.sqrt(h*t.inv(y))}}catch{return{isValid:!1,value:ci}}}),E=e.adjustScalarBytes||(h=>h),m=e.domain||((h,y,L)=>{if(y.length||L)throw new Error("Contexts/pre-hash are not supported");return h}),w=h=>typeof h=="bigint"&&ciw(h)&&w(y)&&hh===ci||v(h,l);function I(h,y){if(v(h,y))return h;throw new Error(`Expected valid scalar < ${y}, got ${typeof h} ${h}`)}function B(h){return h===ci?h:I(h,n)}const S=new Map;function P(h){if(!(h instanceof C))throw new Error("ExtendedPoint expected")}class C{constructor(y,L,F,K){if(this.ex=y,this.ey=L,this.ez=F,this.et=K,!A(y))throw new Error("x required");if(!A(L))throw new Error("y required");if(!A(F))throw new Error("z required");if(!A(K))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(y){if(y instanceof C)throw new Error("extended point not allowed");const{x:L,y:F}=y||{};if(!A(L)||!A(F))throw new Error("invalid affine point");return new C(L,F,On,d(L*F))}static normalizeZ(y){const L=t.invertBatch(y.map(F=>F.ez));return y.map((F,K)=>F.toAffine(L[K])).map(C.fromAffine)}_setWindowSize(y){this._WINDOW_SIZE=y,S.delete(this)}assertValidity(){const{a:y,d:L}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:F,ey:K,ez:V,et:W}=this,Z=d(F*F),G=d(K*K),ne=d(V*V),X=d(ne*ne),te=d(Z*y);if(d(ne*d(te+G))!==d(X+d(L*d(Z*G))))throw new Error("bad point: equation left != right (1)");if(d(F*K)!==d(V*W))throw new Error("bad point: equation left != right (2)")}equals(y){P(y);const{ex:L,ey:F,ez:K}=this,{ex:V,ey:W,ez:Z}=y,G=d(L*Z),ne=d(V*K),X=d(F*Z),te=d(W*K);return G===ne&&X===te}is0(){return this.equals(C.ZERO)}negate(){return new C(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:y}=e,{ex:L,ey:F,ez:K}=this,V=d(L*L),W=d(F*F),Z=d(pl*d(K*K)),G=d(y*V),ne=L+F,X=d(d(ne*ne)-V-W),te=G+W,ge=te-Z,ce=G-W,we=d(X*ge),$e=d(te*ce),be=d(X*ce),me=d(ge*te);return new C(we,$e,me,be)}add(y){P(y);const{a:L,d:F}=e,{ex:K,ey:V,ez:W,et:Z}=this,{ex:G,ey:ne,ez:X,et:te}=y;if(L===BigInt(-1)){const k=d((V-K)*(ne+G)),T=d((V+K)*(ne-G)),U=d(T-k);if(U===ci)return this.double();const $=d(W*pl*te),Y=d(Z*pl*X),de=Y+$,Ke=T+k,Oe=Y-$,xe=d(de*U),nt=d(Ke*Oe),pt=d(de*Oe),gt=d(U*Ke);return new C(xe,nt,gt,pt)}const ge=d(K*G),ce=d(V*ne),we=d(Z*F*te),$e=d(W*X),be=d((K+V)*(G+ne)-ge-ce),me=$e-we,se=$e+we,ie=d(ce-L*ge),oe=d(be*me),Fe=d(se*ie),f=d(be*ie),b=d(me*se);return new C(oe,Fe,b,f)}subtract(y){return this.add(y.negate())}wNAF(y){return H.wNAFCached(this,S,y,C.normalizeZ)}multiply(y){const{p:L,f:F}=this.wNAF(I(y,n));return C.normalizeZ([L,F])[0]}multiplyUnsafe(y){let L=B(y);return L===ci?j:this.equals(j)||L===On?this:this.equals(R)?this.wNAF(L).p:H.unsafeLadder(this,L)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return H.unsafeLadder(this,n).is0()}toAffine(y){const{ex:L,ey:F,ez:K}=this,V=this.is0();y==null&&(y=V?qk:t.inv(K));const W=d(L*y),Z=d(F*y),G=d(K*y);if(V)return{x:ci,y:On};if(G!==On)throw new Error("invZ was invalid");return{x:W,y:Z}}clearCofactor(){const{h:y}=e;return y===On?this:this.multiplyUnsafe(y)}static fromHex(y,L=!1){const{d:F,a:K}=e,V=t.BYTES,W=(y=zr("pointHex",y,V)).slice(),Z=y[V-1];W[V-1]=-129&Z;const G=Ea(W);G===ci||I(G,L?l:t.ORDER);const ne=d(G*G),X=d(ne-On),te=d(F*ne-K);let{isValid:ge,value:ce}=_(X,te);if(!ge)throw new Error("Point.fromHex: invalid y coordinate");const we=(ce&On)===On,$e=(128&Z)!=0;if(!L&&ce===ci&&$e)throw new Error("Point.fromHex: x=0 and x_0=1");return $e!==we&&(ce=d(-ce)),C.fromAffine({x:ce,y:G})}static fromPrivateKey(y){return p(y).point}toRawBytes(){const{x:y,y:L}=this.toAffine(),F=sc(L,t.BYTES);return F[F.length-1]|=y&On?128:0,F}toHex(){return Ds(this.toRawBytes())}}C.BASE=new C(e.Gx,e.Gy,On,d(e.Gx*e.Gy)),C.ZERO=new C(ci,On,On,ci);const{BASE:R,ZERO:j}=C,H=p6(C,8*a);function N(h){return wr(h,n)}function c(h){return N(Ea(h))}function p(h){const y=a;h=zr("private key",h,y);const L=zr("hashed private key",o(h),2*y),F=E(L.slice(0,y)),K=L.slice(y,2*y),V=c(F),W=R.multiply(V),Z=W.toRawBytes();return{head:F,prefix:K,scalar:V,point:W,pointBytes:Z}}function x(h=new Uint8Array,...y){const L=zs(...y);return c(o(m(L,zr("context",h),!!i)))}const g=Hk;return R._setWindowSize(8),{CURVE:e,getPublicKey:function(h){return p(h).pointBytes},sign:function(h,y,L={}){h=zr("message",h),i&&(h=i(h));const{prefix:F,scalar:K,pointBytes:V}=p(y),W=x(L.context,F,h),Z=R.multiply(W).toRawBytes(),G=N(W+x(L.context,Z,V,h)*K);return B(G),zr("result",zs(Z,sc(G,t.BYTES)),2*a)},verify:function(h,y,L,F=g){const{context:K,zip215:V}=F,W=t.BYTES;h=zr("signature",h,2*W),y=zr("message",y),i&&(y=i(y));const Z=Ea(h.slice(W,2*W));let G,ne,X;try{G=C.fromHex(L,V),ne=C.fromHex(h.slice(0,W),V),X=R.multiplyUnsafe(Z)}catch{return!1}if(!V&&G.isSmallOrder())return!1;const te=x(K,ne.toRawBytes(),G.toRawBytes(),y);return ne.add(G.multiplyUnsafe(te)).subtract(X).clearCofactor().equals(C.ZERO)},ExtendedPoint:C,utils:{getExtendedPublicKey:p,randomPrivateKey:()=>s(t.BYTES),precompute:(h=8,y=C.BASE)=>(y._setWindowSize(h),y.multiply(BigInt(3)),y)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z0=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),sm=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Zk=BigInt(1),j0=BigInt(2),Gk=BigInt(5),am=BigInt(10),Yk=BigInt(20),Jk=BigInt(40),um=BigInt(80),no=f6(z0,void 0,!0),Xk={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:no,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Rk,randomBytes:r6,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,e){const t=z0,n=wr(e*e*e,t),i=function(E){const m=z0,w=E*E%m*E%m,v=Ir(w,j0,m)*w%m,A=Ir(v,Zk,m)*E%m,I=Ir(A,Gk,m)*A%m,B=Ir(I,am,m)*I%m,S=Ir(B,Yk,m)*B%m,P=Ir(S,Jk,m)*S%m,C=Ir(P,um,m)*P%m,R=Ir(C,um,m)*P%m,j=Ir(R,am,m)*I%m;return{pow_p_5_8:Ir(j,j0,m)*E%m,b2:w}}(r*wr(n*n*e,t)).pow_p_5_8;let o=wr(r*n*i,t);const s=wr(e*o*o,t),a=o,u=wr(o*sm,t),l=s===r,d=s===wr(-r,t),_=s===wr(-r*sm,t);return l&&(o=a),(d||_)&&(o=u),(wr(o,t)&Er)===Er&&(o=wr(-o,t)),{isValid:l||d,value:o}}},ru=Wk(Xk),Qk=(no.ORDER+BigInt(3))/BigInt(8);no.pow(j0,Qk),no.sqrt(no.neg(no.ONE)),no.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,e){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const t=r.sqrt(e);r.isOdd(t)&&r.neg(t)}(no,no.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var g6={exports:{}},y6=$c(Object.freeze({__proto__:null,default:{}}));(function(r,e){function t(c,p){if(!c)throw new Error(p||"Assertion failed")}function n(c,p){c.super_=p;var x=function(){};x.prototype=p.prototype,c.prototype=new x,c.prototype.constructor=c}function i(c,p,x){if(i.isBN(c))return c;this.negative=0,this.words=null,this.length=0,this.red=null,c!==null&&(p!=="le"&&p!=="be"||(x=p,p=10),this._init(c||0,p||10,x||"be"))}var o;typeof r=="object"?r.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:y6.Buffer}catch{}function s(c,p){var x=c.charCodeAt(p);return x>=48&&x<=57?x-48:x>=65&&x<=70?x-55:x>=97&&x<=102?x-87:void t(!1,"Invalid character in "+c)}function a(c,p,x){var g=s(c,x);return x-1>=p&&(g|=s(c,x-1)<<4),g}function u(c,p,x,g){for(var h=0,y=0,L=Math.min(c.length,x),F=p;F=49?K-49+10:K>=17?K-17+10:K,t(K>=0&&y0?c:p},i.min=function(c,p){return c.cmp(p)<0?c:p},i.prototype._init=function(c,p,x){if(typeof c=="number")return this._initNumber(c,p,x);if(typeof c=="object")return this._initArray(c,p,x);p==="hex"&&(p=16),t(p===(0|p)&&p>=2&&p<=36);var g=0;(c=c.toString().replace(/\s+/g,""))[0]==="-"&&(g++,this.negative=1),g=0;g-=3)y=c[g]|c[g-1]<<8|c[g-2]<<16,this.words[h]|=y<>>26-L&67108863,(L+=24)>=26&&(L-=26,h++);else if(x==="le")for(g=0,h=0;g>>26-L&67108863,(L+=24)>=26&&(L-=26,h++);return this._strip()},i.prototype._parseHex=function(c,p,x){this.length=Math.ceil((c.length-p)/6),this.words=new Array(this.length);for(var g=0;g=p;g-=2)h=a(c,p,g)<=18?(y-=18,L+=1,this.words[L]|=h>>>26):y+=8;else for(g=(c.length-p)%2==0?p+1:p;g=18?(y-=18,L+=1,this.words[L]|=h>>>26):y+=8;this._strip()},i.prototype._parseBase=function(c,p,x){this.words=[0],this.length=1;for(var g=0,h=1;h<=67108863;h*=p)g++;g--,h=h/p|0;for(var y=c.length-x,L=y%g,F=Math.min(y,y-L)+x,K=0,V=x;V1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{i.prototype.inspect=d}else i.prototype.inspect=d;function d(){return(this.red?""}var _=["","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"],E=[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];function w(c,p,x){x.negative=p.negative^c.negative;var g=c.length+p.length|0;x.length=g,g=g-1|0;var h=0|c.words[0],y=0|p.words[0],L=h*y,F=67108863&L,K=L/67108864|0;x.words[0]=F;for(var V=1;V>>26,Z=67108863&K,G=Math.min(V,p.length-1),ne=Math.max(0,V-c.length+1);ne<=G;ne++){var X=V-ne|0;W+=(L=(h=0|c.words[X])*(y=0|p.words[ne])+Z)/67108864|0,Z=67108863&L}x.words[V]=0|Z,K=0|W}return K!==0?x.words[V]=0|K:x.length--,x._strip()}i.prototype.toString=function(c,p){var x;if(p=0|p||1,(c=c||10)===16||c==="hex"){x="";for(var g=0,h=0,y=0;y>>24-g&16777215,(g+=2)>=26&&(g-=26,y--),x=h!==0||y!==this.length-1?_[6-F.length]+F+x:F+x}for(h!==0&&(x=h.toString(16)+x);x.length%p!=0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(c===(0|c)&&c>=2&&c<=36){var K=E[c],V=m[c];x="";var W=this.clone();for(W.negative=0;!W.isZero();){var Z=W.modrn(V).toString(c);x=(W=W.idivn(V)).isZero()?Z+x:_[K-Z.length]+Z+x}for(this.isZero()&&(x="0"+x);x.length%p!=0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}t(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=67108864*this.words[1]:this.length===3&&this.words[2]===1?c+=4503599627370496+67108864*this.words[1]:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(c,p){return this.toArrayLike(o,c,p)}),i.prototype.toArray=function(c,p){return this.toArrayLike(Array,c,p)},i.prototype.toArrayLike=function(c,p,x){this._strip();var g=this.byteLength(),h=x||Math.max(1,g);t(g<=h,"byte array longer than desired length"),t(h>0,"Requested array length <= 0");var y=function(L,F){return L.allocUnsafe?L.allocUnsafe(F):new L(F)}(c,h);return this["_toArrayLike"+(p==="le"?"LE":"BE")](y,g),y},i.prototype._toArrayLikeLE=function(c,p){for(var x=0,g=0,h=0,y=0;h>8&255),x>16&255),y===6?(x>24&255),g=0,y=0):(g=L>>>24,y+=2)}if(x=0&&(c[x--]=L>>8&255),x>=0&&(c[x--]=L>>16&255),y===6?(x>=0&&(c[x--]=L>>24&255),g=0,y=0):(g=L>>>24,y+=2)}if(x>=0)for(c[x--]=g;x>=0;)c[x--]=0},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var p=c,x=0;return p>=4096&&(x+=13,p>>>=13),p>=64&&(x+=7,p>>>=7),p>=8&&(x+=4,p>>>=4),p>=2&&(x+=2,p>>>=2),x+p},i.prototype._zeroBits=function(c){if(c===0)return 26;var p=c,x=0;return!(8191&p)&&(x+=13,p>>>=13),!(127&p)&&(x+=7,p>>>=7),!(15&p)&&(x+=4,p>>>=4),!(3&p)&&(x+=2,p>>>=2),!(1&p)&&x++,x},i.prototype.bitLength=function(){var c=this.words[this.length-1],p=this._countBits(c);return 26*(this.length-1)+p},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,p=0;pc.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var p;p=this.length>c.length?c:this;for(var x=0;xc.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var p,x;this.length>c.length?(p=this,x=c):(p=c,x=this);for(var g=0;gc.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var p=0|Math.ceil(c/26),x=c%26;this._expand(p),x>0&&p--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-x),this._strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,p){t(typeof c=="number"&&c>=0);var x=c/26|0,g=c%26;return this._expand(x+1),this.words[x]=p?this.words[x]|1<c.length?(x=this,g=c):(x=c,g=this);for(var h=0,y=0;y>>26;for(;h!==0&&y>>26;if(this.length=x.length,h!==0)this.words[this.length]=h,this.length++;else if(x!==this)for(;yc.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var p=this.iadd(c);return c.negative=1,p._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var x,g,h=this.cmp(c);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(x=this,g=c):(x=c,g=this);for(var y=0,L=0;L>26,this.words[L]=67108863&p;for(;y!==0&&L>26,this.words[L]=67108863&p;if(y===0&&L>>13,ne=0|L[1],X=8191&ne,te=ne>>>13,ge=0|L[2],ce=8191&ge,we=ge>>>13,$e=0|L[3],be=8191&$e,me=$e>>>13,se=0|L[4],ie=8191&se,oe=se>>>13,Fe=0|L[5],f=8191&Fe,b=Fe>>>13,k=0|L[6],T=8191&k,U=k>>>13,$=0|L[7],Y=8191&$,de=$>>>13,Ke=0|L[8],Oe=8191&Ke,xe=Ke>>>13,nt=0|L[9],pt=8191&nt,gt=nt>>>13,ko=0|F[0],lt=8191&ko,Pt=ko>>>13,z=0|F[1],D=8191&z,q=z>>>13,M=0|F[2],O=8191&M,Q=M>>>13,re=0|F[3],ue=8191&re,J=re>>>13,De=0|F[4],Pe=8191&De,Ee=De>>>13,st=0|F[5],Le=8191&st,ke=st>>>13,ut=0|F[6],Ne=8191&ut,Ue=ut>>>13,ht=0|F[7],Re=8191&ht,Se=ht>>>13,ct=0|F[8],qe=8191&ct,Me=ct>>>13,_e=0|F[9],pe=8191&_e,ve=_e>>>13;x.negative=c.negative^p.negative,x.length=19;var Ce=(V+(g=Math.imul(Z,lt))|0)+((8191&(h=(h=Math.imul(Z,Pt))+Math.imul(G,lt)|0))<<13)|0;V=((y=Math.imul(G,Pt))+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,g=Math.imul(X,lt),h=(h=Math.imul(X,Pt))+Math.imul(te,lt)|0,y=Math.imul(te,Pt);var Te=(V+(g=g+Math.imul(Z,D)|0)|0)+((8191&(h=(h=h+Math.imul(Z,q)|0)+Math.imul(G,D)|0))<<13)|0;V=((y=y+Math.imul(G,q)|0)+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,g=Math.imul(ce,lt),h=(h=Math.imul(ce,Pt))+Math.imul(we,lt)|0,y=Math.imul(we,Pt),g=g+Math.imul(X,D)|0,h=(h=h+Math.imul(X,q)|0)+Math.imul(te,D)|0,y=y+Math.imul(te,q)|0;var ze=(V+(g=g+Math.imul(Z,O)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Q)|0)+Math.imul(G,O)|0))<<13)|0;V=((y=y+Math.imul(G,Q)|0)+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,g=Math.imul(be,lt),h=(h=Math.imul(be,Pt))+Math.imul(me,lt)|0,y=Math.imul(me,Pt),g=g+Math.imul(ce,D)|0,h=(h=h+Math.imul(ce,q)|0)+Math.imul(we,D)|0,y=y+Math.imul(we,q)|0,g=g+Math.imul(X,O)|0,h=(h=h+Math.imul(X,Q)|0)+Math.imul(te,O)|0,y=y+Math.imul(te,Q)|0;var kt=(V+(g=g+Math.imul(Z,ue)|0)|0)+((8191&(h=(h=h+Math.imul(Z,J)|0)+Math.imul(G,ue)|0))<<13)|0;V=((y=y+Math.imul(G,J)|0)+(h>>>13)|0)+(kt>>>26)|0,kt&=67108863,g=Math.imul(ie,lt),h=(h=Math.imul(ie,Pt))+Math.imul(oe,lt)|0,y=Math.imul(oe,Pt),g=g+Math.imul(be,D)|0,h=(h=h+Math.imul(be,q)|0)+Math.imul(me,D)|0,y=y+Math.imul(me,q)|0,g=g+Math.imul(ce,O)|0,h=(h=h+Math.imul(ce,Q)|0)+Math.imul(we,O)|0,y=y+Math.imul(we,Q)|0,g=g+Math.imul(X,ue)|0,h=(h=h+Math.imul(X,J)|0)+Math.imul(te,ue)|0,y=y+Math.imul(te,J)|0;var St=(V+(g=g+Math.imul(Z,Pe)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Ee)|0)+Math.imul(G,Pe)|0))<<13)|0;V=((y=y+Math.imul(G,Ee)|0)+(h>>>13)|0)+(St>>>26)|0,St&=67108863,g=Math.imul(f,lt),h=(h=Math.imul(f,Pt))+Math.imul(b,lt)|0,y=Math.imul(b,Pt),g=g+Math.imul(ie,D)|0,h=(h=h+Math.imul(ie,q)|0)+Math.imul(oe,D)|0,y=y+Math.imul(oe,q)|0,g=g+Math.imul(be,O)|0,h=(h=h+Math.imul(be,Q)|0)+Math.imul(me,O)|0,y=y+Math.imul(me,Q)|0,g=g+Math.imul(ce,ue)|0,h=(h=h+Math.imul(ce,J)|0)+Math.imul(we,ue)|0,y=y+Math.imul(we,J)|0,g=g+Math.imul(X,Pe)|0,h=(h=h+Math.imul(X,Ee)|0)+Math.imul(te,Pe)|0,y=y+Math.imul(te,Ee)|0;var Et=(V+(g=g+Math.imul(Z,Le)|0)|0)+((8191&(h=(h=h+Math.imul(Z,ke)|0)+Math.imul(G,Le)|0))<<13)|0;V=((y=y+Math.imul(G,ke)|0)+(h>>>13)|0)+(Et>>>26)|0,Et&=67108863,g=Math.imul(T,lt),h=(h=Math.imul(T,Pt))+Math.imul(U,lt)|0,y=Math.imul(U,Pt),g=g+Math.imul(f,D)|0,h=(h=h+Math.imul(f,q)|0)+Math.imul(b,D)|0,y=y+Math.imul(b,q)|0,g=g+Math.imul(ie,O)|0,h=(h=h+Math.imul(ie,Q)|0)+Math.imul(oe,O)|0,y=y+Math.imul(oe,Q)|0,g=g+Math.imul(be,ue)|0,h=(h=h+Math.imul(be,J)|0)+Math.imul(me,ue)|0,y=y+Math.imul(me,J)|0,g=g+Math.imul(ce,Pe)|0,h=(h=h+Math.imul(ce,Ee)|0)+Math.imul(we,Pe)|0,y=y+Math.imul(we,Ee)|0,g=g+Math.imul(X,Le)|0,h=(h=h+Math.imul(X,ke)|0)+Math.imul(te,Le)|0,y=y+Math.imul(te,ke)|0;var Ct=(V+(g=g+Math.imul(Z,Ne)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Ue)|0)+Math.imul(G,Ne)|0))<<13)|0;V=((y=y+Math.imul(G,Ue)|0)+(h>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,g=Math.imul(Y,lt),h=(h=Math.imul(Y,Pt))+Math.imul(de,lt)|0,y=Math.imul(de,Pt),g=g+Math.imul(T,D)|0,h=(h=h+Math.imul(T,q)|0)+Math.imul(U,D)|0,y=y+Math.imul(U,q)|0,g=g+Math.imul(f,O)|0,h=(h=h+Math.imul(f,Q)|0)+Math.imul(b,O)|0,y=y+Math.imul(b,Q)|0,g=g+Math.imul(ie,ue)|0,h=(h=h+Math.imul(ie,J)|0)+Math.imul(oe,ue)|0,y=y+Math.imul(oe,J)|0,g=g+Math.imul(be,Pe)|0,h=(h=h+Math.imul(be,Ee)|0)+Math.imul(me,Pe)|0,y=y+Math.imul(me,Ee)|0,g=g+Math.imul(ce,Le)|0,h=(h=h+Math.imul(ce,ke)|0)+Math.imul(we,Le)|0,y=y+Math.imul(we,ke)|0,g=g+Math.imul(X,Ne)|0,h=(h=h+Math.imul(X,Ue)|0)+Math.imul(te,Ne)|0,y=y+Math.imul(te,Ue)|0;var Dt=(V+(g=g+Math.imul(Z,Re)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Se)|0)+Math.imul(G,Re)|0))<<13)|0;V=((y=y+Math.imul(G,Se)|0)+(h>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(Oe,lt),h=(h=Math.imul(Oe,Pt))+Math.imul(xe,lt)|0,y=Math.imul(xe,Pt),g=g+Math.imul(Y,D)|0,h=(h=h+Math.imul(Y,q)|0)+Math.imul(de,D)|0,y=y+Math.imul(de,q)|0,g=g+Math.imul(T,O)|0,h=(h=h+Math.imul(T,Q)|0)+Math.imul(U,O)|0,y=y+Math.imul(U,Q)|0,g=g+Math.imul(f,ue)|0,h=(h=h+Math.imul(f,J)|0)+Math.imul(b,ue)|0,y=y+Math.imul(b,J)|0,g=g+Math.imul(ie,Pe)|0,h=(h=h+Math.imul(ie,Ee)|0)+Math.imul(oe,Pe)|0,y=y+Math.imul(oe,Ee)|0,g=g+Math.imul(be,Le)|0,h=(h=h+Math.imul(be,ke)|0)+Math.imul(me,Le)|0,y=y+Math.imul(me,ke)|0,g=g+Math.imul(ce,Ne)|0,h=(h=h+Math.imul(ce,Ue)|0)+Math.imul(we,Ne)|0,y=y+Math.imul(we,Ue)|0,g=g+Math.imul(X,Re)|0,h=(h=h+Math.imul(X,Se)|0)+Math.imul(te,Re)|0,y=y+Math.imul(te,Se)|0;var zt=(V+(g=g+Math.imul(Z,qe)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Me)|0)+Math.imul(G,qe)|0))<<13)|0;V=((y=y+Math.imul(G,Me)|0)+(h>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(pt,lt),h=(h=Math.imul(pt,Pt))+Math.imul(gt,lt)|0,y=Math.imul(gt,Pt),g=g+Math.imul(Oe,D)|0,h=(h=h+Math.imul(Oe,q)|0)+Math.imul(xe,D)|0,y=y+Math.imul(xe,q)|0,g=g+Math.imul(Y,O)|0,h=(h=h+Math.imul(Y,Q)|0)+Math.imul(de,O)|0,y=y+Math.imul(de,Q)|0,g=g+Math.imul(T,ue)|0,h=(h=h+Math.imul(T,J)|0)+Math.imul(U,ue)|0,y=y+Math.imul(U,J)|0,g=g+Math.imul(f,Pe)|0,h=(h=h+Math.imul(f,Ee)|0)+Math.imul(b,Pe)|0,y=y+Math.imul(b,Ee)|0,g=g+Math.imul(ie,Le)|0,h=(h=h+Math.imul(ie,ke)|0)+Math.imul(oe,Le)|0,y=y+Math.imul(oe,ke)|0,g=g+Math.imul(be,Ne)|0,h=(h=h+Math.imul(be,Ue)|0)+Math.imul(me,Ne)|0,y=y+Math.imul(me,Ue)|0,g=g+Math.imul(ce,Re)|0,h=(h=h+Math.imul(ce,Se)|0)+Math.imul(we,Re)|0,y=y+Math.imul(we,Se)|0,g=g+Math.imul(X,qe)|0,h=(h=h+Math.imul(X,Me)|0)+Math.imul(te,qe)|0,y=y+Math.imul(te,Me)|0;var at=(V+(g=g+Math.imul(Z,pe)|0)|0)+((8191&(h=(h=h+Math.imul(Z,ve)|0)+Math.imul(G,pe)|0))<<13)|0;V=((y=y+Math.imul(G,ve)|0)+(h>>>13)|0)+(at>>>26)|0,at&=67108863,g=Math.imul(pt,D),h=(h=Math.imul(pt,q))+Math.imul(gt,D)|0,y=Math.imul(gt,q),g=g+Math.imul(Oe,O)|0,h=(h=h+Math.imul(Oe,Q)|0)+Math.imul(xe,O)|0,y=y+Math.imul(xe,Q)|0,g=g+Math.imul(Y,ue)|0,h=(h=h+Math.imul(Y,J)|0)+Math.imul(de,ue)|0,y=y+Math.imul(de,J)|0,g=g+Math.imul(T,Pe)|0,h=(h=h+Math.imul(T,Ee)|0)+Math.imul(U,Pe)|0,y=y+Math.imul(U,Ee)|0,g=g+Math.imul(f,Le)|0,h=(h=h+Math.imul(f,ke)|0)+Math.imul(b,Le)|0,y=y+Math.imul(b,ke)|0,g=g+Math.imul(ie,Ne)|0,h=(h=h+Math.imul(ie,Ue)|0)+Math.imul(oe,Ne)|0,y=y+Math.imul(oe,Ue)|0,g=g+Math.imul(be,Re)|0,h=(h=h+Math.imul(be,Se)|0)+Math.imul(me,Re)|0,y=y+Math.imul(me,Se)|0,g=g+Math.imul(ce,qe)|0,h=(h=h+Math.imul(ce,Me)|0)+Math.imul(we,qe)|0,y=y+Math.imul(we,Me)|0;var yt=(V+(g=g+Math.imul(X,pe)|0)|0)+((8191&(h=(h=h+Math.imul(X,ve)|0)+Math.imul(te,pe)|0))<<13)|0;V=((y=y+Math.imul(te,ve)|0)+(h>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(pt,O),h=(h=Math.imul(pt,Q))+Math.imul(gt,O)|0,y=Math.imul(gt,Q),g=g+Math.imul(Oe,ue)|0,h=(h=h+Math.imul(Oe,J)|0)+Math.imul(xe,ue)|0,y=y+Math.imul(xe,J)|0,g=g+Math.imul(Y,Pe)|0,h=(h=h+Math.imul(Y,Ee)|0)+Math.imul(de,Pe)|0,y=y+Math.imul(de,Ee)|0,g=g+Math.imul(T,Le)|0,h=(h=h+Math.imul(T,ke)|0)+Math.imul(U,Le)|0,y=y+Math.imul(U,ke)|0,g=g+Math.imul(f,Ne)|0,h=(h=h+Math.imul(f,Ue)|0)+Math.imul(b,Ne)|0,y=y+Math.imul(b,Ue)|0,g=g+Math.imul(ie,Re)|0,h=(h=h+Math.imul(ie,Se)|0)+Math.imul(oe,Re)|0,y=y+Math.imul(oe,Se)|0,g=g+Math.imul(be,qe)|0,h=(h=h+Math.imul(be,Me)|0)+Math.imul(me,qe)|0,y=y+Math.imul(me,Me)|0;var mt=(V+(g=g+Math.imul(ce,pe)|0)|0)+((8191&(h=(h=h+Math.imul(ce,ve)|0)+Math.imul(we,pe)|0))<<13)|0;V=((y=y+Math.imul(we,ve)|0)+(h>>>13)|0)+(mt>>>26)|0,mt&=67108863,g=Math.imul(pt,ue),h=(h=Math.imul(pt,J))+Math.imul(gt,ue)|0,y=Math.imul(gt,J),g=g+Math.imul(Oe,Pe)|0,h=(h=h+Math.imul(Oe,Ee)|0)+Math.imul(xe,Pe)|0,y=y+Math.imul(xe,Ee)|0,g=g+Math.imul(Y,Le)|0,h=(h=h+Math.imul(Y,ke)|0)+Math.imul(de,Le)|0,y=y+Math.imul(de,ke)|0,g=g+Math.imul(T,Ne)|0,h=(h=h+Math.imul(T,Ue)|0)+Math.imul(U,Ne)|0,y=y+Math.imul(U,Ue)|0,g=g+Math.imul(f,Re)|0,h=(h=h+Math.imul(f,Se)|0)+Math.imul(b,Re)|0,y=y+Math.imul(b,Se)|0,g=g+Math.imul(ie,qe)|0,h=(h=h+Math.imul(ie,Me)|0)+Math.imul(oe,qe)|0,y=y+Math.imul(oe,Me)|0;var _t=(V+(g=g+Math.imul(be,pe)|0)|0)+((8191&(h=(h=h+Math.imul(be,ve)|0)+Math.imul(me,pe)|0))<<13)|0;V=((y=y+Math.imul(me,ve)|0)+(h>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(pt,Pe),h=(h=Math.imul(pt,Ee))+Math.imul(gt,Pe)|0,y=Math.imul(gt,Ee),g=g+Math.imul(Oe,Le)|0,h=(h=h+Math.imul(Oe,ke)|0)+Math.imul(xe,Le)|0,y=y+Math.imul(xe,ke)|0,g=g+Math.imul(Y,Ne)|0,h=(h=h+Math.imul(Y,Ue)|0)+Math.imul(de,Ne)|0,y=y+Math.imul(de,Ue)|0,g=g+Math.imul(T,Re)|0,h=(h=h+Math.imul(T,Se)|0)+Math.imul(U,Re)|0,y=y+Math.imul(U,Se)|0,g=g+Math.imul(f,qe)|0,h=(h=h+Math.imul(f,Me)|0)+Math.imul(b,qe)|0,y=y+Math.imul(b,Me)|0;var it=(V+(g=g+Math.imul(ie,pe)|0)|0)+((8191&(h=(h=h+Math.imul(ie,ve)|0)+Math.imul(oe,pe)|0))<<13)|0;V=((y=y+Math.imul(oe,ve)|0)+(h>>>13)|0)+(it>>>26)|0,it&=67108863,g=Math.imul(pt,Le),h=(h=Math.imul(pt,ke))+Math.imul(gt,Le)|0,y=Math.imul(gt,ke),g=g+Math.imul(Oe,Ne)|0,h=(h=h+Math.imul(Oe,Ue)|0)+Math.imul(xe,Ne)|0,y=y+Math.imul(xe,Ue)|0,g=g+Math.imul(Y,Re)|0,h=(h=h+Math.imul(Y,Se)|0)+Math.imul(de,Re)|0,y=y+Math.imul(de,Se)|0,g=g+Math.imul(T,qe)|0,h=(h=h+Math.imul(T,Me)|0)+Math.imul(U,qe)|0,y=y+Math.imul(U,Me)|0;var It=(V+(g=g+Math.imul(f,pe)|0)|0)+((8191&(h=(h=h+Math.imul(f,ve)|0)+Math.imul(b,pe)|0))<<13)|0;V=((y=y+Math.imul(b,ve)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863,g=Math.imul(pt,Ne),h=(h=Math.imul(pt,Ue))+Math.imul(gt,Ne)|0,y=Math.imul(gt,Ue),g=g+Math.imul(Oe,Re)|0,h=(h=h+Math.imul(Oe,Se)|0)+Math.imul(xe,Re)|0,y=y+Math.imul(xe,Se)|0,g=g+Math.imul(Y,qe)|0,h=(h=h+Math.imul(Y,Me)|0)+Math.imul(de,qe)|0,y=y+Math.imul(de,Me)|0;var Lt=(V+(g=g+Math.imul(T,pe)|0)|0)+((8191&(h=(h=h+Math.imul(T,ve)|0)+Math.imul(U,pe)|0))<<13)|0;V=((y=y+Math.imul(U,ve)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,g=Math.imul(pt,Re),h=(h=Math.imul(pt,Se))+Math.imul(gt,Re)|0,y=Math.imul(gt,Se),g=g+Math.imul(Oe,qe)|0,h=(h=h+Math.imul(Oe,Me)|0)+Math.imul(xe,qe)|0,y=y+Math.imul(xe,Me)|0;var or=(V+(g=g+Math.imul(Y,pe)|0)|0)+((8191&(h=(h=h+Math.imul(Y,ve)|0)+Math.imul(de,pe)|0))<<13)|0;V=((y=y+Math.imul(de,ve)|0)+(h>>>13)|0)+(or>>>26)|0,or&=67108863,g=Math.imul(pt,qe),h=(h=Math.imul(pt,Me))+Math.imul(gt,qe)|0,y=Math.imul(gt,Me);var Ft=(V+(g=g+Math.imul(Oe,pe)|0)|0)+((8191&(h=(h=h+Math.imul(Oe,ve)|0)+Math.imul(xe,pe)|0))<<13)|0;V=((y=y+Math.imul(xe,ve)|0)+(h>>>13)|0)+(Ft>>>26)|0,Ft&=67108863;var nr=(V+(g=Math.imul(pt,pe))|0)+((8191&(h=(h=Math.imul(pt,ve))+Math.imul(gt,pe)|0))<<13)|0;return V=((y=Math.imul(gt,ve))+(h>>>13)|0)+(nr>>>26)|0,nr&=67108863,K[0]=Ce,K[1]=Te,K[2]=ze,K[3]=kt,K[4]=St,K[5]=Et,K[6]=Ct,K[7]=Dt,K[8]=zt,K[9]=at,K[10]=yt,K[11]=mt,K[12]=_t,K[13]=it,K[14]=It,K[15]=Lt,K[16]=or,K[17]=Ft,K[18]=nr,V!==0&&(K[19]=V,x.length++),x};function A(c,p,x){x.negative=p.negative^c.negative,x.length=c.length+p.length;for(var g=0,h=0,y=0;y>>26)|0)>>>26,L&=67108863}x.words[y]=F,g=L,L=h}return g!==0?x.words[y]=g:x.length--,x._strip()}function I(c,p,x){return A(c,p,x)}Math.imul||(v=w),i.prototype.mulTo=function(c,p){var x=this.length+c.length;return this.length===10&&c.length===10?v(this,c,p):x<63?w(this,c,p):x<1024?A(this,c,p):I(this,c,p)},i.prototype.mul=function(c){var p=new i(null);return p.words=new Array(this.length+c.length),this.mulTo(c,p)},i.prototype.mulf=function(c){var p=new i(null);return p.words=new Array(this.length+c.length),I(this,c,p)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){var p=c<0;p&&(c=-c),t(typeof c=="number"),t(c<67108864);for(var x=0,g=0;g>=26,x+=h/67108864|0,x+=y>>>26,this.words[g]=67108863&y}return x!==0&&(this.words[g]=x,this.length++),p?this.ineg():this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var p=function(y){for(var L=new Array(y.bitLength()),F=0;F>>V&1}return L}(c);if(p.length===0)return new i(1);for(var x=this,g=0;g=0);var p,x=c%26,g=(c-x)/26,h=67108863>>>26-x<<26-x;if(x!==0){var y=0;for(p=0;p>>26-x}y&&(this.words[p]=y,this.length++)}if(g!==0){for(p=this.length-1;p>=0;p--)this.words[p+g]=this.words[p];for(p=0;p=0),g=p?(p-p%26)/26:0;var h=c%26,y=Math.min((c-h)/26,this.length),L=67108863^67108863>>>h<y)for(this.length-=y,K=0;K=0&&(V!==0||K>=g);K--){var W=0|this.words[K];this.words[K]=V<<26-h|W>>>h,V=W&L}return F&&V!==0&&(F.words[F.length++]=V),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(c,p,x){return t(this.negative===0),this.iushrn(c,p,x)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var p=c%26,x=(c-p)/26,g=1<=0);var p=c%26,x=(c-p)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(p!==0&&x++,this.length=Math.min(x,this.length),p!==0){var g=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},i.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(F/67108864|0),this.words[g+x]=67108863&h}for(;g>26,this.words[g+x]=67108863&h;if(L===0)return this._strip();for(t(L===-1),L=0,g=0;g>26,this.words[g]=67108863&h;return this.negative=1,this._strip()},i.prototype._wordDiv=function(c,p){var x=(this.length,c.length),g=this.clone(),h=c,y=0|h.words[h.length-1];(x=26-this._countBits(y))!=0&&(h=h.ushln(x),g.iushln(x),y=0|h.words[h.length-1]);var L,F=g.length-h.length;if(p!=="mod"){(L=new i(null)).length=F+1,L.words=new Array(L.length);for(var K=0;K=0;W--){var Z=67108864*(0|g.words[h.length+W])+(0|g.words[h.length+W-1]);for(Z=Math.min(Z/y|0,67108863),g._ishlnsubmul(h,Z,W);g.negative!==0;)Z--,g.negative=0,g._ishlnsubmul(h,1,W),g.isZero()||(g.negative^=1);L&&(L.words[W]=Z)}return L&&L._strip(),g._strip(),p!=="div"&&x!==0&&g.iushrn(x),{div:L||null,mod:g}},i.prototype.divmod=function(c,p,x){return t(!c.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&c.negative===0?(y=this.neg().divmod(c,p),p!=="mod"&&(g=y.div.neg()),p!=="div"&&(h=y.mod.neg(),x&&h.negative!==0&&h.iadd(c)),{div:g,mod:h}):this.negative===0&&c.negative!==0?(y=this.divmod(c.neg(),p),p!=="mod"&&(g=y.div.neg()),{div:g,mod:y.mod}):this.negative&c.negative?(y=this.neg().divmod(c.neg(),p),p!=="div"&&(h=y.mod.neg(),x&&h.negative!==0&&h.isub(c)),{div:y.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?p==="div"?{div:this.divn(c.words[0]),mod:null}:p==="mod"?{div:null,mod:new i(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modrn(c.words[0]))}:this._wordDiv(c,p);var g,h,y},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var p=this.divmod(c);if(p.mod.isZero())return p.div;var x=p.div.negative!==0?p.mod.isub(c):p.mod,g=c.ushrn(1),h=c.andln(1),y=x.cmp(g);return y<0||h===1&&y===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},i.prototype.modrn=function(c){var p=c<0;p&&(c=-c),t(c<=67108863);for(var x=(1<<26)%c,g=0,h=this.length-1;h>=0;h--)g=(x*g+(0|this.words[h]))%c;return p?-g:g},i.prototype.modn=function(c){return this.modrn(c)},i.prototype.idivn=function(c){var p=c<0;p&&(c=-c),t(c<=67108863);for(var x=0,g=this.length-1;g>=0;g--){var h=(0|this.words[g])+67108864*x;this.words[g]=h/c|0,x=h%c}return this._strip(),p?this.ineg():this},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var p=this,x=c.clone();p=p.negative!==0?p.umod(c):p.clone();for(var g=new i(1),h=new i(0),y=new i(0),L=new i(1),F=0;p.isEven()&&x.isEven();)p.iushrn(1),x.iushrn(1),++F;for(var K=x.clone(),V=p.clone();!p.isZero();){for(var W=0,Z=1;!(p.words[0]&Z)&&W<26;++W,Z<<=1);if(W>0)for(p.iushrn(W);W-- >0;)(g.isOdd()||h.isOdd())&&(g.iadd(K),h.isub(V)),g.iushrn(1),h.iushrn(1);for(var G=0,ne=1;!(x.words[0]&ne)&&G<26;++G,ne<<=1);if(G>0)for(x.iushrn(G);G-- >0;)(y.isOdd()||L.isOdd())&&(y.iadd(K),L.isub(V)),y.iushrn(1),L.iushrn(1);p.cmp(x)>=0?(p.isub(x),g.isub(y),h.isub(L)):(x.isub(p),y.isub(g),L.isub(h))}return{a:y,b:L,gcd:x.iushln(F)}},i.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var p=this,x=c.clone();p=p.negative!==0?p.umod(c):p.clone();for(var g,h=new i(1),y=new i(0),L=x.clone();p.cmpn(1)>0&&x.cmpn(1)>0;){for(var F=0,K=1;!(p.words[0]&K)&&F<26;++F,K<<=1);if(F>0)for(p.iushrn(F);F-- >0;)h.isOdd()&&h.iadd(L),h.iushrn(1);for(var V=0,W=1;!(x.words[0]&W)&&V<26;++V,W<<=1);if(V>0)for(x.iushrn(V);V-- >0;)y.isOdd()&&y.iadd(L),y.iushrn(1);p.cmp(x)>=0?(p.isub(x),h.isub(y)):(x.isub(p),y.isub(h))}return(g=p.cmpn(1)===0?h:y).cmpn(0)<0&&g.iadd(c),g},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var p=this.clone(),x=c.clone();p.negative=0,x.negative=0;for(var g=0;p.isEven()&&x.isEven();g++)p.iushrn(1),x.iushrn(1);for(;;){for(;p.isEven();)p.iushrn(1);for(;x.isEven();)x.iushrn(1);var h=p.cmp(x);if(h<0){var y=p;p=x,x=y}else if(h===0||x.cmpn(1)===0)break;p.isub(x)}return x.iushln(g)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){t(typeof c=="number");var p=c%26,x=(c-p)/26,g=1<>>26,L&=67108863,this.words[y]=L}return h!==0&&(this.words[y]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var p,x=c<0;if(this.negative!==0&&!x)return-1;if(this.negative===0&&x)return 1;if(this._strip(),this.length>1)p=1;else{x&&(c=-c),t(c<=67108863,"Number is too big");var g=0|this.words[0];p=g===c?0:gc.length)return 1;if(this.length=0;x--){var g=0|this.words[x],h=0|c.words[x];if(g!==h){gh&&(p=1);break}}return p},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new H(c)},i.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var B={k256:null,p224:null,p192:null,p25519:null};function S(c,p){this.name=c,this.p=new i(p,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function P(){S.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function C(){S.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function R(){S.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function j(){S.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function H(c){if(typeof c=="string"){var p=i._prime(c);this.m=p.p,this.prime=p}else t(c.gtn(1),"modulus must be greater than 1"),this.m=c,this.prime=null}function N(c){H.call(this,c),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}S.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},S.prototype.ireduce=function(c){var p,x=c;do this.split(x,this.tmp),p=(x=(x=this.imulK(x)).iadd(this.tmp)).bitLength();while(p>this.n);var g=p0?x.isub(this.p):x.strip!==void 0?x.strip():x._strip(),x},S.prototype.split=function(c,p){c.iushrn(this.n,0,p)},S.prototype.imulK=function(c){return c.imul(this.k)},n(P,S),P.prototype.split=function(c,p){for(var x=4194303,g=Math.min(c.length,9),h=0;h>>22,y=L}y>>>=22,c.words[h-10]=y,y===0&&c.length>10?c.length-=10:c.length-=9},P.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var p=0,x=0;x>>=26,c.words[x]=h,p=g}return p!==0&&(c.words[c.length++]=p),c},i._prime=function(c){if(B[c])return B[c];var p;if(c==="k256")p=new P;else if(c==="p224")p=new C;else if(c==="p192")p=new R;else{if(c!=="p25519")throw new Error("Unknown prime "+c);p=new j}return B[c]=p,p},H.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},H.prototype._verify2=function(c,p){t((c.negative|p.negative)==0,"red works only with positives"),t(c.red&&c.red===p.red,"red works only with red numbers")},H.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(l(c,c.umod(this.m)._forceRed(this)),c)},H.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},H.prototype.add=function(c,p){this._verify2(c,p);var x=c.add(p);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},H.prototype.iadd=function(c,p){this._verify2(c,p);var x=c.iadd(p);return x.cmp(this.m)>=0&&x.isub(this.m),x},H.prototype.sub=function(c,p){this._verify2(c,p);var x=c.sub(p);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},H.prototype.isub=function(c,p){this._verify2(c,p);var x=c.isub(p);return x.cmpn(0)<0&&x.iadd(this.m),x},H.prototype.shl=function(c,p){return this._verify1(c),this.imod(c.ushln(p))},H.prototype.imul=function(c,p){return this._verify2(c,p),this.imod(c.imul(p))},H.prototype.mul=function(c,p){return this._verify2(c,p),this.imod(c.mul(p))},H.prototype.isqr=function(c){return this.imul(c,c.clone())},H.prototype.sqr=function(c){return this.mul(c,c)},H.prototype.sqrt=function(c){if(c.isZero())return c.clone();var p=this.m.andln(3);if(t(p%2==1),p===3){var x=this.m.add(new i(1)).iushrn(2);return this.pow(c,x)}for(var g=this.m.subn(1),h=0;!g.isZero()&&g.andln(1)===0;)h++,g.iushrn(1);t(!g.isZero());var y=new i(1).toRed(this),L=y.redNeg(),F=this.m.subn(1).iushrn(1),K=this.m.bitLength();for(K=new i(2*K*K).toRed(this);this.pow(K,F).cmp(L)!==0;)K.redIAdd(L);for(var V=this.pow(K,g),W=this.pow(c,g.addn(1).iushrn(1)),Z=this.pow(c,g),G=h;Z.cmp(y)!==0;){for(var ne=Z,X=0;ne.cmp(y)!==0;X++)ne=ne.redSqr();t(X=0;g--){for(var K=p.words[g],V=F-1;V>=0;V--){var W=K>>V&1;h!==x[0]&&(h=this.sqr(h)),W!==0||y!==0?(y<<=1,y|=W,(++L==4||g===0&&V===0)&&(h=this.mul(h,x[y]),L=0,y=0)):L=0}F=26}return h},H.prototype.convertTo=function(c){var p=c.umod(this.m);return p===c?p.clone():p},H.prototype.convertFrom=function(c){var p=c.clone();return p.red=null,p},i.mont=function(c){return new N(c)},n(N,H),N.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},N.prototype.convertFrom=function(c){var p=this.imod(c.mul(this.rinv));return p.red=null,p},N.prototype.imul=function(c,p){if(c.isZero()||p.isZero())return c.words[0]=0,c.length=1,c;var x=c.imul(p),g=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=x.isub(g).iushrn(this.shift),y=h;return h.cmp(this.m)>=0?y=h.isub(this.m):h.cmpn(0)<0&&(y=h.iadd(this.m)),y._forceRed(this)},N.prototype.mul=function(c,p){if(c.isZero()||p.isZero())return new i(0)._forceRed(this);var x=c.mul(p),g=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=x.isub(g).iushrn(this.shift),y=h;return h.cmp(this.m)>=0?y=h.isub(this.m):h.cmpn(0)<0&&(y=h.iadd(this.m)),y._forceRed(this)},N.prototype.invm=function(c){return this.imod(c._invmp(this.m).mul(this.r2))._forceRed(this)}})(g6,vt);var P1=g6.exports,ac=_i(P1),F0={exports:{}};(function(r,e){var t=Ze,n=t.Buffer;function i(s,a){for(var u in s)a[u]=s[u]}function o(s,a,u){return n(s,a,u)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(s,a,u){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,a,u)},o.alloc=function(s,a,u){if(typeof s!="number")throw new TypeError("Argument must be a number");var l=n(s);return a!==void 0?typeof u=="string"?l.fill(a,u):l.fill(a):l.fill(0),l},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(s)}})(F0,F0.exports);var gl=F0.exports.Buffer,L1=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t>>0,A=new Uint8Array(v);_[E];){var I=e[_.charCodeAt(E)];if(I===255)return;for(var B=0,S=v-1;(I!==0||B>>0,A[S]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");w=B,E++}for(var P=v-w;P!==v&&A[P]===0;)P++;var C=gl.allocUnsafe(m+(v-P));C.fill(0,0,m);for(var R=m;P!==v;)C[R++]=A[P++];return C}return{encode:function(_){if((Array.isArray(_)||_ instanceof Uint8Array)&&(_=gl.from(_)),!gl.isBuffer(_))throw new TypeError("Expected Buffer");if(_.length===0)return"";for(var E=0,m=0,w=0,v=_.length;w!==v&&_[w]===0;)w++,E++;for(var A=(v-w)*l+1>>>0,I=new Uint8Array(A);w!==v;){for(var B=_[w],S=0,P=A-1;(B!==0||S>>0,I[P]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");m=S,w++}for(var C=A-m;C!==A&&I[C]===0;)C++;for(var R=a.repeat(E);Cr&e^~r&t,tS=(r,e,t)=>r&e^r&t^e&t,rS=new Uint32Array([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]),Bo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mo=new Uint32Array(64);class nS extends n6{constructor(){super(64,32,8,!1),this.A=0|Bo[0],this.B=0|Bo[1],this.C=0|Bo[2],this.D=0|Bo[3],this.E=0|Bo[4],this.F=0|Bo[5],this.G=0|Bo[6],this.H=0|Bo[7]}get(){const{A:e,B:t,C:n,D:i,E:o,F:s,G:a,H:u}=this;return[e,t,n,i,o,s,a,u]}set(e,t,n,i,o,s,a,u){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|i,this.E=0|o,this.F=0|s,this.G=0|a,this.H=0|u}process(e,t){for(let _=0;_<16;_++,t+=4)Mo[_]=e.getUint32(t,!1);for(let _=16;_<64;_++){const E=Mo[_-15],m=Mo[_-2],w=xi(E,7)^xi(E,18)^E>>>3,v=xi(m,17)^xi(m,19)^m>>>10;Mo[_]=v+Mo[_-7]+w+Mo[_-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:u,G:l,H:d}=this;for(let _=0;_<64;_++){const E=d+(xi(a,6)^xi(a,11)^xi(a,25))+eS(a,u,l)+rS[_]+Mo[_]|0,m=(xi(n,2)^xi(n,13)^xi(n,22))+tS(n,i,o)|0;d=l,l=u,u=a,a=s+E|0,s=o,o=i,i=n,n=E+m|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+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,o,s,a,u,l,d)}roundClean(){Mo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const js=S1(()=>new nS);var rn={},iS=L1("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function ho(r,e,t){return e<=r&&r<=t}function ah(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function $0(r){this.tokens=[].slice.call(r)}$0.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.push(e.shift());else this.tokens.push(r)}};var wa=-1;function dd(r,e){if(r)throw TypeError("Decoder error");return e||65533}var uh="utf-8";function ch(r,e){if(!(this instanceof ch))return new ch(r,e);if((r=r!==void 0?String(r).toLowerCase():uh)!==uh)throw new Error("Encoding not supported. Only utf-8 is supported");e=ah(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function lh(r,e){if(!(this instanceof lh))return new lh(r,e);if((r=r!==void 0?String(r).toLowerCase():uh)!==uh)throw new Error("Encoding not supported. Only utf-8 is supported");e=ah(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function oS(r){var e=r.fatal,t=0,n=0,i=0,o=128,s=191;this.handler=function(a,u){if(u===-1&&i!==0)return i=0,dd(e);if(u===-1)return wa;if(i===0){if(ho(u,0,127))return u;if(ho(u,194,223))i=1,t=u-192;else if(ho(u,224,239))u===224&&(o=160),u===237&&(s=159),i=2,t=u-224;else{if(!ho(u,240,244))return dd(e);u===240&&(o=144),u===244&&(s=143),i=3,t=u-240}return t<<=6*i,null}if(!ho(u,o,s))return t=i=n=0,o=128,s=191,a.prepend(u),dd(e);if(o=128,s=191,t+=u-128<<6*(i-(n+=1)),n!==i)return null;var l=t;return t=i=n=0,l}}function sS(r){r.fatal,this.handler=function(e,t){if(t===-1)return wa;if(ho(t,0,127))return t;var n,i;ho(t,128,2047)?(n=1,i=192):ho(t,2048,65535)?(n=2,i=224):ho(t,65536,1114111)&&(n=3,i=240);for(var o=[(t>>6*n)+i];n>0;){var s=t>>6*(n-1);o.push(128|63&s),n-=1}return o}}ch.prototype={decode:function(r,e){var t;t=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),e=ah(e),this._streaming||(this._decoder=new oS({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var n,i=new $0(t),o=[];!i.endOfStream()&&(n=this._decoder.handler(i,i.read()))!==wa;)n!==null&&(Array.isArray(n)?o.push.apply(o,n):o.push(n));if(!this._streaming){do{if((n=this._decoder.handler(i,i.read()))===wa)break;n!==null&&(Array.isArray(n)?o.push.apply(o,n):o.push(n))}while(!i.endOfStream());this._decoder=null}return o.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(o[0]===65279?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(s){for(var a="",u=0;u>10),56320+(1023&l)))}return a}(o)}},lh.prototype={encode:function(r,e){r=r?String(r):"",e=ah(e),this._streaming||(this._encoder=new sS(this._options)),this._streaming=!!e.stream;for(var t,n=[],i=new $0(function(o){for(var s=String(o),a=s.length,u=0,l=[];u57343)l.push(d);else if(56320<=d&&d<=57343)l.push(65533);else if(55296<=d&&d<=56319)if(u===a-1)l.push(65533);else{var _=o.charCodeAt(u+1);if(56320<=_&&_<=57343){var E=1023&d,m=1023&_;l.push(65536+(E<<10)+m),u+=1}else l.push(65533)}u+=1}return l}(r));!i.endOfStream()&&(t=this._encoder.handler(i,i.read()))!==wa;)Array.isArray(t)?n.push.apply(n,t):n.push(t);if(!this._streaming){for(;(t=this._encoder.handler(i,i.read()))!==wa;)Array.isArray(t)?n.push.apply(n,t):n.push(t);this._encoder=null}return new Uint8Array(n)}};var aS=$c(Object.freeze({__proto__:null,TextEncoder:lh,TextDecoder:ch})),uS=vt&&vt.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),cS=vt&&vt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Ai=vt&&vt.__decorate||function(r,e,t,n){var i,o=arguments.length,s=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(s=(o<3?i(s):o>3?i(e,t,s):i(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},lS=vt&&vt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.hasOwnProperty.call(r,t)&&uS(e,r,t);return cS(e,r),e},m6=vt&&vt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rn,"__esModule",{value:!0});var w6=rn.deserializeUnchecked=E6=rn.deserialize=C1=rn.serialize=rn.BinaryReader=rn.BinaryWriter=rn.BorshError=rn.baseDecode=rn.baseEncode=void 0;const No=m6(P1),cm=m6(iS),hS=lS(aS),fS=new(typeof TextDecoder!="function"?hS.TextDecoder:TextDecoder)("utf-8",{fatal:!0});rn.baseEncode=function(r){return typeof r=="string"&&(r=Ae.Buffer.from(r,"utf8")),cm.default.encode(Ae.Buffer.from(r))},rn.baseDecode=function(r){return Ae.Buffer.from(cm.default.decode(r))};const pd=1024;class wn extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}rn.BorshError=wn;class b6{constructor(){this.buf=Ae.Buffer.alloc(pd),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Ae.Buffer.concat([this.buf,Ae.Buffer.alloc(pd)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new No.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new No.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new No.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new No.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Ae.Buffer.concat([Ae.Buffer.from(this.buf.subarray(0,this.length)),e,Ae.Buffer.alloc(pd)]),this.length+=e.length}writeString(e){this.maybeResize();const t=Ae.Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Ae.Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function ki(r,e,t){const n=t.value;t.value=function(...i){try{return n.apply(this,i)}catch(o){if(o instanceof RangeError){const s=o.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(s)>=0)throw new wn("Reached the end of buffer when deserializing")}throw o}}}rn.BinaryWriter=b6;class Un{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new No.default(e,"le")}readU128(){const e=this.readBuffer(16);return new No.default(e,"le")}readU256(){const e=this.readBuffer(32);return new No.default(e,"le")}readU512(){const e=this.readBuffer(64);return new No.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new wn(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return fS.decode(t)}catch(n){throw new wn(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let i=0;i{ps(r,e,o,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":t==null?i.writeU8(0):(i.writeU8(1),ps(r,e,t,n.type,i));break;case"map":i.writeU32(t.size),t.forEach((o,s)=>{ps(r,e,s,n.key,i),ps(r,e,o,n.value,i)});break;default:throw new wn(`FieldType ${n} unrecognized`)}else _6(r,t,i)}catch(o){throw o instanceof wn&&o.addToFieldPath(e),o}}function _6(r,e,t){if(typeof e.borshSerialize=="function")return void e.borshSerialize(t);const n=r.get(e.constructor);if(!n)throw new wn(`Class ${e.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,o])=>{ps(r,i,e[i],o,t)});else{if(n.kind!=="enum")throw new wn(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`);{const i=e[n.field];for(let o=0;ogs(r,e,t[0],n))}if(t.kind==="option")return n.readU8()?gs(r,e,t.type,n):void 0;if(t.kind==="map"){let i=new Map;const o=n.readU32();for(let s=0;s=n.values.length)throw new wn(`Enum index: ${i} is out of range`);const[o,s]=n.values[i];return new e({[o]:gs(r,o,s,t)})}throw new wn(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}var E6=rn.deserialize=function(r,e,t,n=Un){const i=new n(t),o=T1(r,e,i);if(i.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function R1(r,e){return e.property?r+"["+e.property+"]":r}he.Layout=sr,he.nameWithProperty=R1,he.bindConstructorLayout=function(r,e){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof sr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=e,e.boundConstructor_=r,e.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(t,n)=>e.decode(t,n),writable:!0})};class En extends sr{isCount(){throw new Error("ExternalLayout is abstract")}}he.ExternalLayout=En;class x6 extends En{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){nu(e);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}he.GreedyCount=x6;class U1 extends En{constructor(e,t=0,n){if(!(e instanceof sr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof ni||this.layout instanceof yi}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,n=0){return this.layout.encode(e,t,n+this.offset)}}he.OffsetLayout=U1;class ni extends sr{constructor(e,t){if(super(e,t),6s+i.encode(a,t,n+s),0);return this.count instanceof En&&this.count.encode(e.length,t,n),o}}he.Sequence=C6;class T6 extends sr{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce((o,s)=>o&&s instanceof sr,!0))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&n===void 0&&(n=t,t=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,t);return t+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,t=0){nu(e);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n=0){const i=n;let o=0,s=0;for(const a of this.fields){let u=a.span;if(s=0u&&(u=a.getSpan(t,n)))}o=n,n+=u}return o+s-i}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?t=-1:0<=t&&(t+=n.span)}}}he.Structure=T6;class N1{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,n){throw new Error("UnionDiscriminator is abstract")}}he.UnionDiscriminator=N1;class hh extends N1{constructor(e,t){if(!(e instanceof En&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}he.UnionLayoutDiscriminator=hh;class D1 extends sr{constructor(e,t,n){let i;if(e instanceof ni||e instanceof yi)i=new hh(new U1(e));else if(e instanceof En&&e.isCount())i=new hh(e);else{if(!(e instanceof N1))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");i=e}if(t===void 0&&(t=null),!(t===null||t instanceof sr))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&(e instanceof ni||e instanceof yi)&&(o+=i.layout.span)),super(o,n),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof ni||e instanceof yi,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e,t=0){let n;const i=this.discriminator,o=i.decode(e,t),s=this.registry[o];if(s===void 0){const a=this.defaultLayout;let u=0;this.usesPrefixDiscriminator&&(u=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[a.property]=a.decode(e,t+u)}else n=s.decode(e,t);return n}encode(e,t,n=0){const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(e[o.property],t,n),a+s.encode(e[s.property],t,n+a)}return i.encode(e,t,n)}addVariant(e,t,n){const i=new O6(this,e,t,n);return this.registry[e]=i,i}getVariant(e,t=0){let n;return n=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[n]}}he.Union=D1;class O6 extends sr{constructor(e,t,n,i){if(!(e instanceof D1))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof sr))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,t+n)),n+i}decode(e,t=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],t,n+i),o+=this.layout.getSpan(t,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function ha(r){return 0>r&&(r+=4294967296),r}he.VariantLayout=O6;class z1 extends sr{constructor(e,t,n){if(!(e instanceof ni||e instanceof yi))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&n===void 0&&(n=t,t=!1),4=t)throw new TypeError("bits must be positive integer");const i=8*e.span,o=e.fields.reduce((s,a)=>s+a.bits,0);if(t+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==ha(e&this.valueMask))throw new TypeError(R1("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=ha(e<n&&(n=this.length.decode(e,t)),n}decode(e,t=0){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),Jt(e).slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof En&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw new TypeError(R1("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>t.length)throw new RangeError("encoding overruns Uint8Array");const o=Jt(e);return Jt(t).write(o.toString("hex"),n,i,"hex"),this.length instanceof En&&this.length.encode(i,t,n),i}}he.Blob=U6;class N6 extends sr{constructor(e){super(-1,e)}getSpan(e,t=0){nu(e);let n=t;for(;nt.length)throw new RangeError("encoding overruns Buffer");const s=Jt(t);return i.copy(s,n),s[n+o]=0,o+1}}he.CString=N6;class D6 extends sr{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return nu(e),e.length-t}decode(e,t=0){const n=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpant.length)throw new RangeError("encoding overruns Buffer");return i.copy(Jt(t),n),o}}he.UTF8=D6;class z6 extends sr{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,n){return 0}}he.Constant=z6,he.greedy=(r,e)=>new x6(r,e);var Ko=he.offset=(r,e,t)=>new U1(r,e,t),jt=he.u8=r=>new ni(1,r),Qn=he.u16=r=>new ni(2,r);he.u24=r=>new ni(3,r);var Qe=he.u32=r=>new ni(4,r);he.u40=r=>new ni(5,r),he.u48=r=>new ni(6,r);var Xr=he.nu64=r=>new A6(r);he.u16be=r=>new yi(2,r),he.u24be=r=>new yi(3,r),he.u32be=r=>new yi(4,r),he.u40be=r=>new yi(5,r),he.u48be=r=>new yi(6,r),he.nu64be=r=>new k6(r),he.s8=r=>new hs(1,r),he.s16=r=>new hs(2,r),he.s24=r=>new hs(3,r),he.s32=r=>new hs(4,r),he.s40=r=>new hs(5,r),he.s48=r=>new hs(6,r);var zn=he.ns64=r=>new S6(r);he.s16be=r=>new la(2,r),he.s24be=r=>new la(3,r),he.s32be=r=>new la(4,r),he.s40be=r=>new la(5,r),he.s48be=r=>new la(6,r),he.ns64be=r=>new I6(r),he.f32=r=>new B6(r),he.f32be=r=>new M6(r),he.f64=r=>new P6(r),he.f64be=r=>new L6(r);var rt=he.struct=(r,e,t)=>new T6(r,e,t);he.bits=(r,e,t)=>new z1(r,e,t);var sn=he.seq=(r,e,t)=>new C6(r,e,t);he.union=(r,e,t)=>new D1(r,e,t),he.unionLayoutDiscriminator=(r,e)=>new hh(r,e);var lr=he.blob=(r,e)=>new U6(r,e);he.cstr=r=>new N6(r),he.utf8=(r,e)=>new D6(r,e),he.constant=(r,e)=>new z6(r,e);var Kc={};Object.defineProperty(Kc,"__esModule",{value:!0});var j6=Kc.toBigIntLE=function(r){{const e=Ae.Buffer.from(r);e.reverse();const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};Kc.toBigIntBE=function(r){{const e=r.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};var gd,F1=Kc.toBufferLE=function(r,e){{const t=r.toString(16),n=Ae.Buffer.from(t.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};Kc.toBufferBE=function(r,e){{const t=r.toString(16);return Ae.Buffer.from(t.padStart(2*e,"0").slice(0,2*e),"hex")}};class dS extends TypeError{constructor(e,t){let n;const{message:i,...o}=e,{path:s}=e;super(s.length===0?i:"At path: "+s.join(".")+" -- "+i),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var a;return(a=n)!=null?a:n=[e,...t()]}}}function Vo(r){return typeof r=="object"&&r!=null}function wi(r){return typeof r=="string"?JSON.stringify(r):""+r}function pS(r,e,t,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:o}=e,{type:s}=t,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+wi(n)+"`"}=r;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...r,message:u}}function*lm(r,e,t,n){(function(i){return Vo(i)&&typeof i[Symbol.iterator]=="function"})(r)||(r=[r]);for(const i of r){const o=pS(i,e,t,n);o&&(yield o)}}function*$1(r,e,t={}){const{path:n=[],branch:i=[r],coerce:o=!1,mask:s=!1}=t,a={path:n,branch:i};if(o&&(r=e.coercer(r,a),s&&e.type!=="type"&&Vo(e.schema)&&Vo(r)&&!Array.isArray(r)))for(const l in r)e.schema[l]===void 0&&delete r[l];let u=!0;for(const l of e.validator(r,a))u=!1,yield[l,void 0];for(let[l,d,_]of e.entries(r,a)){const E=$1(d,_,{path:l===void 0?n:[...n,l],branch:l===void 0?i:[...i,d],coerce:o,mask:s});for(const m of E)m[0]?(u=!1,yield[m[0],void 0]):o&&(d=m[1],l===void 0?r=d:r instanceof Map?r.set(l,d):r instanceof Set?r.add(d):Vo(r)&&(r[l]=d))}if(u)for(const l of e.refiner(r,a))u=!1,yield[l,void 0];u&&(yield[void 0,r])}class Gi{constructor(e){const{type:t,schema:n,validator:i,refiner:o,coercer:s=u=>u,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=s,this.validator=i?(u,l)=>lm(i(u,l),l,this,u):()=>[],this.refiner=o?(u,l)=>lm(o(u,l),l,this,u):()=>[]}assert(e){return F6(e,this)}create(e){return We(e,this)}is(e){return $6(e,this)}mask(e){return function(t,n){const i=uc(t,n,{coerce:!0,mask:!0});if(i[0])throw i[0];return i[1]}(e,this)}validate(e,t={}){return uc(e,this,t)}}function F6(r,e){const t=uc(r,e);if(t[0])throw t[0]}function We(r,e){const t=uc(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function $6(r,e){return!uc(r,e)[0]}function uc(r,e,t={}){const n=$1(r,e,t),i=function(o){const{done:s,value:a}=o.next();return s?void 0:a}(n);return i[0]?[new dS(i[0],function*(){for(const s of n)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function Zs(r,e){return new Gi({type:r,schema:null,validator:e})}function Ge(r){return new Gi({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,r]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+wi(e)})}function Wi(){return Zs("boolean",r=>typeof r=="boolean")}function K1(r){return Zs("instance",e=>e instanceof r||"Expected a `"+r.name+"` instance, but received: "+wi(e))}function xr(r){const e=wi(r),t=typeof r;return new Gi({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+e+"`, but received: "+wi(n)})}function Ye(r){return new Gi({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function ae(){return Zs("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+wi(r))}function At(r){return new Gi({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function K6(r,e){return new Gi({type:"record",schema:null,*entries(t){if(Vo(t))for(const n in t){const i=t[n];yield[n,n,r],yield[n,i,e]}},validator:t=>Vo(t)||"Expected an object, but received: "+wi(t)})}function Ve(){return Zs("string",r=>typeof r=="string"||"Expected a string, but received: "+wi(r))}function V1(r){const e=Zs("never",()=>!1);return new Gi({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const n=Math.max(r.length,t.length);for(let i=0;iArray.isArray(t)||"Expected an array, but received: "+wi(t)})}function Be(r){const e=Object.keys(r);return new Gi({type:"type",schema:r,*entries(t){if(Vo(t))for(const n of e)yield[n,t[n],r[n]]},validator:t=>Vo(t)||"Expected an object, but received: "+wi(t)})}function Mn(r){const e=r.map(t=>t.type).join(" | ");return new Gi({type:"union",schema:null,validator(t,n){const i=[];for(const o of r){const[...s]=$1(t,o,n),[a]=s;if(!a[0])return[];for(const[u]of s)u&&i.push(u)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+wi(t),...i]}})}function Vc(){return Zs("unknown",()=>!0)}function qc(r,e,t){return new Gi({...r,coercer:(n,i)=>$6(n,e)?r.coercer(t(n,i),i):r.coercer(n,i)})}var gS=new Uint8Array(16);function hm(){if(!gd&&!(gd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gd(gS)}var yS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function fh(r){return typeof r=="string"&&yS.test(r)}for(var fm,yd,Yr=[],md=0;md<256;++md)Yr.push((md+256).toString(16).substr(1));function Hl(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(Yr[r[e+0]]+Yr[r[e+1]]+Yr[r[e+2]]+Yr[r[e+3]]+"-"+Yr[r[e+4]]+Yr[r[e+5]]+"-"+Yr[r[e+6]]+Yr[r[e+7]]+"-"+Yr[r[e+8]]+Yr[r[e+9]]+"-"+Yr[r[e+10]]+Yr[r[e+11]]+Yr[r[e+12]]+Yr[r[e+13]]+Yr[r[e+14]]+Yr[r[e+15]]).toLowerCase();if(!fh(t))throw TypeError("Stringified UUID is invalid");return t}var wd=0,bd=0;function V6(r){if(!fh(r))throw TypeError("Invalid UUID");var e,t=new Uint8Array(16);return t[0]=(e=parseInt(r.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=255&e,t[4]=(e=parseInt(r.slice(9,13),16))>>>8,t[5]=255&e,t[6]=(e=parseInt(r.slice(14,18),16))>>>8,t[7]=255&e,t[8]=(e=parseInt(r.slice(19,23),16))>>>8,t[9]=255&e,t[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=255&e,t}function q6(r,e,t){function n(i,o,s,a){if(typeof i=="string"&&(i=function(d){d=unescape(encodeURIComponent(d));for(var _=[],E=0;E>>9<<4)+1}function Do(r,e){var t=(65535&r)+(65535&e);return(r>>16)+(e>>16)+(t>>16)<<16|65535&t}function lf(r,e,t,n,i,o){return Do((s=Do(Do(e,r),Do(n,o)))<<(a=i)|s>>>32-a,t);var s,a}function ln(r,e,t,n,i,o,s){return lf(e&t|~e&n,r,e,i,o,s)}function hn(r,e,t,n,i,o,s){return lf(e&n|t&~n,r,e,i,o,s)}function fn(r,e,t,n,i,o,s){return lf(e^t^n,r,e,i,o,s)}function dn(r,e,t,n,i,o,s){return lf(t^(e|~n),r,e,i,o,s)}var mS=q6("v3",48,function(r){if(typeof r=="string"){var e=unescape(encodeURIComponent(r));r=new Uint8Array(e.length);for(var t=0;t>5]>>>a%32&255,l=parseInt(s.charAt(u>>>4&15)+s.charAt(15&u),16);i.push(l)}return i}(function(n,i){n[i>>5]|=128<>5]|=(255&n[s/8])<>>32-e}var vS=q6("v5",80,function(r){var e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var i=0;i>>0;S=B,B=I,I=vd(A,30)>>>0,A=v,v=R}t[0]=t[0]+v>>>0,t[1]=t[1]+A>>>0,t[2]=t[2]+I>>>0,t[3]=t[3]+B>>>0,t[4]=t[4]+S>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}),_S=vS,ES=Object.freeze({__proto__:null,v1:function(r,e,t){var n=e&&t||0,i=e||new Array(16),o=(r=r||{}).node||fm,s=r.clockseq!==void 0?r.clockseq:yd;if(o==null||s==null){var a=r.random||(r.rng||hm)();o==null&&(o=fm=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),s==null&&(s=yd=16383&(a[6]<<8|a[7]))}var u=r.msecs!==void 0?r.msecs:Date.now(),l=r.nsecs!==void 0?r.nsecs:bd+1,d=u-wd+(l-bd)/1e4;if(d<0&&r.clockseq===void 0&&(s=s+1&16383),(d<0||u>wd)&&r.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");wd=u,bd=l,yd=s;var _=(1e4*(268435455&(u+=122192928e5))+l)%4294967296;i[n++]=_>>>24&255,i[n++]=_>>>16&255,i[n++]=_>>>8&255,i[n++]=255&_;var E=u/4294967296*1e4&268435455;i[n++]=E>>>8&255,i[n++]=255&E,i[n++]=E>>>24&15|16,i[n++]=E>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var m=0;m<6;++m)i[n+m]=o[m];return e||Hl(i)},v3:wS,v4:function(r,e,t){var n=(r=r||{}).random||(r.rng||hm)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){t=t||0;for(var i=0;i<16;++i)e[t+i]=n[i];return e}return Hl(n)},v5:_S,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!fh(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:fh,stringify:Hl,parse:V6}),H6=$c(ES);const xS=H6.v4;var AS=function(r,e,t,n){if(typeof r!="string")throw new TypeError(r+" must be a string");const i=typeof(n=n||{}).version=="number"?n.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");const o={method:r};if(i===2&&(o.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");o.params=e}if(t===void 0){const s=typeof n.generator=="function"?n.generator:function(){return xS()};o.id=s(o,n)}else i===2&&t===null?n.notificationIdNull&&(o.id=null):o.id=t;return o};const kS=H6.v4,SS=AS,cc=function(r,e){if(!(this instanceof cc))return new cc(r,e);e||(e={}),this.options={reviver:e.reviver!==void 0?e.reviver:null,replacer:e.replacer!==void 0?e.replacer:null,generator:e.generator!==void 0?e.generator:function(){return kS()},version:e.version!==void 0?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"&&e.notificationIdNull},this.callServer=r};var IS=cc;cc.prototype.request=function(r,e,t,n){const i=this;let o=null;const s=Array.isArray(r)&&typeof e=="function";if(this.options.version===1&&s)throw new TypeError("JSON-RPC 1.0 does not support batching");if(s||!s&&r&&typeof r=="object"&&typeof e=="function")n=e,o=r;else{typeof t=="function"&&(n=t,t=void 0);const u=typeof n=="function";try{o=SS(r,e,t,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(l){if(u)return n(l);throw l}if(!u)return o}let a;try{a=JSON.stringify(o,this.options.replacer)}catch(u){return n(u)}return this.callServer(a,function(u,l){i._parseResponse(u,l,n)}),o},cc.prototype._parseResponse=function(r,e,t){if(r)return void t(r);if(!e)return t();let n;try{n=JSON.parse(e,this.options.reviver)}catch(i){return t(i)}if(t.length===3){if(Array.isArray(n)){const i=function(s){return s.error!==void 0},o=function(s){return!i(s)};return t(null,n.filter(i),n.filter(o))}return t(null,n.error,n.result)}t(null,n)};var yl,BS=_i(IS),W6={},Z6={exports:{}};(yl=Z6).exports=function(r){return r&&r.__esModule?r:{default:r}},yl.exports.__esModule=!0,yl.exports.default=yl.exports;var pm,gm,_d,ym,G6=Z6.exports,mm={exports:{}},wm={exports:{}};function Hc(){return pm||(pm=1,function(r){function e(t){return r.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,e(t)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports}(wm)),wm.exports}function MS(){if(ym)return _d;ym=1;var r=(gm||(gm=1,function(e){var t=Hc().default;function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exports=n=function(){return o},e.exports.__esModule=!0,e.exports.default=e.exports;var i,o={},s=Object.prototype,a=s.hasOwnProperty,u=Object.defineProperty||function(W,Z,G){W[Z]=G.value},l=typeof Symbol=="function"?Symbol:{},d=l.iterator||"@@iterator",_=l.asyncIterator||"@@asyncIterator",E=l.toStringTag||"@@toStringTag";function m(W,Z,G){return Object.defineProperty(W,Z,{value:G,enumerable:!0,configurable:!0,writable:!0}),W[Z]}try{m({},"")}catch{m=function(Z,G,ne){return Z[G]=ne}}function w(W,Z,G,ne){var X=Z&&Z.prototype instanceof C?Z:C,te=Object.create(X.prototype),ge=new K(ne||[]);return u(te,"_invoke",{value:h(W,G,ge)}),te}function v(W,Z,G){try{return{type:"normal",arg:W.call(Z,G)}}catch(ne){return{type:"throw",arg:ne}}}o.wrap=w;var A="suspendedStart",I="suspendedYield",B="executing",S="completed",P={};function C(){}function R(){}function j(){}var H={};m(H,d,function(){return this});var N=Object.getPrototypeOf,c=N&&N(N(V([])));c&&c!==s&&a.call(c,d)&&(H=c);var p=j.prototype=C.prototype=Object.create(H);function x(W){["next","throw","return"].forEach(function(Z){m(W,Z,function(G){return this._invoke(Z,G)})})}function g(W,Z){function G(X,te,ge,ce){var we=v(W[X],W,te);if(we.type!=="throw"){var $e=we.arg,be=$e.value;return be&&t(be)=="object"&&a.call(be,"__await")?Z.resolve(be.__await).then(function(me){G("next",me,ge,ce)},function(me){G("throw",me,ge,ce)}):Z.resolve(be).then(function(me){$e.value=me,ge($e)},function(me){return G("throw",me,ge,ce)})}ce(we.arg)}var ne;u(this,"_invoke",{value:function(X,te){function ge(){return new Z(function(ce,we){G(X,te,ce,we)})}return ne=ne?ne.then(ge,ge):ge()}})}function h(W,Z,G){var ne=A;return function(X,te){if(ne===B)throw new Error("Generator is already running");if(ne===S){if(X==="throw")throw te;return{value:i,done:!0}}for(G.method=X,G.arg=te;;){var ge=G.delegate;if(ge){var ce=y(ge,G);if(ce){if(ce===P)continue;return ce}}if(G.method==="next")G.sent=G._sent=G.arg;else if(G.method==="throw"){if(ne===A)throw ne=S,G.arg;G.dispatchException(G.arg)}else G.method==="return"&&G.abrupt("return",G.arg);ne=B;var we=v(W,Z,G);if(we.type==="normal"){if(ne=G.done?S:I,we.arg===P)continue;return{value:we.arg,done:G.done}}we.type==="throw"&&(ne=S,G.method="throw",G.arg=we.arg)}}}function y(W,Z){var G=Z.method,ne=W.iterator[G];if(ne===i)return Z.delegate=null,G==="throw"&&W.iterator.return&&(Z.method="return",Z.arg=i,y(W,Z),Z.method==="throw")||G!=="return"&&(Z.method="throw",Z.arg=new TypeError("The iterator does not provide a '"+G+"' method")),P;var X=v(ne,W.iterator,Z.arg);if(X.type==="throw")return Z.method="throw",Z.arg=X.arg,Z.delegate=null,P;var te=X.arg;return te?te.done?(Z[W.resultName]=te.value,Z.next=W.nextLoc,Z.method!=="return"&&(Z.method="next",Z.arg=i),Z.delegate=null,P):te:(Z.method="throw",Z.arg=new TypeError("iterator result is not an object"),Z.delegate=null,P)}function L(W){var Z={tryLoc:W[0]};1 in W&&(Z.catchLoc=W[1]),2 in W&&(Z.finallyLoc=W[2],Z.afterLoc=W[3]),this.tryEntries.push(Z)}function F(W){var Z=W.completion||{};Z.type="normal",delete Z.arg,W.completion=Z}function K(W){this.tryEntries=[{tryLoc:"root"}],W.forEach(L,this),this.reset(!0)}function V(W){if(W||W===""){var Z=W[d];if(Z)return Z.call(W);if(typeof W.next=="function")return W;if(!isNaN(W.length)){var G=-1,ne=function X(){for(;++G=0;--ne){var X=this.tryEntries[ne],te=X.completion;if(X.tryLoc==="root")return G("end");if(X.tryLoc<=this.prev){var ge=a.call(X,"catchLoc"),ce=a.call(X,"finallyLoc");if(ge&&ce){if(this.prev=0;--G){var ne=this.tryEntries[G];if(ne.tryLoc<=this.prev&&a.call(ne,"finallyLoc")&&this.prev=0;--Z){var G=this.tryEntries[Z];if(G.finallyLoc===W)return this.complete(G.completion,G.afterLoc),F(G),P}},catch:function(W){for(var Z=this.tryEntries.length-1;Z>=0;--Z){var G=this.tryEntries[Z];if(G.tryLoc===W){var ne=G.completion;if(ne.type==="throw"){var X=ne.arg;F(G)}return X}}throw new Error("illegal catch attempt")},delegateYield:function(W,Z,G){return this.delegate={iterator:V(W),resultName:Z,nextLoc:G},this.method==="next"&&(this.arg=i),P}},o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(mm)),mm.exports)();_d=r;try{regeneratorRuntime=r}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}return _d}var bm,vm={exports:{}},_m,Em={exports:{}};function Y6(){return _m||(_m=1,function(r){r.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(Em)),Em.exports}var xm,Am,km,Sm={exports:{}},Im={exports:{}},Bm={exports:{}};function PS(){return xm||(xm=1,function(r){var e=Hc().default;r.exports=function(t,n){if(e(t)!=="object"||t===null)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var o=i.call(t,n||"default");if(e(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)},r.exports.__esModule=!0,r.exports.default=r.exports}(Bm)),Bm.exports}function LS(){return Am||(Am=1,function(r){var e=Hc().default,t=PS();r.exports=function(n){var i=t(n,"string");return e(i)==="symbol"?i:String(i)},r.exports.__esModule=!0,r.exports.default=r.exports}(Im)),Im.exports}function J6(){return km||(km=1,function(r){var e=LS();function t(n,i){for(var o=0;o"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var v,A=(0,l.default)(m);if(w){var I=(0,l.default)(this).constructor;v=Reflect.construct(A,arguments,I)}else v=A.apply(this,arguments);return(0,u.default)(this,v)}}var E=function(m){(0,a.default)(S,m);var w,v,A,I,B=_(S);function S(P){var C,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},H=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,S);var N=j.autoconnect,c=N===void 0||N,p=j.reconnect,x=p===void 0||p,g=j.reconnect_interval,h=g===void 0?1e3:g,y=j.max_reconnects,L=y===void 0?5:y,F=function(K,V){var W={};for(var Z in K)Object.prototype.hasOwnProperty.call(K,Z)&&V.indexOf(Z)<0&&(W[Z]=K[Z]);if(K!=null&&typeof Object.getOwnPropertySymbols=="function"){var G=0;for(Z=Object.getOwnPropertySymbols(K);GR.current_reconnects||R.max_reconnects===0)&&(R.reconnect_timer_id=setTimeout(function(){return R._connect(P,C)},R.reconnect_interval)))})}}]),S}(d.EventEmitter);r.default=E})(W6);var OS=_i(W6),t3={};(function(r){var e=G6;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(l,d){return new u(l,d)};var t=e(Y6()),n=e(J6()),i=e(X6()),o=e(Q6()),s=e(e3());function a(l){var d=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,E=(0,s.default)(l);if(d){var m=(0,s.default)(this).constructor;_=Reflect.construct(E,arguments,m)}else _=E.apply(this,arguments);return(0,o.default)(this,_)}}var u=function(l){(0,i.default)(_,l);var d=a(_);function _(E,m,w){var v;return(0,t.default)(this,_),(v=d.call(this)).socket=new window.WebSocket(E,w),v.socket.onopen=function(){return v.emit("open")},v.socket.onmessage=function(A){return v.emit("message",A.data)},v.socket.onerror=function(A){return v.emit("error",A)},v.socket.onclose=function(A){v.emit("close",A.code,A.reason)},v}return(0,n.default)(_,[{key:"send",value:function(E,m,w){var v=w||m;try{this.socket.send(E),v()}catch(A){v(A)}}},{key:"close",value:function(E,m){this.socket.close(E,m)}},{key:"addEventListener",value:function(E,m,w){this.socket.addEventListener(E,m,w)}}]),_}(q1().EventEmitter)})(t3);var RS=_i(t3);const[r3,n3,i3]=[[],[],[]],US=BigInt(0),mu=BigInt(1),NS=BigInt(2),DS=BigInt(7),zS=BigInt(256),jS=BigInt(113);for(let r=0,e=mu,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],r3.push(2*(5*n+t)),n3.push((r+1)*(r+2)/2%64);let i=US;for(let o=0;o<7;o++)e=(e<>DS)*jS)%zS,e&NS&&(i^=mu<<(mu<t>32?u6(r,e,t):s6(r,e,t),$m=(r,e,t)=>t>32?c6(r,e,t):a6(r,e,t);class H1 extends k1{constructor(e,t,n,i=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,sh(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var s;this.state=new Uint8Array(200),this.state32=(s=this.state,new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4)))}keccak(){(function(e,t=24){const n=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const u=(a+8)%10,l=(a+2)%10,d=n[l],_=n[l+1],E=Fm(d,_,1)^n[u],m=$m(d,_,1)^n[u+1];for(let w=0;w<50;w+=10)e[a+w]^=E,e[a+w+1]^=m}let o=e[2],s=e[3];for(let a=0;a<24;a++){const u=n3[a],l=Fm(o,s,u),d=$m(o,s,u),_=r3[a];o=e[_],s=e[_+1],e[_]=l,e[_+1]=d}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)n[u]=e[a+u];for(let u=0;u<10;u++)e[a+u]^=~n[(u+2)%10]&n[(u+4)%10]}e[0]^=FS[i],e[1]^=$S[i]}n.fill(0)})(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Fa(this);const{blockLen:t,state:n}=this,i=(e=sf(e)).length;for(let o=0;o=n&&this.keccak();const s=Math.min(n-this.posOut,o-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return sh(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(e6(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:t,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return e||(e=new H1(t,n,i,s,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}const Km=((r,e,t)=>S1(()=>new H1(e,r,t)))(1,136,32),{bytesToNumberBE:KS,hexToBytes:VS}=zk,vs={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:e}=vs;if(r.length<2||r[0]!==2)throw new e("Invalid signature integer tag");const t=r[1],n=r.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(128&n[0])throw new e("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:KS(n),l:r.subarray(t+2)}},toSig(r){const{Err:e}=vs,t=typeof r=="string"?VS(r):r;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=vs._parseInt(t.subarray(2)),{d:s,l:a}=vs._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(r){const e=l=>8&Number.parseInt(l[0],16)?"00"+l:l,t=l=>{const d=l.toString(16);return 1&d.length?`0${d}`:d},n=e(t(r.s)),i=e(t(r.r)),o=n.length/2,s=i.length/2,a=t(o),u=t(s);return`30${t(s+o+4)}02${u}${i}02${a}${n}`}},fo=BigInt(0),Xn=BigInt(1);BigInt(2);const Vm=BigInt(3);function qS(r){const e=function(w){const v=M1(w);Ka(v,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:A,Fp:I,a:B}=v;if(A){if(!I.eql(B,I.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof A!="object"||typeof A.beta!="bigint"||typeof A.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...v})}(r),{Fp:t}=e,n=e.toBytes||((w,v,A)=>{const I=v.toAffine();return zs(Uint8Array.from([4]),t.toBytes(I.x),t.toBytes(I.y))}),i=e.fromBytes||(w=>{const v=w.subarray(1);return{x:t.fromBytes(v.subarray(0,t.BYTES)),y:t.fromBytes(v.subarray(t.BYTES,2*t.BYTES))}});function o(w){const{a:v,b:A}=e,I=t.sqr(w),B=t.mul(I,w);return t.add(t.add(B,t.mul(w,v)),A)}if(!t.eql(t.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(w){return typeof w=="bigint"&&fot.eql(S,t.ZERO);return B(A)&&B(I)?_.ZERO:new _(A,I,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const A=t.invertBatch(v.map(I=>I.pz));return v.map((I,B)=>I.toAffine(A[B])).map(_.fromAffine)}static fromHex(v){const A=_.fromAffine(i(zr("pointHex",v)));return A.assertValidity(),A}static fromPrivateKey(v){return _.BASE.multiply(u(v))}_setWindowSize(v){this._WINDOW_SIZE=v,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:v,y:A}=this.toAffine();if(!t.isValid(v)||!t.isValid(A))throw new Error("bad point: x or y not FE");const I=t.sqr(A),B=o(v);if(!t.eql(I,B))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(t.isOdd)return!t.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){d(v);const{px:A,py:I,pz:B}=this,{px:S,py:P,pz:C}=v,R=t.eql(t.mul(A,C),t.mul(S,B)),j=t.eql(t.mul(I,C),t.mul(P,B));return R&&j}negate(){return new _(this.px,t.neg(this.py),this.pz)}double(){const{a:v,b:A}=e,I=t.mul(A,Vm),{px:B,py:S,pz:P}=this;let C=t.ZERO,R=t.ZERO,j=t.ZERO,H=t.mul(B,B),N=t.mul(S,S),c=t.mul(P,P),p=t.mul(B,S);return p=t.add(p,p),j=t.mul(B,P),j=t.add(j,j),C=t.mul(v,j),R=t.mul(I,c),R=t.add(C,R),C=t.sub(N,R),R=t.add(N,R),R=t.mul(C,R),C=t.mul(p,C),j=t.mul(I,j),c=t.mul(v,c),p=t.sub(H,c),p=t.mul(v,p),p=t.add(p,j),j=t.add(H,H),H=t.add(j,H),H=t.add(H,c),H=t.mul(H,p),R=t.add(R,H),c=t.mul(S,P),c=t.add(c,c),H=t.mul(c,p),C=t.sub(C,H),j=t.mul(c,N),j=t.add(j,j),j=t.add(j,j),new _(C,R,j)}add(v){d(v);const{px:A,py:I,pz:B}=this,{px:S,py:P,pz:C}=v;let R=t.ZERO,j=t.ZERO,H=t.ZERO;const N=e.a,c=t.mul(e.b,Vm);let p=t.mul(A,S),x=t.mul(I,P),g=t.mul(B,C),h=t.add(A,I),y=t.add(S,P);h=t.mul(h,y),y=t.add(p,x),h=t.sub(h,y),y=t.add(A,B);let L=t.add(S,C);return y=t.mul(y,L),L=t.add(p,g),y=t.sub(y,L),L=t.add(I,B),R=t.add(P,C),L=t.mul(L,R),R=t.add(x,g),L=t.sub(L,R),H=t.mul(N,y),R=t.mul(c,g),H=t.add(R,H),R=t.sub(x,H),H=t.add(x,H),j=t.mul(R,H),x=t.add(p,p),x=t.add(x,p),g=t.mul(N,g),y=t.mul(c,y),x=t.add(x,g),g=t.sub(p,g),g=t.mul(N,g),y=t.add(y,g),p=t.mul(x,y),j=t.add(j,p),p=t.mul(L,y),R=t.mul(h,R),R=t.sub(R,p),p=t.mul(h,x),H=t.mul(L,H),H=t.add(H,p),new _(R,j,H)}subtract(v){return this.add(v.negate())}is0(){return this.equals(_.ZERO)}wNAF(v){return m.wNAFCached(this,l,v,A=>{const I=t.invertBatch(A.map(B=>B.pz));return A.map((B,S)=>B.toAffine(I[S])).map(_.fromAffine)})}multiplyUnsafe(v){const A=_.ZERO;if(v===fo)return A;if(a(v),v===Xn)return this;const{endo:I}=e;if(!I)return m.unsafeLadder(this,v);let{k1neg:B,k1:S,k2neg:P,k2:C}=I.splitScalar(v),R=A,j=A,H=this;for(;S>fo||C>fo;)S&Xn&&(R=R.add(H)),C&Xn&&(j=j.add(H)),H=H.double(),S>>=Xn,C>>=Xn;return B&&(R=R.negate()),P&&(j=j.negate()),j=new _(t.mul(j.px,I.beta),j.py,j.pz),R.add(j)}multiply(v){a(v);let A,I,B=v;const{endo:S}=e;if(S){const{k1neg:P,k1:C,k2neg:R,k2:j}=S.splitScalar(B);let{p:H,f:N}=this.wNAF(C),{p:c,f:p}=this.wNAF(j);H=m.constTimeNegate(P,H),c=m.constTimeNegate(R,c),c=new _(t.mul(c.px,S.beta),c.py,c.pz),A=H.add(c),I=N.add(p)}else{const{p:P,f:C}=this.wNAF(B);A=P,I=C}return _.normalizeZ([A,I])[0]}multiplyAndAddUnsafe(v,A,I){const B=_.BASE,S=(C,R)=>R!==fo&&R!==Xn&&C.equals(B)?C.multiply(R):C.multiplyUnsafe(R),P=S(this,A).add(S(v,I));return P.is0()?void 0:P}toAffine(v){const{px:A,py:I,pz:B}=this,S=this.is0();v==null&&(v=S?t.ONE:t.inv(B));const P=t.mul(A,v),C=t.mul(I,v),R=t.mul(B,v);if(S)return{x:t.ZERO,y:t.ZERO};if(!t.eql(R,t.ONE))throw new Error("invZ was invalid");return{x:P,y:C}}isTorsionFree(){const{h:v,isTorsionFree:A}=e;if(v===Xn)return!0;if(A)return A(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:v,clearCofactor:A}=e;return v===Xn?this:A?A(_,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),n(_,this,v)}toHex(v=!0){return Ds(this.toRawBytes(v))}}_.BASE=new _(e.Gx,e.Gy,t.ONE),_.ZERO=new _(t.ZERO,t.ONE,t.ZERO);const E=e.nBitLength,m=p6(_,e.endo?Math.ceil(E/2):E);return{CURVE:e,ProjectivePoint:_,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}function HS(r){const e=function(N){const c=M1(N);return Ka(c,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...c})}(r),{Fp:t,n}=e,i=t.BYTES+1,o=2*t.BYTES+1;function s(N){return wr(N,n)}function a(N){return D0(N,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:_}=qS({...e,toBytes(N,c,p){const x=c.toAffine(),g=t.toBytes(x.x),h=zs;return p?h(Uint8Array.from([c.hasEvenY()?2:3]),g):h(Uint8Array.from([4]),g,t.toBytes(x.y))},fromBytes(N){const c=N.length,p=N[0],x=N.subarray(1);if(c!==i||p!==2&&p!==3){if(c===o&&p===4)return{x:t.fromBytes(x.subarray(0,t.BYTES)),y:t.fromBytes(x.subarray(t.BYTES,2*t.BYTES))};throw new Error(`Point of length ${c} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const h=bs(x);if(!(fo<(g=h)&&gDs(xa(N,e.nByteLength));function m(N){return N>n>>Xn}const w=(N,c,p)=>bs(N.slice(c,p));class v{constructor(c,p,x){this.r=c,this.s=p,this.recovery=x,this.assertValidity()}static fromCompact(c){const p=e.nByteLength;return c=zr("compactSignature",c,2*p),new v(w(c,0,p),w(c,p,2*p))}static fromDER(c){const{r:p,s:x}=vs.toSig(zr("DER",c));return new v(p,x)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(c){return new v(this.r,this.s,c)}recoverPublicKey(c){const{r:p,s:x,recovery:g}=this,h=S(zr("msgHash",c));if(g==null||![0,1,2,3].includes(g))throw new Error("recovery id invalid");const y=g===2||g===3?p+e.n:p;if(y>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const L=1&g?"03":"02",F=u.fromHex(L+E(y)),K=a(y),V=s(-h*K),W=s(x*K),Z=u.BASE.multiplyAndAddUnsafe(F,V,W);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return $a(this.toDERHex())}toDERHex(){return vs.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return $a(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const A={isValidPrivateKey(N){try{return l(N),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const N=om(e.n);return function(c,p,x=!1){const g=c.length,h=d6(p),y=om(p);if(g<16||g1024)throw new Error(`expected ${y}-1024 bytes of input, got ${g}`);const L=wr(x?bs(c):Ea(c),p-Er)+Er;return x?sc(L,h):xa(L,h)}(e.randomBytes(N),e.n)},precompute:(N=8,c=u.BASE)=>(c._setWindowSize(N),c.multiply(BigInt(3)),c)};function I(N){const c=N instanceof Uint8Array,p=typeof N=="string",x=(c||p)&&N.length;return c?x===i||x===o:p?x===2*i||x===2*o:N instanceof u}const B=e.bits2int||function(N){const c=bs(N),p=8*N.length-e.nBitLength;return p>0?c>>BigInt(p):c},S=e.bits2int_modN||function(N){return s(B(N))},P=B1(e.nBitLength);function C(N){if(typeof N!="bigint")throw new Error("bigint expected");if(!(fo<=N&&NG in p))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:g}=e;let{lowS:h,prehash:y,extraEntropy:L}=p;h==null&&(h=!0),N=zr("msgHash",N),y&&(N=zr("prehashed msgHash",x(N)));const F=S(N),K=l(c),V=[C(K),C(F)];if(L!=null){const G=L===!0?g(t.BYTES):L;V.push(zr("extraEntropy",G))}const W=zs(...V),Z=F;return{seed:W,k2sig:function(G){const ne=B(G);if(!_(ne))return;const X=a(ne),te=u.BASE.multiply(ne).toAffine(),ge=s(te.x);if(ge===fo)return;const ce=s(X*s(Z+ge*K));if(ce===fo)return;let we=(te.x===ge?0:2)|Number(te.y&Xn),$e=ce;return h&&m(ce)&&($e=function(be){return m(be)?s(-be):be}(ce),we^=1),new v(ge,$e,we)}}}const j={lowS:e.lowS,prehash:!1},H={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(N,c=!0){return u.fromPrivateKey(N).toRawBytes(c)},getSharedSecret:function(N,c,p=!0){if(I(N))throw new Error("first arg must be private key");if(!I(c))throw new Error("second arg must be public key");return u.fromHex(c).multiply(l(N)).toRawBytes(p)},sign:function(N,c,p=j){const{seed:x,k2sig:g}=R(N,c,p),h=e;return l6(h.hash.outputLen,h.nByteLength,h.hmac)(x,g)},verify:function(N,c,p,x=H){var te;const g=N;if(c=zr("msgHash",c),p=zr("publicKey",p),"strict"in x)throw new Error("options.strict was renamed to lowS");const{lowS:h,prehash:y}=x;let L,F;try{if(typeof g=="string"||g instanceof Uint8Array)try{L=v.fromDER(g)}catch(ge){if(!(ge instanceof vs.Err))throw ge;L=v.fromCompact(g)}else{if(typeof g!="object"||typeof g.r!="bigint"||typeof g.s!="bigint")throw new Error("PARSE");{const{r:ge,s:ce}=g;L=new v(ge,ce)}}F=u.fromHex(p)}catch(ge){if(ge.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(h&&L.hasHighS())return!1;y&&(c=e.hash(c));const{r:K,s:V}=L,W=S(c),Z=a(V),G=s(W*Z),ne=s(K*Z),X=(te=u.BASE.multiplyAndAddUnsafe(F,G,ne))==null?void 0:te.toAffine();return!!X&&s(X.x)===K},ProjectivePoint:u,Signature:v,utils:A}}BigInt(4);class o3 extends k1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(s){if(typeof s!="function"||typeof s.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");sh(s.outputLen),sh(s.blockLen)}(e);const n=sf(t);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,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;snew o3(r,e).update(t).digest();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function WS(r){return{hash:r,hmac:(e,...t)=>s3(r,e,Pk(...t)),randomBytes:r6}}s3.create=(r,e)=>new o3(r,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qm=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Hm=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ZS=BigInt(1),V0=BigInt(2),Wm=(r,e)=>(r+e/V0)/e,q0=f6(qm,void 0,void 0,{sqrt:function(r){const e=qm,t=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),l=r*r*r%e,d=l*l*r%e,_=Ir(d,t,e)*d%e,E=Ir(_,t,e)*d%e,m=Ir(E,V0,e)*l%e,w=Ir(m,i,e)*m%e,v=Ir(w,o,e)*w%e,A=Ir(v,a,e)*v%e,I=Ir(A,u,e)*A%e,B=Ir(I,a,e)*v%e,S=Ir(B,t,e)*d%e,P=Ir(S,s,e)*w%e,C=Ir(P,n,e)*l%e,R=Ir(C,V0,e);if(!q0.eql(q0.sqr(R),r))throw new Error("Cannot find square root");return R}}),hf=function(r,e){const t=n=>HS({...r,...WS(n)});return Object.freeze({...t(e),create:t})}({a:BigInt(0),b:BigInt(7),Fp:q0,n:Hm,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const e=Hm,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ZS*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=t,s=BigInt("0x100000000000000000000000000000000"),a=Wm(o*r,e),u=Wm(-n*r,e);let l=wr(r-a*t-u*i,e),d=wr(-a*n-u*o,e);const _=l>s,E=d>s;if(_&&(l=e-l),E&&(d=e-d),l>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:_,k1:l,k2neg:E,k2:d}}}},js);BigInt(0),hf.ProjectivePoint;const GS=ru.utils.randomPrivateKey,Zm=()=>{const r=ru.utils.randomPrivateKey(),e=dh(r),t=new Uint8Array(64);return t.set(r),t.set(e,32),{publicKey:e,secretKey:t}},dh=ru.getPublicKey;function Gm(r){try{return ru.ExtendedPoint.fromHex(r),!0}catch{return!1}}const W1=(r,e)=>ru.sign(r,e.slice(0,32)),YS=ru.verify,Ut=r=>Ze.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Ze.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Ze.Buffer.from(r);class H0{constructor(e){Object.assign(this,e)}encode(){return Ze.Buffer.from(C1(Hu,this))}static decode(e){return E6(Hu,this,e)}static decodeUnchecked(e){return w6(Hu,this,e)}}const Hu=new Map;var Ym;let a3;const Vn=32;let Jm=1;a3=Symbol.toStringTag;class ye extends H0{constructor(e){if(super({}),this._bn=void 0,function(t){return t._bn!==void 0}(e))this._bn=e._bn;else{if(typeof e=="string"){const t=on.decode(e);if(t.length!=Vn)throw new Error("Invalid public key input");this._bn=new ac(t)}else this._bn=new ac(e);if(this._bn.byteLength()>Vn)throw new Error("Invalid public key input")}}static unique(){const e=new ye(Jm);return Jm+=1,new ye(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return on.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(Ze.Buffer);if(e.length===Vn)return e;const t=Ze.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[a3](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,n){const i=Ze.Buffer.concat([e.toBuffer(),Ze.Buffer.from(t),n.toBuffer()]),o=js(i);return new ye(o)}static createProgramAddressSync(e,t){let n=Ze.Buffer.alloc(0);e.forEach(function(o){if(o.length>32)throw new TypeError("Max seed length exceeded");n=Ze.Buffer.concat([n,Ut(o)])}),n=Ze.Buffer.concat([n,t.toBuffer(),Ze.Buffer.from("ProgramDerivedAddress")]);const i=js(n);if(Gm(i))throw new Error("Invalid seeds, address must fall off the curve");return new ye(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let n,i=255;for(;i!=0;){try{const o=e.concat(Ze.Buffer.from([i]));n=this.createProgramAddressSync(o,t)}catch(o){if(o instanceof TypeError)throw o;i--;continue}return[n,i]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return Gm(new ye(e).toBytes())}}Ym=ye,ye.default=new Ym("11111111111111111111111111111111"),Hu.set(ye,{kind:"struct",fields:[["_bn","u256"]]});const JS=new ye("BPFLoader1111111111111111111111111111111111"),Aa=1232,ff=127,Va=64;class W0 extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(W0.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class Z0 extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(Z0.prototype,"name",{value:"TransactionExpiredTimeoutError"});class fa extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(fa.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class lc{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e256)throw new Error("Account index overflow encountered during compilation");const t=new Map;this.keySegments().flat().forEach((i,o)=>{t.set(i.toBase58(),o)});const n=i=>{const o=t.get(i.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return e.map(i=>({programIdIndex:n(i.programId),accountKeyIndexes:i.keys.map(o=>n(o.pubkey)),data:i.data}))}}const $t=(r="publicKey")=>lr(32,r),XS=(r="signature")=>lr(64,r),_s=(r="string")=>{const e=rt([Qe("length"),Qe("lengthPadding"),lr(Ko(Qe(),-8),"chars")],r),t=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(o,s)=>t(o,s).chars.toString(),i.encode=(o,s,a)=>{const u={chars:Ze.Buffer.from(o,"utf8")};return n(u,s,a)},i.alloc=o=>Qe().span+Qe().span+Ze.Buffer.from(o,"utf8").length,i};function u3(r,e){const t=i=>{if(i.span>=0)return i.span;if(typeof i.alloc=="function")return i.alloc(e[i.property]);if("count"in i&&"elementLayout"in i){const o=e[i.property];if(Array.isArray(o))return o.length*t(i.elementLayout)}else if("fields"in i)return u3({layout:i},e[i.property]);return 0};let n=0;return r.layout.fields.forEach(i=>{n+=t(i)}),n}function _n(r){let e=0,t=0;for(;;){let n=r.shift();if(e|=(127&n)<<7*t,t+=1,(128&n)==0)break}return e}function jn(r,e){let t=e;for(;;){let n=127&t;if(t>>=7,t==0){r.push(n);break}n|=128,r.push(n)}}function Yt(r,e){if(!r)throw new Error(e||"Assertion failed")}class df{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const n=new Map,i=s=>{const a=s.toBase58();let u=n.get(a);return u===void 0&&(u={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(a,u)),u},o=i(t);o.isSigner=!0,o.isWritable=!0;for(const s of e){i(s.programId).isInvoked=!0;for(const a of s.keys){const u=i(a.pubkey);u.isSigner||(u.isSigner=a.isSigner),u.isWritable||(u.isWritable=a.isWritable)}}return new df(t,n)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];Yt(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,a])=>a.isSigner&&a.isWritable),n=e.filter(([,a])=>a.isSigner&&!a.isWritable),i=e.filter(([,a])=>!a.isSigner&&a.isWritable),o=e.filter(([,a])=>!a.isSigner&&!a.isWritable),s={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:o.length};{Yt(t.length>0,"Expected at least one writable signer key");const[a]=t[0];Yt(a===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...t.map(([a])=>new ye(a)),...n.map(([a])=>new ye(a)),...i.map(([a])=>new ye(a)),...o.map(([a])=>new ye(a))]]}extractTableLookup(e){const[t,n]=this.drainKeysFoundInLookupTable(e.state.addresses,s=>!s.isSigner&&!s.isInvoked&&s.isWritable),[i,o]=this.drainKeysFoundInLookupTable(e.state.addresses,s=>!s.isSigner&&!s.isInvoked&&!s.isWritable);if(t.length!==0||i.length!==0)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:i},{writable:n,readonly:o}]}drainKeysFoundInLookupTable(e,t){const n=new Array,i=new Array;for(const[o,s]of this.keyMetaMap.entries())if(t(s)){const a=new ye(o),u=e.findIndex(l=>l.equals(a));u>=0&&(Yt(u<256,"Max lookup table index exceeded"),n.push(u),i.push(a),this.keyMetaMap.delete(o))}return[n,i]}}let qo=class G0{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new ye(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:on.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new lc(this.staticAccountKeys)}static compile(e){const t=df.compile(e.instructions,e.payerKey),[n,i]=t.getMessageComponents(),o=new lc(i).compileInstructions(e.instructions).map(s=>({programIdIndex:s.programIdIndex,accounts:s.accountKeyIndexes,data:on.encode(s.data)}));return new G0({header:n,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:o})}isAccountSigner(e){return e=this.header.numRequiredSignatures?e-t!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];jn(t,e);const n=this.instructions.map(_=>{const{accounts:E,programIdIndex:m}=_,w=Array.from(on.decode(_.data));let v=[];jn(v,E.length);let A=[];return jn(A,w.length),{programIdIndex:m,keyIndicesCount:Ze.Buffer.from(v),keyIndices:E,dataLength:Ze.Buffer.from(A),data:w}});let i=[];jn(i,n.length);let o=Ze.Buffer.alloc(Aa);Ze.Buffer.from(i).copy(o);let s=i.length;n.forEach(_=>{const E=rt([jt("programIdIndex"),lr(_.keyIndicesCount.length,"keyIndicesCount"),sn(jt("keyIndex"),_.keyIndices.length,"keyIndices"),lr(_.dataLength.length,"dataLength"),sn(jt("userdatum"),_.data.length,"data")]).encode(_,o,s);s+=E}),o=o.slice(0,s);const a=rt([lr(1,"numRequiredSignatures"),lr(1,"numReadonlySignedAccounts"),lr(1,"numReadonlyUnsignedAccounts"),lr(t.length,"keyCount"),sn($t("key"),e,"keys"),$t("recentBlockhash")]),u={numRequiredSignatures:Ze.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ze.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ze.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ze.Buffer.from(t),keys:this.accountKeys.map(_=>Ut(_.toBytes())),recentBlockhash:on.decode(this.recentBlockhash)};let l=Ze.Buffer.alloc(2048);const d=a.encode(u,l);return o.copy(l,d),l.slice(0,d+o.length)}static from(e){let t=[...e];const n=t.shift();if(n!==(n&ff))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=t.shift(),o=t.shift(),s=_n(t);let a=[];for(let E=0;E0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new lc(this.staticAccountKeys,t)}isAccountSigner(e){return e=n){const i=e-n,o=this.addressTableLookups.reduce((s,a)=>s+a.writableIndexes.length,0);return i=this.header.numRequiredSignatures?e-to.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const o of n.writableIndexes){if(!(ol.toBytes()),recentBlockhash:on.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(o),serializedAddressTableLookups:i},a);return a.slice(0,u)}serializeInstructions(){let e=0;const t=new Uint8Array(Aa);for(const n of this.compiledInstructions){const i=Array();jn(i,n.accountKeyIndexes.length);const o=Array();jn(o,n.data.length),e+=rt([jt("programIdIndex"),lr(i.length,"encodedAccountKeyIndexesLength"),sn(jt(),n.accountKeyIndexes.length,"accountKeyIndexes"),lr(o.length,"encodedDataLength"),lr(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(o),data:n.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array(Aa);for(const n of this.addressTableLookups){const i=Array();jn(i,n.writableIndexes.length);const o=Array();jn(o,n.readonlyIndexes.length),e+=rt([$t("accountKey"),lr(i.length,"encodedWritableIndexesLength"),sn(jt(),n.writableIndexes.length,"writableIndexes"),lr(o.length,"encodedReadonlyIndexesLength"),sn(jt(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(o),readonlyIndexes:n.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const n=t.shift(),i=n&ff;Yt(n!==i,"Expected versioned message but received legacy message"),Yt(i===0,`Expected versioned message with version 0 but found version ${i}`);const o={numRequiredSignatures:t.shift(),numReadonlySignedAccounts:t.shift(),numReadonlyUnsignedAccounts:t.shift()},s=[],a=_n(t);for(let m=0;m{const e=Z1.deserializeMessageVersion(r);if(e==="legacy")return qo.from(r);if(e===0)return Fs.deserialize(r);throw new Error(`Transaction message version ${e} deserialization is not supported`)}};let Xi=function(r){return r[r.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",r[r.PROCESSED=1]="PROCESSED",r[r.TIMED_OUT=2]="TIMED_OUT",r[r.NONCE_INVALID=3]="NONCE_INVALID",r}({});const QS=Ze.Buffer.alloc(Va).fill(0);class rr{constructor(e){this.keys=void 0,this.programId=void 0,this.data=Ze.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:t,isWritable:n})=>({pubkey:e.toJSON(),isSigner:t,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class Gt{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:n}=e;this.minNonceContextSlot=t,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:n}=e;this.recentBlockhash=t,this.lastValidBlockHeight=n}else{const{recentBlockhash:t,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new rr(t))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let v=0;v{v.keys.forEach(I=>{o.push({...I})});const A=v.programId.toString();i.includes(A)||i.push(A)}),i.forEach(v=>{o.push({pubkey:new ye(v),isSigner:!1,isWritable:!1})});const s=[];o.forEach(v=>{const A=v.pubkey.toString(),I=s.findIndex(B=>B.pubkey.toString()===A);I>-1?(s[I].isWritable=s[I].isWritable||v.isWritable,s[I].isSigner=s[I].isSigner||v.isSigner):s.push(v)}),s.sort(function(v,A){return v.isSigner!==A.isSigner?v.isSigner?-1:1:v.isWritable!==A.isWritable?v.isWritable?-1:1:v.pubkey.toBase58().localeCompare(A.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const a=s.findIndex(v=>v.pubkey.equals(n));if(a>-1){const[v]=s.splice(a,1);v.isSigner=!0,v.isWritable=!0,s.unshift(v)}else s.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const v of this.signatures){const A=s.findIndex(I=>I.pubkey.equals(v.publicKey));if(!(A>-1))throw new Error(`unknown signer: ${v.publicKey.toString()}`);s[A].isSigner||(s[A].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let u=0,l=0,d=0;const _=[],E=[];s.forEach(({pubkey:v,isSigner:A,isWritable:I})=>{A?(_.push(v.toString()),u+=1,I||(l+=1)):(E.push(v.toString()),I||(d+=1))});const m=_.concat(E),w=t.map(v=>{const{data:A,programId:I}=v;return{programIdIndex:m.indexOf(I.toString()),accounts:v.keys.map(B=>m.indexOf(B.pubkey.toString())),data:on.encode(A)}});return w.forEach(v=>{Yt(v.programIdIndex>=0),v.accounts.forEach(A=>Yt(A>=0))}),new qo({header:{numRequiredSignatures:u,numReadonlySignedAccounts:l,numReadonlyUnsignedAccounts:d},accountKeys:m,recentBlockhash:e,instructions:w})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((i,o)=>t[o].equals(i.publicKey))||(this.signatures=t.map(n=>({signature:null,publicKey:n}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(n=>{const i=n.toString();return!t.has(i)&&(t.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,n=[];for(const o of e){const s=o.publicKey.toString();t.has(s)||(t.add(s),n.push(o))}this.signatures=n.map(o=>({signature:null,publicKey:o.publicKey}));const i=this._compile();this._partialSign(i,...n)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,n=[];for(const o of e){const s=o.publicKey.toString();t.has(s)||(t.add(s),n.push(o))}const i=this._compile();this._partialSign(i,...n)}_partialSign(e,...t){const n=e.serialize();t.forEach(i=>{const o=W1(n,i.secretKey);this._addSignature(i.publicKey,Ut(o))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){Yt(t.length===64);const n=this.signatures.findIndex(i=>e.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=Ze.Buffer.from(t)}verifySignatures(e){return this._verifySignatures(this.serializeMessage(),e===void 0||e)}_verifySignatures(e,t){for(const{signature:n,publicKey:i}of this.signatures)if(n===null){if(t)return!1}else if(!YS(n,e,i.toBytes()))return!1;return!0}serialize(e){const{requireAllSignatures:t,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(n&&!this._verifySignatures(i,t))throw new Error("Signature verification failed");return this._serialize(i)}_serialize(e){const{signatures:t}=this,n=[];jn(n,t.length);const i=n.length+64*t.length+e.length,o=Ze.Buffer.alloc(i);return Yt(t.length<256),Ze.Buffer.from(n).copy(o,0),t.forEach(({signature:s},a)=>{s!==null&&(Yt(s.length===64,"signature has invalid length"),Ze.Buffer.from(s).copy(o,n.length+64*a))}),e.copy(o,n.length+64*t.length),Yt(o.length<=Aa,`Transaction too large: ${o.length} > 1232`),o}get keys(){return Yt(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return Yt(this.instructions.length===1),this.instructions[0].programId}get data(){return Yt(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const n=_n(t);let i=[];for(let o=0;o0&&(n.feePayer=e.accountKeys[0]),t.forEach((i,o)=>{const s={signature:i==on.encode(QS)?null:on.decode(i),publicKey:e.accountKeys[o]};n.signatures.push(s)}),e.instructions.forEach(i=>{const o=i.accounts.map(s=>{const a=e.accountKeys[s];return{pubkey:a,isSigner:n.signatures.some(u=>u.publicKey.toString()===a.toString())||e.isAccountSigner(s),isWritable:e.isAccountWritable(s)}});n.instructions.push(new rr({keys:o,programId:e.accountKeys[i.programIdIndex],data:on.decode(i.data)}))}),n._message=e,n._json=n.toJSON(),n}}class G1{constructor(e){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,t){const{header:n,compiledInstructions:i,recentBlockhash:o}=e,{numRequiredSignatures:s,numReadonlySignedAccounts:a,numReadonlyUnsignedAccounts:u}=n,l=s-a;Yt(l>0,"Message header is invalid");const d=e.staticAccountKeys.length-s-u;Yt(d>=0,"Message header is invalid");const _=e.getAccountKeys(t),E=_.get(0);if(E===void 0)throw new Error("Failed to decompile message because no account keys were found");const m=[];for(const w of i){const v=[];for(const I of w.accountKeyIndexes){const B=_.get(I);if(B===void 0)throw new Error(`Failed to find key for account key index ${I}`);let S;S=Is.equals(i.publicKey));Yt(o>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[o]=W1(t,i.secretKey)}}addSignature(e,t){Yt(t.byteLength===64,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(i=>i.equals(e));Yt(n>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=t}}const gi=new ye("SysvarC1ock11111111111111111111111111111111"),e7=new ye("SysvarEpochSchedu1e111111111111111111111111"),t7=new ye("Sysvar1nstructions1111111111111111111111111"),Wl=new ye("SysvarRecentB1ockHashes11111111111111111111"),Jo=new ye("SysvarRent111111111111111111111111111111111"),r7=new ye("SysvarRewards111111111111111111111111111111"),n7=new ye("SysvarS1otHashes111111111111111111111111111"),i7=new ye("SysvarS1otHistory11111111111111111111111111"),Zl=new ye("SysvarStakeHistory1111111111111111111111111");async function Y0(r,e,t,n){const i=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},o=await r.sendTransaction(e,t,i);let s;if(e.recentBlockhash!=null&&e.lastValidBlockHeight!=null)s=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,signature:o,blockhash:e.recentBlockhash,lastValidBlockHeight:e.lastValidBlockHeight},n&&n.commitment)).value;else if(e.minNonceContextSlot!=null&&e.nonceInfo!=null){const{nonceInstruction:a}=e.nonceInfo,u=a.keys[0].pubkey;s=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,minContextSlot:e.minNonceContextSlot,nonceAccountPubkey:u,nonceValue:e.nonceInfo.nonce,signature:o},n&&n.commitment)).value}else(n==null?void 0:n.abortSignal)!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await r.confirmTransaction(o,n&&n.commitment)).value;if(s.err)throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`);return o}function fs(r){return new Promise(e=>setTimeout(e,r))}function Zt(r,e){const t=r.layout.span>=0?r.layout.span:u3(r,e),n=Ze.Buffer.alloc(t),i=Object.assign({instruction:r.index},e);return r.layout.encode(i,n),n}function ir(r,e){let t;try{t=r.layout.decode(e)}catch(n){throw new Error("invalid instruction; "+n)}if(t.instruction!==r.index)throw new Error(`invalid instruction; instruction index mismatch ${t.instruction} != ${r.index}`);return t}const c3=Xr("lamportsPerSignature"),l3=rt([Qe("version"),Qe("state"),$t("authorizedPubkey"),$t("nonce"),rt([c3],"feeCalculator")]),hc=l3.span;class ph{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=l3.decode(Ut(e),0);return new ph({authorizedPubkey:new ye(t.authorizedPubkey),nonce:new ye(t.nonce).toString(),feeCalculator:t.feeCalculator})}}const qa=(Ed=8,r=>{const e=lr(Ed,r),{encode:t,decode:n}=(o=>({decode:o.decode.bind(o),encode:o.encode.bind(o)}))(e),i=e;return i.decode=(o,s)=>{const a=n(o,s);return j6(Ze.Buffer.from(a))},i.encode=(o,s,a)=>{const u=F1(o,Ed);return t(u,s,a)},i});var Ed;const hr=Object.freeze({Create:{index:0,layout:rt([Qe("instruction"),zn("lamports"),zn("space"),$t("programId")])},Assign:{index:1,layout:rt([Qe("instruction"),$t("programId")])},Transfer:{index:2,layout:rt([Qe("instruction"),qa("lamports")])},CreateWithSeed:{index:3,layout:rt([Qe("instruction"),$t("base"),_s("seed"),zn("lamports"),zn("space"),$t("programId")])},AdvanceNonceAccount:{index:4,layout:rt([Qe("instruction")])},WithdrawNonceAccount:{index:5,layout:rt([Qe("instruction"),zn("lamports")])},InitializeNonceAccount:{index:6,layout:rt([Qe("instruction"),$t("authorized")])},AuthorizeNonceAccount:{index:7,layout:rt([Qe("instruction"),$t("authorized")])},Allocate:{index:8,layout:rt([Qe("instruction"),zn("space")])},AllocateWithSeed:{index:9,layout:rt([Qe("instruction"),$t("base"),_s("seed"),zn("space"),$t("programId")])},AssignWithSeed:{index:10,layout:rt([Qe("instruction"),$t("base"),_s("seed"),$t("programId")])},TransferWithSeed:{index:11,layout:rt([Qe("instruction"),qa("lamports"),_s("seed"),$t("programId")])},UpgradeNonceAccount:{index:12,layout:rt([Qe("instruction")])}});class Cr{constructor(){}static createAccount(e){const t=Zt(hr.Create,{lamports:e.lamports,space:e.space,programId:Ut(e.programId.toBuffer())});return new rr({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,n;return"basePubkey"in e?(t=Zt(hr.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:Ut(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=Zt(hr.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]),new rr({keys:n,programId:this.programId,data:t})}static assign(e){let t,n;return"basePubkey"in e?(t=Zt(hr.AssignWithSeed,{base:Ut(e.basePubkey.toBuffer()),seed:e.seed,programId:Ut(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=Zt(hr.Assign,{programId:Ut(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new rr({keys:n,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=Zt(hr.CreateWithSeed,{base:Ut(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:Ut(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new rr({keys:n,programId:this.programId,data:t})}static createNonceAccount(e){const t=new Gt;"basePubkey"in e&&"seed"in e?t.add(Cr.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:hc,programId:this.programId})):t.add(Cr.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:hc,programId:this.programId}));const n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(n)),t}static nonceInitialize(e){const t=Zt(hr.InitializeNonceAccount,{authorized:Ut(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Wl,isSigner:!1,isWritable:!1},{pubkey:Jo,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new rr(n)}static nonceAdvance(e){const t=Zt(hr.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Wl,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new rr(n)}static nonceWithdraw(e){const t=Zt(hr.WithdrawNonceAccount,{lamports:e.lamports});return new rr({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Wl,isSigner:!1,isWritable:!1},{pubkey:Jo,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){const t=Zt(hr.AuthorizeNonceAccount,{authorized:Ut(e.newAuthorizedPubkey.toBuffer())});return new rr({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,n;return"basePubkey"in e?(t=Zt(hr.AllocateWithSeed,{base:Ut(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:Ut(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=Zt(hr.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new rr({keys:n,programId:this.programId,data:t})}}Cr.programId=new ye("11111111111111111111111111111111");class Ts{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/Ts.chunkSize)+1+1)}static async load(e,t,n,i,o){{const _=await e.getMinimumBalanceForRentExemption(o.length),E=await e.getAccountInfo(n.publicKey,"confirmed");let m=null;if(E!==null){if(E.executable)return console.error("Program load failed, account is already executable"),!1;E.data.length!==o.length&&(m=m||new Gt,m.add(Cr.allocate({accountPubkey:n.publicKey,space:o.length}))),E.owner.equals(i)||(m=m||new Gt,m.add(Cr.assign({accountPubkey:n.publicKey,programId:i}))),E.lamports<_&&(m=m||new Gt,m.add(Cr.transfer({fromPubkey:t.publicKey,toPubkey:n.publicKey,lamports:_-E.lamports})))}else m=new Gt().add(Cr.createAccount({fromPubkey:t.publicKey,newAccountPubkey:n.publicKey,lamports:_>0?_:1,space:o.length,programId:i}));m!==null&&await Y0(e,m,[t,n],{commitment:"confirmed"})}const s=rt([Qe("instruction"),Qe("offset"),Qe("bytesLength"),Qe("bytesLengthPadding"),sn(jt("byte"),Ko(Qe(),-8),"bytes")]),a=Ts.chunkSize;let u=0,l=o,d=[];for(;l.length>0;){const _=l.slice(0,a),E=Ze.Buffer.alloc(a+16);s.encode({instruction:0,offset:u,bytes:_,bytesLength:0,bytesLengthPadding:0},E);const m=new Gt().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:E});d.push(Y0(e,m,[t,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await fs(1e3/4),u+=a,l=l.slice(a)}await Promise.all(d);{const _=rt([Qe("instruction")]),E=Ze.Buffer.alloc(_.span);_.encode({instruction:1},E);const m=new Gt().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:Jo,isSigner:!1,isWritable:!1}],programId:i,data:E}),w="processed",v=await e.sendTransaction(m,[t,n],{preflightCommitment:w}),{context:A,value:I}=await e.confirmTransaction({signature:v,lastValidBlockHeight:m.lastValidBlockHeight,blockhash:m.recentBlockhash},w);if(I.err)throw new Error(`Transaction ${v} failed (${JSON.stringify(I)})`);for(;;){try{if(await e.getSlot({commitment:w})>A.slot)break}catch{}await new Promise(B=>setTimeout(B,Math.round(200)))}}return!0}}Ts.chunkSize=932;const o7=new ye("BPFLoader2111111111111111111111111111111111");function s7(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var a7=Object.prototype.toString,u7=Object.keys||function(r){var e=[];for(var t in r)e.push(t);return e};function Ku(r,e){var t,n,i,o,s,a,u;if(r===!0)return"true";if(r===!1)return"false";switch(typeof r){case"object":if(r===null)return null;if(r.toJSON&&typeof r.toJSON=="function")return Ku(r.toJSON(),e);if((u=a7.call(r))==="[object Array]"){for(i="[",n=r.length-1,t=0;t-1&&(i+=Ku(r[t],!0)),i+"]"}if(u==="[object Object]"){for(n=(o=u7(r).sort()).length,i="",t=0;t1;)r/=2,e++;return e}class Qm{constructor(e,t,n,i,o){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=n,this.firstNormalEpoch=i,this.firstNormalSlot=o}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,1+(n|=n>>32))}(e+32+1))-xd(32)-1;return[t,e-(this.getSlotsInEpoch(t)-32)]}{const t=e-this.firstNormalSlot,n=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+n,t%this.slotsPerEpoch]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e{const o=RS(i,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return this.underlyingSocket="socket"in o?o.socket:o,o},e,t,n),this.underlyingSocket=void 0}call(...e){var n;const t=(n=this.underlyingSocket)==null?void 0:n.readyState;return t===1?super.call(...e):Promise.reject(new Error("Tried to call a JSON-RPC method `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(...e){var n;const t=(n=this.underlyingSocket)==null?void 0:n.readyState;return t===1?super.notify(...e):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+e[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class Ad{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const t=function(s,a){let u;try{u=s.layout.decode(a)}catch(l){throw new Error("invalid instruction; "+l)}if(u.typeIndex!==s.index)throw new Error(`invalid account data; account type mismatch ${u.typeIndex} != ${s.index}`);return u}(h7,e),n=e.length-56;Yt(n>=0,"lookup table is invalid"),Yt(n%32==0,"lookup table is invalid");const i=n/32,{addresses:o}=rt([sn($t(),i,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:t.authority.length!==0?new ye(t.authority[0]):void 0,addresses:o.map(s=>new ye(s))}}}const h7={index:1,layout:rt([Qe("typeIndex"),qa("deactivationSlot"),Xr("lastExtendedSlot"),jt("lastExtendedStartIndex"),jt(),sn($t(),Ko(jt(),-1),"authority")])},f7=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,Rr=qc(K1(ye),Ve(),r=>new ye(r)),h3=V1([Ve(),xr("base64")]),J1=qc(K1(Ze.Buffer),h3,r=>Ze.Buffer.from(r[0],"base64"));function gr(r){let e,t;if(typeof r=="string")e=r;else if(r){const{commitment:n,...i}=r;e=n,t=i}return{commitment:e,config:t}}function f3(r){return Mn([Be({jsonrpc:xr("2.0"),id:Ve(),result:r}),Be({jsonrpc:xr("2.0"),id:Ve(),error:Be({code:Vc(),message:Ve(),data:At(Zs("any",()=>!0))})})])}const d7=f3(Vc());function Rt(r){return qc(f3(r),d7,e=>"error"in e?e:{...e,result:We(e.result,r)})}function Mr(r){return Rt(Be({context:Be({slot:ae()}),value:r}))}function pf(r){return Be({context:Be({slot:ae()}),value:r})}function kd(r,e){return r===0?new Fs({header:e.header,staticAccountKeys:e.accountKeys.map(t=>new ye(t)),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:on.decode(t.data)})),addressTableLookups:e.addressTableLookups}):new qo(e)}const p7=Be({foundation:ae(),foundationTerm:ae(),initial:ae(),taper:ae(),terminal:ae()}),g7=Rt(Ge(Ye(Be({epoch:ae(),effectiveSlot:ae(),amount:ae(),postBalance:ae(),commission:At(Ye(ae()))})))),y7=Ge(Be({slot:ae(),prioritizationFee:ae()})),m7=Be({total:ae(),validator:ae(),foundation:ae(),epoch:ae()}),w7=Be({epoch:ae(),slotIndex:ae(),slotsInEpoch:ae(),absoluteSlot:ae(),blockHeight:At(ae()),transactionCount:At(ae())}),b7=Be({slotsPerEpoch:ae(),leaderScheduleSlotOffset:ae(),warmup:Wi(),firstNormalEpoch:ae(),firstNormalSlot:ae()}),v7=K6(Ve(),Ge(ae())),Gs=Ye(Mn([Be({}),Ve()])),_7=Be({err:Gs}),E7=xr("receivedSignature"),x7=Be({"solana-core":Ve(),"feature-set":At(ae())}),ew=Mr(Be({err:Ye(Mn([Be({}),Ve()])),logs:Ye(Ge(Ve())),accounts:At(Ye(Ge(Ye(Be({executable:Wi(),owner:Ve(),lamports:ae(),data:Ge(Ve()),rentEpoch:At(ae())}))))),unitsConsumed:At(ae()),returnData:At(Ye(Be({programId:Ve(),data:V1([Ve(),xr("base64")])})))})),A7=Mr(Be({byIdentity:K6(Ve(),Ge(ae())),range:Be({firstSlot:ae(),lastSlot:ae()})})),k7=Rt(p7),S7=Rt(m7),I7=Rt(y7),B7=Rt(w7),M7=Rt(b7),P7=Rt(v7),L7=Rt(ae()),C7=Mr(Be({total:ae(),circulating:ae(),nonCirculating:ae(),nonCirculatingAccounts:Ge(Rr)})),J0=Be({amount:Ve(),uiAmount:Ye(ae()),decimals:ae(),uiAmountString:At(Ve())}),T7=Mr(Ge(Be({address:Rr,amount:Ve(),uiAmount:Ye(ae()),decimals:ae(),uiAmountString:At(Ve())}))),O7=Mr(Ge(Be({pubkey:Rr,account:Be({executable:Wi(),owner:Rr,lamports:ae(),data:J1,rentEpoch:ae()})}))),X0=Be({program:Ve(),parsed:Vc(),space:ae()}),R7=Mr(Ge(Be({pubkey:Rr,account:Be({executable:Wi(),owner:Rr,lamports:ae(),data:X0,rentEpoch:ae()})}))),U7=Mr(Ge(Be({lamports:ae(),address:Rr}))),fc=Be({executable:Wi(),owner:Rr,lamports:ae(),data:J1,rentEpoch:ae()}),N7=Be({pubkey:Rr,account:fc}),D7=qc(Mn([K1(Ze.Buffer),X0]),Mn([h3,X0]),r=>Array.isArray(r)?We(r,J1):r),Q0=Be({executable:Wi(),owner:Rr,lamports:ae(),data:D7,rentEpoch:ae()}),z7=Be({pubkey:Rr,account:Q0}),j7=Be({state:Mn([xr("active"),xr("inactive"),xr("activating"),xr("deactivating")]),active:ae(),inactive:ae()}),F7=Rt(Ge(Be({signature:Ve(),slot:ae(),err:Gs,memo:Ye(Ve()),blockTime:At(Ye(ae()))}))),$7=Rt(Ge(Be({signature:Ve(),slot:ae(),err:Gs,memo:Ye(Ve()),blockTime:At(Ye(ae()))}))),K7=Be({subscription:ae(),result:pf(fc)}),V7=Be({pubkey:Rr,account:fc}),q7=Be({subscription:ae(),result:pf(V7)}),H7=Be({parent:ae(),slot:ae(),root:ae()}),W7=Be({subscription:ae(),result:H7}),Z7=Mn([Be({type:Mn([xr("firstShredReceived"),xr("completed"),xr("optimisticConfirmation"),xr("root")]),slot:ae(),timestamp:ae()}),Be({type:xr("createdBank"),parent:ae(),slot:ae(),timestamp:ae()}),Be({type:xr("frozen"),slot:ae(),timestamp:ae(),stats:Be({numTransactionEntries:ae(),numSuccessfulTransactions:ae(),numFailedTransactions:ae(),maxTransactionsPerEntry:ae()})}),Be({type:xr("dead"),slot:ae(),timestamp:ae(),err:Ve()})]),G7=Be({subscription:ae(),result:Z7}),Y7=Be({subscription:ae(),result:pf(Mn([_7,E7]))}),J7=Be({subscription:ae(),result:ae()}),X7=Be({pubkey:Ve(),gossip:Ye(Ve()),tpu:Ye(Ve()),rpc:Ye(Ve()),version:Ye(Ve())}),tw=Be({votePubkey:Ve(),nodePubkey:Ve(),activatedStake:ae(),epochVoteAccount:Wi(),epochCredits:Ge(V1([ae(),ae(),ae()])),commission:ae(),lastVote:ae(),rootSlot:Ye(ae())}),Q7=Rt(Be({current:Ge(tw),delinquent:Ge(tw)})),eI=Mn([xr("processed"),xr("confirmed"),xr("finalized")]),tI=Be({slot:ae(),confirmations:Ye(ae()),err:Gs,confirmationStatus:At(eI)}),rI=Mr(Ge(Ye(tI))),nI=Rt(ae()),d3=Be({accountKey:Rr,writableIndexes:Ge(ae()),readonlyIndexes:Ge(ae())}),X1=Be({signatures:Ge(Ve()),message:Be({accountKeys:Ge(Ve()),header:Be({numRequiredSignatures:ae(),numReadonlySignedAccounts:ae(),numReadonlyUnsignedAccounts:ae()}),instructions:Ge(Be({accounts:Ge(ae()),data:Ve(),programIdIndex:ae()})),recentBlockhash:Ve(),addressTableLookups:At(Ge(d3))})}),p3=Be({pubkey:Rr,signer:Wi(),writable:Wi(),source:At(Mn([xr("transaction"),xr("lookupTable")]))}),g3=Be({accountKeys:Ge(p3),signatures:Ge(Ve())}),rw=Be({parsed:Vc(),program:Ve(),programId:Rr}),nw=Be({accounts:Ge(Rr),data:Ve(),programId:Rr}),y3=qc(Mn([nw,rw]),Mn([Be({parsed:Vc(),program:Ve(),programId:Ve()}),Be({accounts:Ge(Ve()),data:Ve(),programId:Ve()})]),r=>We(r,"accounts"in r?nw:rw)),m3=Be({signatures:Ge(Ve()),message:Be({accountKeys:Ge(p3),instructions:Ge(y3),recentBlockhash:Ve(),addressTableLookups:At(Ye(Ge(d3)))})}),gh=Be({accountIndex:ae(),mint:Ve(),owner:At(Ve()),uiTokenAmount:J0}),w3=Be({writable:Ge(Rr),readonly:Ge(Rr)}),gf=Be({err:Gs,fee:ae(),innerInstructions:At(Ye(Ge(Be({index:ae(),instructions:Ge(Be({accounts:Ge(ae()),data:Ve(),programIdIndex:ae()}))})))),preBalances:Ge(ae()),postBalances:Ge(ae()),logMessages:At(Ye(Ge(Ve()))),preTokenBalances:At(Ye(Ge(gh))),postTokenBalances:At(Ye(Ge(gh))),loadedAddresses:At(w3),computeUnitsConsumed:At(ae())}),Q1=Be({err:Gs,fee:ae(),innerInstructions:At(Ye(Ge(Be({index:ae(),instructions:Ge(y3)})))),preBalances:Ge(ae()),postBalances:Ge(ae()),logMessages:At(Ye(Ge(Ve()))),preTokenBalances:At(Ye(Ge(gh))),postTokenBalances:At(Ye(Ge(gh))),loadedAddresses:At(w3),computeUnitsConsumed:At(ae())}),iu=Mn([xr(0),xr("legacy")]),Ys=Be({pubkey:Ve(),lamports:ae(),postBalance:Ye(ae()),rewardType:Ye(Ve()),commission:At(Ye(ae()))}),iI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),transactions:Ge(Be({transaction:X1,meta:Ye(gf),version:At(iu)})),rewards:At(Ge(Ys)),blockTime:Ye(ae()),blockHeight:Ye(ae())}))),oI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),rewards:At(Ge(Ys)),blockTime:Ye(ae()),blockHeight:Ye(ae())}))),sI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),transactions:Ge(Be({transaction:g3,meta:Ye(gf),version:At(iu)})),rewards:At(Ge(Ys)),blockTime:Ye(ae()),blockHeight:Ye(ae())}))),aI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),transactions:Ge(Be({transaction:m3,meta:Ye(Q1),version:At(iu)})),rewards:At(Ge(Ys)),blockTime:Ye(ae()),blockHeight:Ye(ae())}))),uI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),transactions:Ge(Be({transaction:g3,meta:Ye(Q1),version:At(iu)})),rewards:At(Ge(Ys)),blockTime:Ye(ae()),blockHeight:Ye(ae())}))),cI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),rewards:At(Ge(Ys)),blockTime:Ye(ae()),blockHeight:Ye(ae())}))),lI=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),transactions:Ge(Be({transaction:X1,meta:Ye(gf)})),rewards:At(Ge(Ys)),blockTime:Ye(ae())}))),iw=Rt(Ye(Be({blockhash:Ve(),previousBlockhash:Ve(),parentSlot:ae(),signatures:Ge(Ve()),blockTime:Ye(ae())}))),Sd=Rt(Ye(Be({slot:ae(),meta:gf,blockTime:At(Ye(ae())),transaction:X1,version:At(iu)}))),ml=Rt(Ye(Be({slot:ae(),transaction:m3,meta:Ye(Q1),blockTime:At(Ye(ae())),version:At(iu)}))),hI=Mr(Be({blockhash:Ve(),feeCalculator:Be({lamportsPerSignature:ae()})})),fI=Mr(Be({blockhash:Ve(),lastValidBlockHeight:ae()})),dI=Mr(Wi()),pI=Rt(Ge(Be({slot:ae(),numTransactions:ae(),numSlots:ae(),samplePeriodSecs:ae()}))),gI=Mr(Ye(Be({feeCalculator:Be({lamportsPerSignature:ae()})}))),yI=Rt(Ve()),mI=Rt(Ve()),wI=Be({err:Gs,logs:Ge(Ve()),signature:Ve()}),bI=Be({result:pf(wI),subscription:ae()}),vI={"solana-client":"js/0.0.0-development"};class Sa{constructor(e){this._keypair=void 0,this._keypair=e??Zm()}static generate(){return new Sa(Zm())}static fromSecretKey(e,t){if(e.byteLength!==64)throw new Error("bad secret key size");const n=e.slice(32,64);if(!t||!t.skipValidation){const i=e.slice(0,32),o=dh(i);for(let s=0;s<32;s++)if(n[s]!==o[s])throw new Error("provided secretKey is invalid")}return new Sa({publicKey:n,secretKey:e})}static fromSeed(e){const t=dh(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),new Sa({publicKey:t,secretKey:n})}get publicKey(){return new ye(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const po=Object.freeze({CreateLookupTable:{index:0,layout:rt([Qe("instruction"),qa("recentSlot"),jt("bumpSeed")])},FreezeLookupTable:{index:1,layout:rt([Qe("instruction")])},ExtendLookupTable:{index:2,layout:rt([Qe("instruction"),qa(),sn($t(),Ko(Qe(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:rt([Qe("instruction")])},CloseLookupTable:{index:4,layout:rt([Qe("instruction")])}});class ep{constructor(){}static createLookupTable(e){const[t,n]=ye.findProgramAddressSync([e.authority.toBuffer(),F1(BigInt(e.recentSlot),8)],this.programId),i=Zt(po.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Cr.programId,isSigner:!1,isWritable:!1}];return[new rr({programId:this.programId,keys:o,data:i}),t]}static freezeLookupTable(e){const t=Zt(po.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new rr({programId:this.programId,keys:n,data:t})}static extendLookupTable(e){const t=Zt(po.ExtendLookupTable,{addresses:e.addresses.map(i=>i.toBytes())}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Cr.programId,isSigner:!1,isWritable:!1}),new rr({programId:this.programId,keys:n,data:t})}static deactivateLookupTable(e){const t=Zt(po.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new rr({programId:this.programId,keys:n,data:t})}static closeLookupTable(e){const t=Zt(po.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new rr({programId:this.programId,keys:n,data:t})}}ep.programId=new ye("AddressLookupTab1e1111111111111111111111111");const Di=Object.freeze({RequestUnits:{index:0,layout:rt([jt("instruction"),Qe("units"),Qe("additionalFee")])},RequestHeapFrame:{index:1,layout:rt([jt("instruction"),Qe("bytes")])},SetComputeUnitLimit:{index:2,layout:rt([jt("instruction"),Qe("units")])},SetComputeUnitPrice:{index:3,layout:rt([jt("instruction"),qa("microLamports")])}});class tp{constructor(){}static requestUnits(e){const t=Zt(Di.RequestUnits,e);return new rr({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){const t=Zt(Di.RequestHeapFrame,e);return new rr({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){const t=Zt(Di.SetComputeUnitLimit,e);return new rr({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){const t=Zt(Di.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new rr({keys:[],programId:this.programId,data:t})}}tp.programId=new ye("ComputeBudget111111111111111111111111111111");const ow=rt([jt("numSignatures"),jt("padding"),Qn("signatureOffset"),Qn("signatureInstructionIndex"),Qn("publicKeyOffset"),Qn("publicKeyInstructionIndex"),Qn("messageDataOffset"),Qn("messageDataSize"),Qn("messageInstructionIndex")]);class yf{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:i,instructionIndex:o}=e;Yt(t.length===32,`Public Key must be 32 bytes but received ${t.length} bytes`),Yt(i.length===64,`Signature must be 64 bytes but received ${i.length} bytes`);const s=ow.span,a=s+t.length,u=a+i.length,l=Ze.Buffer.alloc(u+n.length),d=o??65535;return ow.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:d,publicKeyOffset:s,publicKeyInstructionIndex:d,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:d},l),l.fill(t,s),l.fill(i,a),l.fill(n,u),new rr({keys:[],programId:yf.programId,data:l})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:i}=e;Yt(t.length===64,`Private key must be 64 bytes but received ${t.length} bytes`);try{const o=Sa.fromSecretKey(t),s=o.publicKey.toBytes(),a=W1(n,o.secretKey);return this.createInstructionWithPublicKey({publicKey:s,message:n,signature:a,instructionIndex:i})}catch(o){throw new Error(`Error creating instruction; ${o}`)}}}yf.programId=new ye("Ed25519SigVerify111111111111111111111111111");hf.utils.isValidPrivateKey;const _I=hf.getPublicKey,Id=rt([jt("numSignatures"),Qn("signatureOffset"),jt("signatureInstructionIndex"),Qn("ethAddressOffset"),jt("ethAddressInstructionIndex"),Qn("messageDataOffset"),Qn("messageDataSize"),jt("messageInstructionIndex"),lr(20,"ethAddress"),lr(64,"signature"),jt("recoveryId")]);class Ia{constructor(){}static publicKeyToEthAddress(e){Yt(e.length===64,`Public key must be 64 bytes but received ${e.length} bytes`);try{return Ze.Buffer.from(Km(Ut(e))).slice(-20)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:i,recoveryId:o,instructionIndex:s}=e;return Ia.createInstructionWithEthAddress({ethAddress:Ia.publicKeyToEthAddress(t),message:n,signature:i,recoveryId:o,instructionIndex:s})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:n,signature:i,recoveryId:o,instructionIndex:s=0}=e;let a;a=typeof t=="string"?t.startsWith("0x")?Ze.Buffer.from(t.substr(2),"hex"):Ze.Buffer.from(t,"hex"):t,Yt(a.length===20,`Address must be 20 bytes but received ${a.length} bytes`);const u=12+a.length,l=u+i.length+1,d=Ze.Buffer.alloc(Id.span+n.length);return Id.encode({numSignatures:1,signatureOffset:u,signatureInstructionIndex:s,ethAddressOffset:12,ethAddressInstructionIndex:s,messageDataOffset:l,messageDataSize:n.length,messageInstructionIndex:s,signature:Ut(i),ethAddress:Ut(a),recoveryId:o},d),d.fill(Ut(n),Id.span),new rr({keys:[],programId:Ia.programId,data:d})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:i}=e;Yt(t.length===32,`Private key must be 32 bytes but received ${t.length} bytes`);try{const o=Ut(t),s=_I(o,!1).slice(1),a=Ze.Buffer.from(Km(Ut(n))),[u,l]=((d,_)=>{const E=hf.sign(d,_);return[E.toCompactRawBytes(),E.recovery]})(a,o);return this.createInstructionWithPublicKey({publicKey:s,message:n,signature:u,recoveryId:l,instructionIndex:i})}catch(o){throw new Error(`Error creating instruction; ${o}`)}}}var sw;Ia.programId=new ye("KeccakSecp256k11111111111111111111111111111");const b3=new ye("StakeConfig11111111111111111111111111111111");class aw{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class dc{constructor(e,t,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=n}}sw=dc,dc.default=new sw(0,0,ye.default);const Vr=Object.freeze({Initialize:{index:0,layout:rt([Qe("instruction"),((r="authorized")=>rt([$t("staker"),$t("withdrawer")],r))(),((r="lockup")=>rt([zn("unixTimestamp"),zn("epoch"),$t("custodian")],r))()])},Authorize:{index:1,layout:rt([Qe("instruction"),$t("newAuthorized"),Qe("stakeAuthorizationType")])},Delegate:{index:2,layout:rt([Qe("instruction")])},Split:{index:3,layout:rt([Qe("instruction"),zn("lamports")])},Withdraw:{index:4,layout:rt([Qe("instruction"),zn("lamports")])},Deactivate:{index:5,layout:rt([Qe("instruction")])},Merge:{index:7,layout:rt([Qe("instruction")])},AuthorizeWithSeed:{index:8,layout:rt([Qe("instruction"),$t("newAuthorized"),Qe("stakeAuthorizationType"),_s("authoritySeed"),$t("authorityOwner")])}}),EI=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class yh{constructor(){}static initialize(e){const{stakePubkey:t,authorized:n,lockup:i}=e,o=i||dc.default,s=Zt(Vr.Initialize,{authorized:{staker:Ut(n.staker.toBuffer()),withdrawer:Ut(n.withdrawer.toBuffer())},lockup:{unixTimestamp:o.unixTimestamp,epoch:o.epoch,custodian:Ut(o.custodian.toBuffer())}}),a={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Jo,isSigner:!1,isWritable:!1}],programId:this.programId,data:s};return new rr(a)}static createAccountWithSeed(e){const t=new Gt;t.add(Cr.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:i,lockup:o}=e;return t.add(this.initialize({stakePubkey:n,authorized:i,lockup:o}))}static createAccount(e){const t=new Gt;t.add(Cr.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:i,lockup:o}=e;return t.add(this.initialize({stakePubkey:n,authorized:i,lockup:o}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:n,votePubkey:i}=e,o=Zt(Vr.Delegate);return new Gt().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:Zl,isSigner:!1,isWritable:!1},{pubkey:b3,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static authorize(e){const{stakePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:i,stakeAuthorizationType:o,custodianPubkey:s}=e,a=Zt(Vr.Authorize,{newAuthorized:Ut(i.toBuffer()),stakeAuthorizationType:o.index}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:gi,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return s&&u.push({pubkey:s,isSigner:!1,isWritable:!1}),new Gt().add({keys:u,programId:this.programId,data:a})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:n,authoritySeed:i,authorityOwner:o,newAuthorizedPubkey:s,stakeAuthorizationType:a,custodianPubkey:u}=e,l=Zt(Vr.AuthorizeWithSeed,{newAuthorized:Ut(s.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:i,authorityOwner:Ut(o.toBuffer())}),d=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:gi,isSigner:!1,isWritable:!1}];return u&&d.push({pubkey:u,isSigner:!1,isWritable:!1}),new Gt().add({keys:d,programId:this.programId,data:l})}static splitInstruction(e){const{stakePubkey:t,authorizedPubkey:n,splitStakePubkey:i,lamports:o}=e,s=Zt(Vr.Split,{lamports:o});return new rr({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(e){const t=new Gt;return t.add(Cr.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),t.add(this.splitInstruction(e))}static splitWithSeed(e){const{stakePubkey:t,authorizedPubkey:n,splitStakePubkey:i,basePubkey:o,seed:s,lamports:a}=e,u=new Gt;return u.add(Cr.allocate({accountPubkey:i,basePubkey:o,seed:s,space:this.space,programId:this.programId})),u.add(this.splitInstruction({stakePubkey:t,authorizedPubkey:n,splitStakePubkey:i,lamports:a}))}static merge(e){const{stakePubkey:t,sourceStakePubKey:n,authorizedPubkey:i}=e,o=Zt(Vr.Merge);return new Gt().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:Zl,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:n,toPubkey:i,lamports:o,custodianPubkey:s}=e,a=Zt(Vr.Withdraw,{lamports:o}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:Zl,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return s&&u.push({pubkey:s,isSigner:!1,isWritable:!1}),new Gt().add({keys:u,programId:this.programId,data:a})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:n}=e,i=Zt(Vr.Deactivate);return new Gt().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}}yh.programId=new ye("Stake11111111111111111111111111111111111111"),yh.space=200;class uw{constructor(e,t,n,i){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=t,this.authorizedWithdrawer=n,this.commission=i}}const go=Object.freeze({InitializeAccount:{index:0,layout:rt([Qe("instruction"),((r="voteInit")=>rt([$t("nodePubkey"),$t("authorizedVoter"),$t("authorizedWithdrawer"),jt("commission")],r))()])},Authorize:{index:1,layout:rt([Qe("instruction"),$t("newAuthorized"),Qe("voteAuthorizationType")])},Withdraw:{index:3,layout:rt([Qe("instruction"),zn("lamports")])},AuthorizeWithSeed:{index:10,layout:rt([Qe("instruction"),((r="voteAuthorizeWithSeedArgs")=>rt([Qe("voteAuthorizationType"),$t("currentAuthorityDerivedKeyOwnerPubkey"),_s("currentAuthorityDerivedKeySeed"),$t("newAuthorized")],r))()])}}),xI=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class Ha{constructor(){}static initializeAccount(e){const{votePubkey:t,nodePubkey:n,voteInit:i}=e,o=Zt(go.InitializeAccount,{voteInit:{nodePubkey:Ut(i.nodePubkey.toBuffer()),authorizedVoter:Ut(i.authorizedVoter.toBuffer()),authorizedWithdrawer:Ut(i.authorizedWithdrawer.toBuffer()),commission:i.commission}}),s={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Jo,isSigner:!1,isWritable:!1},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o};return new rr(s)}static createAccount(e){const t=new Gt;return t.add(Cr.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){const{votePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:i,voteAuthorizationType:o}=e,s=Zt(go.Authorize,{newAuthorized:Ut(i.toBuffer()),voteAuthorizationType:o.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new Gt().add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(e){const{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:i,newAuthorizedPubkey:o,voteAuthorizationType:s,votePubkey:a}=e,u=Zt(go.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ut(n.toBuffer()),currentAuthorityDerivedKeySeed:i,newAuthorized:Ut(o.toBuffer()),voteAuthorizationType:s.index}}),l=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:gi,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return new Gt().add({keys:l,programId:this.programId,data:u})}static withdraw(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,lamports:i,toPubkey:o}=e,s=Zt(go.Withdraw,{lamports:i}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new Gt().add({keys:a,programId:this.programId,data:s})}static safeWithdraw(e,t,n){if(e.lamports>t-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return Ha.withdraw(e)}}Ha.programId=new ye("Vote111111111111111111111111111111111111111"),Ha.space=3731;const v3=new ye("Va1idator1nfo111111111111111111111111111111"),AI=Be({name:Ve(),website:At(Ve()),details:At(Ve()),keybaseUsername:At(Ve())});class eg{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let t=[...e];if(_n(t)!==2)return null;const n=[];for(let i=0;i<2;i++){const o=new ye(t.slice(0,Vn));t=t.slice(Vn);const s=t.slice(0,1)[0]===1;t=t.slice(1),n.push({publicKey:o,isSigner:s})}if(n[0].publicKey.equals(v3)&&n[1].isSigner){const i=_s().decode(Ze.Buffer.from(t)),o=JSON.parse(i);return F6(o,AI),new eg(n[1].publicKey,o)}return null}}const kI=new ye("Vote111111111111111111111111111111111111111"),SI=rt([$t("nodePubkey"),$t("authorizedWithdrawer"),jt("commission"),Xr(),sn(rt([Xr("slot"),Qe("confirmationCount")]),Ko(Qe(),-8),"votes"),jt("rootSlotValid"),Xr("rootSlot"),Xr(),sn(rt([Xr("epoch"),$t("authorizedVoter")]),Ko(Qe(),-8),"authorizedVoters"),rt([sn(rt([$t("authorizedPubkey"),Xr("epochOfLastAuthorizedSwitch"),Xr("targetEpoch")]),32,"buf"),Xr("idx"),jt("isEmpty")],"priorVoters"),Xr(),sn(rt([Xr("epoch"),Xr("credits"),Xr("prevCredits")]),Ko(Qe(),-8),"epochCredits"),rt([Xr("slot"),Xr("timestamp")],"lastTimestamp")]);class tg{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const t=SI.decode(Ut(e),4);let n=t.rootSlot;return t.rootSlotValid||(n=null),new tg({nodePubkey:new ye(t.nodePubkey),authorizedWithdrawer:new ye(t.authorizedWithdrawer),commission:t.commission,votes:t.votes,rootSlot:n,authorizedVoters:t.authorizedVoters.map(II),priorVoters:BI(t.priorVoters),epochCredits:t.epochCredits,lastTimestamp:t.lastTimestamp})}}function II({authorizedVoter:r,epoch:e}){return{epoch:e,authorizedVoter:new ye(r)}}function cw({authorizedPubkey:r,epochOfLastAuthorizedSwitch:e,targetEpoch:t}){return{authorizedPubkey:new ye(r),epochOfLastAuthorizedSwitch:e,targetEpoch:t}}function BI({buf:r,idx:e,isEmpty:t}){return t?[]:[...r.slice(e+1).map(cw),...r.slice(0,e).map(cw)]}const lw={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var _3=Object.freeze({__proto__:null,Account:class{constructor(r){if(this._publicKey=void 0,this._secretKey=void 0,r){const e=Ut(r);if(r.length!==64)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=Ut(GS()),this._publicKey=Ut(dh(this._secretKey))}get publicKey(){return new ye(this._publicKey)}get secretKey(){return Ze.Buffer.concat([this._secretKey,this._publicKey],64)}},AddressLookupTableAccount:Ad,AddressLookupTableInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const e=Qe("instruction").decode(r.data);let t;for(const[n,i]of Object.entries(po))if(i.index==e){t=n;break}if(!t)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return t}static decodeCreateLookupTable(r){this.checkProgramId(r.programId),this.checkKeysLength(r.keys,4);const{recentSlot:e}=ir(po.CreateLookupTable,r.data);return{authority:r.keys[1].pubkey,payer:r.keys[2].pubkey,recentSlot:Number(e)}}static decodeExtendLookupTable(r){if(this.checkProgramId(r.programId),r.keys.length<2)throw new Error(`invalid instruction; found ${r.keys.length} keys, expected at least 2`);const{addresses:e}=ir(po.ExtendLookupTable,r.data);return{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,payer:r.keys.length>2?r.keys[2].pubkey:void 0,addresses:e.map(t=>new ye(t))}}static decodeCloseLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,3),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,recipient:r.keys[2].pubkey}}static decodeFreezeLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static decodeDeactivateLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static checkProgramId(r){if(!r.equals(ep.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(r,e){if(r.length{const u={};return async l=>{const{commitment:d,config:_}=gr(l),E=this._buildArgs([],d,void 0,_),m=Xm(E);return u[m]=u[m]??(async()=>{try{const w=We(await this._rpcRequest("getBlockHeight",E),Rt(ae()));if("error"in w)throw new ot(w.error,"failed to get block height information");return w.result}finally{delete u[m]}})(),await u[m]}})(),e&&typeof e=="string"?this._commitment=e:e&&(this._commitment=e.commitment,this._confirmTransactionInitialTimeout=e.confirmTransactionInitialTimeout,t=e.wsEndpoint,n=e.httpHeaders,i=e.fetch,o=e.fetchMiddleware,s=e.disableRetryOnRateLimit,a=e.httpAgent),this._rpcEndpoint=function(u){if(/^https?:/.test(u)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return u}(r),this._rpcWsEndpoint=t||function(u){const l=u.match(f7);if(l==null)throw TypeError(`Failed to validate endpoint URL \`${u}\``);const[d,_,E,m]=l,w=u.startsWith("https:")?"wss:":"ws:",v=E==null?null:parseInt(E.slice(1),10);return`${w}//${_}${v==null?"":`:${v+1}`}${m}`}(r),this._rpcClient=function(u,l,d,_,E,m){const w=d||c7;let v;return m!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),_&&(v=async(I,B)=>{const S=await new Promise((P,C)=>{try{_(I,B,(R,j)=>P([R,j]))}catch(R){C(R)}});return await w(...S)}),new BS(async(I,B)=>{const S={method:"POST",body:I,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},l||{},vI)};try{let P,C=5,R=500;for(;P=v?await v(u,S):await w(u,S),P.status===429&&E!==!0&&(C-=1,C!==0);)console.log(`Server responded with ${P.status} ${P.statusText}. Retrying after ${R}ms delay...`),await fs(R),R*=2;const j=await P.text();P.ok?B(null,j):B(new Error(`${P.status} ${P.statusText}: ${j}`))}catch(P){P instanceof Error&&B(P)}},{})}(r,n,i,o,s,a),this._rpcRequest=function(u){return(l,d)=>new Promise((_,E)=>{u.request(l,d,(m,w)=>{m?E(m):_(w)})})}(this._rpcClient),this._rpcBatchRequest=function(u){return l=>new Promise((d,_)=>{l.length===0&&d([]);const E=l.map(m=>u.request(m.methodName,m.args));u.request(E,(m,w)=>{m?_(m):d(w)})})}(this._rpcClient),this._rpcWebSocket=new l7(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgs([r.toBase58()],t,void 0,n),o=We(await this._rpcRequest("getBalance",i),Mr(ae()));if("error"in o)throw new ot(o.error,`failed to get balance for ${r.toBase58()}`);return o.result}async getBalance(r,e){return await this.getBalanceAndContext(r,e).then(t=>t.value).catch(t=>{throw new Error("failed to get balance of account "+r.toBase58()+": "+t)})}async getBlockTime(r){const e=We(await this._rpcRequest("getBlockTime",[r]),Rt(Ye(ae())));if("error"in e)throw new ot(e.error,`failed to get block time for slot ${r}`);return e.result}async getMinimumLedgerSlot(){const r=We(await this._rpcRequest("minimumLedgerSlot",[]),Rt(ae()));if("error"in r)throw new ot(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){const r=We(await this._rpcRequest("getFirstAvailableBlock",[]),L7);if("error"in r)throw new ot(r.error,"failed to get first available block");return r.result}async getSupply(r){let e={};e=typeof r=="string"?{commitment:r}:r?{...r,commitment:r&&r.commitment||this.commitment}:{commitment:this.commitment};const t=We(await this._rpcRequest("getSupply",[e]),C7);if("error"in t)throw new ot(t.error,"failed to get supply");return t.result}async getTokenSupply(r,e){const t=this._buildArgs([r.toBase58()],e),n=We(await this._rpcRequest("getTokenSupply",t),Mr(J0));if("error"in n)throw new ot(n.error,"failed to get token supply");return n.result}async getTokenAccountBalance(r,e){const t=this._buildArgs([r.toBase58()],e),n=We(await this._rpcRequest("getTokenAccountBalance",t),Mr(J0));if("error"in n)throw new ot(n.error,"failed to get token account balance");return n.result}async getTokenAccountsByOwner(r,e,t){const{commitment:n,config:i}=gr(t);let o=[r.toBase58()];"mint"in e?o.push({mint:e.mint.toBase58()}):o.push({programId:e.programId.toBase58()});const s=this._buildArgs(o,n,"base64",i),a=We(await this._rpcRequest("getTokenAccountsByOwner",s),O7);if("error"in a)throw new ot(a.error,`failed to get token accounts owned by account ${r.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(r,e,t){let n=[r.toBase58()];"mint"in e?n.push({mint:e.mint.toBase58()}):n.push({programId:e.programId.toBase58()});const i=this._buildArgs(n,t,"jsonParsed"),o=We(await this._rpcRequest("getTokenAccountsByOwner",i),R7);if("error"in o)throw new ot(o.error,`failed to get token accounts owned by account ${r.toBase58()}`);return o.result}async getLargestAccounts(r){const e={...r,commitment:r&&r.commitment||this.commitment},t=e.filter||e.commitment?[e]:[],n=We(await this._rpcRequest("getLargestAccounts",t),U7);if("error"in n)throw new ot(n.error,"failed to get largest accounts");return n.result}async getTokenLargestAccounts(r,e){const t=this._buildArgs([r.toBase58()],e),n=We(await this._rpcRequest("getTokenLargestAccounts",t),T7);if("error"in n)throw new ot(n.error,"failed to get token largest accounts");return n.result}async getAccountInfoAndContext(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgs([r.toBase58()],t,"base64",n),o=We(await this._rpcRequest("getAccountInfo",i),Mr(Ye(fc)));if("error"in o)throw new ot(o.error,`failed to get info about account ${r.toBase58()}`);return o.result}async getParsedAccountInfo(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgs([r.toBase58()],t,"jsonParsed",n),o=We(await this._rpcRequest("getAccountInfo",i),Mr(Ye(Q0)));if("error"in o)throw new ot(o.error,`failed to get info about account ${r.toBase58()}`);return o.result}async getAccountInfo(r,e){try{return(await this.getAccountInfoAndContext(r,e)).value}catch(t){throw new Error("failed to get info about account "+r.toBase58()+": "+t)}}async getMultipleParsedAccounts(r,e){const{commitment:t,config:n}=gr(e),i=r.map(a=>a.toBase58()),o=this._buildArgs([i],t,"jsonParsed",n),s=We(await this._rpcRequest("getMultipleAccounts",o),Mr(Ge(Ye(Q0))));if("error"in s)throw new ot(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfoAndContext(r,e){const{commitment:t,config:n}=gr(e),i=r.map(a=>a.toBase58()),o=this._buildArgs([i],t,"base64",n),s=We(await this._rpcRequest("getMultipleAccounts",o),Mr(Ge(Ye(fc))));if("error"in s)throw new ot(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfo(r,e){return(await this.getMultipleAccountsInfoAndContext(r,e)).value}async getStakeActivation(r,e,t){const{commitment:n,config:i}=gr(e),o=this._buildArgs([r.toBase58()],n,void 0,{...i,epoch:t??(i==null?void 0:i.epoch)}),s=We(await this._rpcRequest("getStakeActivation",o),Rt(j7));if("error"in s)throw new ot(s.error,`failed to get Stake Activation ${r.toBase58()}`);return s.result}async getProgramAccounts(r,e){const{commitment:t,config:n}=gr(e),{encoding:i,...o}=n||{},s=this._buildArgs([r.toBase58()],t,i||"base64",o),a=await this._rpcRequest("getProgramAccounts",s),u=Ge(N7),l=o.withContext===!0?We(a,Mr(u)):We(a,Rt(u));if("error"in l)throw new ot(l.error,`failed to get accounts owned by program ${r.toBase58()}`);return l.result}async getParsedProgramAccounts(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgs([r.toBase58()],t,"jsonParsed",n),o=We(await this._rpcRequest("getProgramAccounts",i),Rt(Ge(z7)));if("error"in o)throw new ot(o.error,`failed to get accounts owned by program ${r.toBase58()}`);return o.result}async confirmTransaction(r,e){var i;let t,n;if(typeof r=="string")t=r;else{const o=r;if((i=o.abortSignal)!=null&&i.aborted)return Promise.reject(o.abortSignal.reason);t=o.signature}try{n=on.decode(t)}catch{throw new Error("signature must be base58 encoded: "+t)}return Yt(n.length===64,"signature has invalid length"),typeof r=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:e||this.commitment,signature:t}):"lastValidBlockHeight"in r?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:e||this.commitment,strategy:r}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:e||this.commitment,strategy:r})}getCancellationPromise(r){return new Promise((e,t)=>{r!=null&&(r.aborted?t(r.reason):r.addEventListener("abort",()=>{t(r.reason)}))})}getTransactionConfirmationPromise({commitment:r,signature:e}){let t,n,i=!1;const o=new Promise((s,a)=>{try{t=this.onSignature(e,(l,d)=>{t=void 0;const _={context:d,value:l};s({__type:Xi.PROCESSED,response:_})},r);const u=new Promise(l=>{t==null?l():n=this._onSubscriptionStateChange(t,d=>{d==="subscribed"&&l()})});(async()=>{if(await u,i)return;const l=await this.getSignatureStatus(e);if(i||l==null)return;const{context:d,value:_}=l;if(_!=null)if(_!=null&&_.err)a(_.err);else{switch(r){case"confirmed":case"single":case"singleGossip":if(_.confirmationStatus==="processed")return;break;case"finalized":case"max":case"root":if(_.confirmationStatus==="processed"||_.confirmationStatus==="confirmed")return}i=!0,s({__type:Xi.PROCESSED,response:{context:d,value:_}})}})()}catch(u){a(u)}});return{abortConfirmation:()=>{n&&(n(),n=void 0),t!=null&&(this.removeSignatureListener(t),t=void 0)},confirmationPromise:o}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r,strategy:{abortSignal:e,lastValidBlockHeight:t,signature:n}}){let i=!1;const o=new Promise(d=>{const _=async()=>{try{return await this.getBlockHeight(r)}catch{return-1}};(async()=>{let E=await _();if(!i){for(;E<=t;)if(await fs(1e3),i||(E=await _(),i))return;d({__type:Xi.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:s,confirmationPromise:a}=this.getTransactionConfirmationPromise({commitment:r,signature:n}),u=this.getCancellationPromise(e);let l;try{const d=await Promise.race([u,a,o]);if(d.__type!==Xi.PROCESSED)throw new W0(n);l=d.response}finally{i=!0,s()}return l}async confirmTransactionUsingDurableNonceStrategy({commitment:r,strategy:{abortSignal:e,minContextSlot:t,nonceAccountPubkey:n,nonceValue:i,signature:o}}){let s=!1;const a=new Promise(E=>{let m=i,w=null;const v=async()=>{try{const{context:A,value:I}=await this.getNonceAndContext(n,{commitment:r,minContextSlot:t});return w=A.slot,I==null?void 0:I.nonce}catch{return m}};(async()=>{if(m=await v(),!s)for(;;){if(i!==m)return void E({__type:Xi.NONCE_INVALID,slotInWhichNonceDidAdvance:w});if(await fs(2e3),s||(m=await v(),s))return}})()}),{abortConfirmation:u,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:r,signature:o}),d=this.getCancellationPromise(e);let _;try{const E=await Promise.race([d,l,a]);if(E.__type===Xi.PROCESSED)_=E.response;else{let m;for(;;){const w=await this.getSignatureStatus(o);if(w==null)break;if(!(w.context.slot<(E.slotInWhichNonceDidAdvance??t))){m=w;break}await fs(400)}if(!(m!=null&&m.value))throw new fa(o);{const w=r||"finalized",{confirmationStatus:v}=m.value;switch(w){case"processed":case"recent":if(v!=="processed"&&v!=="confirmed"&&v!=="finalized")throw new fa(o);break;case"confirmed":case"single":case"singleGossip":if(v!=="confirmed"&&v!=="finalized")throw new fa(o);break;case"finalized":case"max":case"root":if(v!=="finalized")throw new fa(o)}_={context:m.context,value:{err:m.value.err}}}}}finally{s=!0,u()}return _}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:r,signature:e}){let t;const n=new Promise(a=>{let u=this._confirmTransactionInitialTimeout||6e4;switch(r){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":u=this._confirmTransactionInitialTimeout||3e4}t=setTimeout(()=>a({__type:Xi.TIMED_OUT,timeoutMs:u}),u)}),{abortConfirmation:i,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:r,signature:e});let s;try{const a=await Promise.race([o,n]);if(a.__type!==Xi.PROCESSED)throw new Z0(e,a.timeoutMs/1e3);s=a.response}finally{clearTimeout(t),i()}return s}async getClusterNodes(){const r=We(await this._rpcRequest("getClusterNodes",[]),Rt(Ge(X7)));if("error"in r)throw new ot(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(r){const e=this._buildArgs([],r),t=We(await this._rpcRequest("getVoteAccounts",e),Q7);if("error"in t)throw new ot(t.error,"failed to get vote accounts");return t.result}async getSlot(r){const{commitment:e,config:t}=gr(r),n=this._buildArgs([],e,void 0,t),i=We(await this._rpcRequest("getSlot",n),Rt(ae()));if("error"in i)throw new ot(i.error,"failed to get slot");return i.result}async getSlotLeader(r){const{commitment:e,config:t}=gr(r),n=this._buildArgs([],e,void 0,t),i=We(await this._rpcRequest("getSlotLeader",n),Rt(Ve()));if("error"in i)throw new ot(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(r,e){const t=[r,e],n=We(await this._rpcRequest("getSlotLeaders",t),Rt(Ge(Rr)));if("error"in n)throw new ot(n.error,"failed to get slot leaders");return n.result}async getSignatureStatus(r,e){const{context:t,value:n}=await this.getSignatureStatuses([r],e);return Yt(n.length===1),{context:t,value:n[0]}}async getSignatureStatuses(r,e){const t=[r];e&&t.push(e);const n=We(await this._rpcRequest("getSignatureStatuses",t),rI);if("error"in n)throw new ot(n.error,"failed to get signature status");return n.result}async getTransactionCount(r){const{commitment:e,config:t}=gr(r),n=this._buildArgs([],e,void 0,t),i=We(await this._rpcRequest("getTransactionCount",n),Rt(ae()));if("error"in i)throw new ot(i.error,"failed to get transaction count");return i.result}async getTotalSupply(r){return(await this.getSupply({commitment:r,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(r){const e=this._buildArgs([],r),t=We(await this._rpcRequest("getInflationGovernor",e),k7);if("error"in t)throw new ot(t.error,"failed to get inflation");return t.result}async getInflationReward(r,e,t){const{commitment:n,config:i}=gr(t),o=this._buildArgs([r.map(a=>a.toBase58())],n,void 0,{...i,epoch:e??(i==null?void 0:i.epoch)}),s=We(await this._rpcRequest("getInflationReward",o),g7);if("error"in s)throw new ot(s.error,"failed to get inflation reward");return s.result}async getInflationRate(){const r=We(await this._rpcRequest("getInflationRate",[]),S7);if("error"in r)throw new ot(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(r){const{commitment:e,config:t}=gr(r),n=this._buildArgs([],e,void 0,t),i=We(await this._rpcRequest("getEpochInfo",n),B7);if("error"in i)throw new ot(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const r=We(await this._rpcRequest("getEpochSchedule",[]),M7);if("error"in r)throw new ot(r.error,"failed to get epoch schedule");const e=r.result;return new Qm(e.slotsPerEpoch,e.leaderScheduleSlotOffset,e.warmup,e.firstNormalEpoch,e.firstNormalSlot)}async getLeaderSchedule(){const r=We(await this._rpcRequest("getLeaderSchedule",[]),P7);if("error"in r)throw new ot(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(r,e){const t=this._buildArgs([r],e),n=We(await this._rpcRequest("getMinimumBalanceForRentExemption",t),nI);return"error"in n?(console.warn("Unable to fetch minimum balance for rent exemption"),0):n.result}async getRecentBlockhashAndContext(r){const e=this._buildArgs([],r),t=We(await this._rpcRequest("getRecentBlockhash",e),hI);if("error"in t)throw new ot(t.error,"failed to get recent blockhash");return t.result}async getRecentPerformanceSamples(r){const e=We(await this._rpcRequest("getRecentPerformanceSamples",r?[r]:[]),pI);if("error"in e)throw new ot(e.error,"failed to get recent performance samples");return e.result}async getFeeCalculatorForBlockhash(r,e){const t=this._buildArgs([r],e),n=We(await this._rpcRequest("getFeeCalculatorForBlockhash",t),gI);if("error"in n)throw new ot(n.error,"failed to get fee calculator");const{context:i,value:o}=n.result;return{context:i,value:o!==null?o.feeCalculator:null}}async getFeeForMessage(r,e){const t=Ut(r.serialize()).toString("base64"),n=this._buildArgs([t],e),i=We(await this._rpcRequest("getFeeForMessage",n),Mr(Ye(ae())));if("error"in i)throw new ot(i.error,"failed to get fee for message");if(i.result===null)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(r){var i;const e=(i=r==null?void 0:r.lockedWritableAccounts)==null?void 0:i.map(o=>o.toBase58()),t=e!=null&&e.length?[e]:[],n=We(await this._rpcRequest("getRecentPrioritizationFees",t),I7);if("error"in n)throw new ot(n.error,"failed to get recent prioritization fees");return n.result}async getRecentBlockhash(r){try{return(await this.getRecentBlockhashAndContext(r)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(r){try{return(await this.getLatestBlockhashAndContext(r)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhashAndContext(r){const{commitment:e,config:t}=gr(r),n=this._buildArgs([],e,void 0,t),i=We(await this._rpcRequest("getLatestBlockhash",n),fI);if("error"in i)throw new ot(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgs([r],t,void 0,n),o=We(await this._rpcRequest("isBlockhashValid",i),dI);if("error"in o)throw new ot(o.error,"failed to determine if the blockhash `"+r+"`is valid");return o.result}async getVersion(){const r=We(await this._rpcRequest("getVersion",[]),Rt(x7));if("error"in r)throw new ot(r.error,"failed to get version");return r.result}async getGenesisHash(){const r=We(await this._rpcRequest("getGenesisHash",[]),Rt(Ve()));if("error"in r)throw new ot(r.error,"failed to get genesis hash");return r.result}async getBlock(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgsAtLeastConfirmed([r],t,void 0,n),o=await this._rpcRequest("getBlock",i);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const s=We(o,sI);if("error"in s)throw s.error;return s.result}case"none":{const s=We(o,oI);if("error"in s)throw s.error;return s.result}default:{const s=We(o,iI);if("error"in s)throw s.error;const{result:a}=s;return a?{...a,transactions:a.transactions.map(({transaction:u,meta:l,version:d})=>({meta:l,transaction:{...u,message:kd(d,u.message)},version:d}))}:null}}}catch(s){throw new ot(s,"failed to get confirmed block")}}async getParsedBlock(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgsAtLeastConfirmed([r],t,"jsonParsed",n),o=await this._rpcRequest("getBlock",i);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const s=We(o,uI);if("error"in s)throw s.error;return s.result}case"none":{const s=We(o,cI);if("error"in s)throw s.error;return s.result}default:{const s=We(o,aI);if("error"in s)throw s.error;return s.result}}}catch(s){throw new ot(s,"failed to get block")}}async getBlockProduction(r){let e,t;if(typeof r=="string")t=r;else if(r){const{commitment:o,...s}=r;t=o,e=s}const n=this._buildArgs([],t,"base64",e),i=We(await this._rpcRequest("getBlockProduction",n),A7);if("error"in i)throw new ot(i.error,"failed to get block production information");return i.result}async getTransaction(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgsAtLeastConfirmed([r],t,void 0,n),o=We(await this._rpcRequest("getTransaction",i),Sd);if("error"in o)throw new ot(o.error,"failed to get transaction");const s=o.result;return s&&{...s,transaction:{...s.transaction,message:kd(s.version,s.transaction.message)}}}async getParsedTransaction(r,e){const{commitment:t,config:n}=gr(e),i=this._buildArgsAtLeastConfirmed([r],t,"jsonParsed",n),o=We(await this._rpcRequest("getTransaction",i),ml);if("error"in o)throw new ot(o.error,"failed to get transaction");return o.result}async getParsedTransactions(r,e){const{commitment:t,config:n}=gr(e),i=r.map(o=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([o],t,"jsonParsed",n)}));return(await this._rpcBatchRequest(i)).map(o=>{const s=We(o,ml);if("error"in s)throw new ot(s.error,"failed to get transactions");return s.result})}async getTransactions(r,e){const{commitment:t,config:n}=gr(e),i=r.map(o=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([o],t,void 0,n)}));return(await this._rpcBatchRequest(i)).map(o=>{const s=We(o,Sd);if("error"in s)throw new ot(s.error,"failed to get transactions");const a=s.result;return a&&{...a,transaction:{...a.transaction,message:kd(a.version,a.transaction.message)}}})}async getConfirmedBlock(r,e){const t=this._buildArgsAtLeastConfirmed([r],e),n=We(await this._rpcRequest("getConfirmedBlock",t),lI);if("error"in n)throw new ot(n.error,"failed to get confirmed block");const i=n.result;if(!i)throw new Error("Confirmed block "+r+" not found");const o={...i,transactions:i.transactions.map(({transaction:s,meta:a})=>{const u=new qo(s.message);return{meta:a,transaction:{...s,message:u}}})};return{...o,transactions:o.transactions.map(({transaction:s,meta:a})=>({meta:a,transaction:Gt.populate(s.message,s.signatures)}))}}async getBlocks(r,e,t){const n=this._buildArgsAtLeastConfirmed(e!==void 0?[r,e]:[r],t),i=We(await this._rpcRequest("getBlocks",n),Rt(Ge(ae())));if("error"in i)throw new ot(i.error,"failed to get blocks");return i.result}async getBlockSignatures(r,e){const t=this._buildArgsAtLeastConfirmed([r],e,void 0,{transactionDetails:"signatures",rewards:!1}),n=We(await this._rpcRequest("getBlock",t),iw);if("error"in n)throw new ot(n.error,"failed to get block");const i=n.result;if(!i)throw new Error("Block "+r+" not found");return i}async getConfirmedBlockSignatures(r,e){const t=this._buildArgsAtLeastConfirmed([r],e,void 0,{transactionDetails:"signatures",rewards:!1}),n=We(await this._rpcRequest("getConfirmedBlock",t),iw);if("error"in n)throw new ot(n.error,"failed to get confirmed block");const i=n.result;if(!i)throw new Error("Confirmed block "+r+" not found");return i}async getConfirmedTransaction(r,e){const t=this._buildArgsAtLeastConfirmed([r],e),n=We(await this._rpcRequest("getConfirmedTransaction",t),Sd);if("error"in n)throw new ot(n.error,"failed to get transaction");const i=n.result;if(!i)return i;const o=new qo(i.transaction.message),s=i.transaction.signatures;return{...i,transaction:Gt.populate(o,s)}}async getParsedConfirmedTransaction(r,e){const t=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed"),n=We(await this._rpcRequest("getConfirmedTransaction",t),ml);if("error"in n)throw new ot(n.error,"failed to get confirmed transaction");return n.result}async getParsedConfirmedTransactions(r,e){const t=r.map(n=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([n],e,"jsonParsed")}));return(await this._rpcBatchRequest(t)).map(n=>{const i=We(n,ml);if("error"in i)throw new ot(i.error,"failed to get confirmed transactions");return i.result})}async getConfirmedSignaturesForAddress(r,e,t){let n={},i=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--e<=0||e0&&(n.until=s.signatures[s.signatures.length-1].toString())}catch(s){if(s instanceof Error&&s.message.includes("skipped"))continue;throw s}let o=await this.getSlot("finalized");for(;!("before"in n||++t>o);)try{const s=await this.getConfirmedBlockSignatures(t);s.signatures.length>0&&(n.before=s.signatures[s.signatures.length-1].toString())}catch(s){if(s instanceof Error&&s.message.includes("skipped"))continue;throw s}return(await this.getConfirmedSignaturesForAddress2(r,n)).map(s=>s.signature)}async getConfirmedSignaturesForAddress2(r,e,t){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],t,void 0,e),i=We(await this._rpcRequest("getConfirmedSignaturesForAddress2",n),F7);if("error"in i)throw new ot(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(r,e,t){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],t,void 0,e),i=We(await this._rpcRequest("getSignaturesForAddress",n),$7);if("error"in i)throw new ot(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(r,e){const{context:t,value:n}=await this.getAccountInfoAndContext(r,e);let i=null;return n!==null&&(i=new Ad({key:r,state:Ad.deserialize(n.data)})),{context:t,value:i}}async getNonceAndContext(r,e){const{context:t,value:n}=await this.getAccountInfoAndContext(r,e);let i=null;return n!==null&&(i=ph.fromAccountData(n.data)),{context:t,value:i}}async getNonce(r,e){return await this.getNonceAndContext(r,e).then(t=>t.value).catch(t=>{throw new Error("failed to get nonce for account "+r.toBase58()+": "+t)})}async requestAirdrop(r,e){const t=We(await this._rpcRequest("requestAirdrop",[r.toBase58(),e]),yI);if("error"in t)throw new ot(t.error,`airdrop to ${r.toBase58()} failed`);return t.result}async _blockhashWithExpiryBlockHeight(r){if(!r){for(;this._pollingBlockhash;)await fs(100);const e=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(this._blockhashInfo.latestBlockhash!==null&&!e)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const r=Date.now(),e=this._blockhashInfo.latestBlockhash,t=e?e.blockhash:null;for(let n=0;n<50;n++){const i=await this.getLatestBlockhash("finalized");if(t!==i.blockhash)return this._blockhashInfo={latestBlockhash:i,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},i;await fs(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-r}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(r){const{commitment:e,config:t}=gr(r),n=this._buildArgs([],e,"base64",t),i=We(await this._rpcRequest("getStakeMinimumDelegation",n),Mr(ae()));if("error"in i)throw new ot(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(r,e,t){if("message"in r){const _=r.serialize(),E=Ze.Buffer.from(_).toString("base64");if(Array.isArray(e)||t!==void 0)throw new Error("Invalid arguments");const m=e||{};m.encoding="base64","commitment"in m||(m.commitment=this.commitment);const w=[E,m],v=We(await this._rpcRequest("simulateTransaction",w),ew);if("error"in v)throw new Error("failed to simulate transaction: "+v.error.message);return v.result}let n;if(r instanceof Gt){let _=r;n=new Gt,n.feePayer=_.feePayer,n.instructions=r.instructions,n.nonceInfo=_.nonceInfo,n.signatures=_.signatures}else n=Gt.populate(r),n._message=n._json=void 0;if(e!==void 0&&!Array.isArray(e))throw new Error("Invalid arguments");const i=e;if(n.nonceInfo&&i)n.sign(...i);else{let _=this._disableBlockhashCaching;for(;;){const E=await this._blockhashWithExpiryBlockHeight(_);if(n.lastValidBlockHeight=E.lastValidBlockHeight,n.recentBlockhash=E.blockhash,!i)break;if(n.sign(...i),!n.signature)throw new Error("!signature");const m=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(m)&&!this._blockhashInfo.transactionSignatures.includes(m)){this._blockhashInfo.simulatedSignatures.push(m);break}_=!0}}const o=n._compile(),s=o.serialize(),a=n._serialize(s).toString("base64"),u={encoding:"base64",commitment:this.commitment};if(t){const _=(Array.isArray(t)?t:o.nonProgramIds()).map(E=>E.toBase58());u.accounts={encoding:"base64",addresses:_}}i&&(u.sigVerify=!0);const l=[a,u],d=We(await this._rpcRequest("simulateTransaction",l),ew);if("error"in d){let _;if("data"in d.error&&(_=d.error.data.logs,_&&Array.isArray(_))){const E=` - `,m=E+_.join(E);console.error(d.error.message,m)}throw new ka("failed to simulate transaction: "+d.error.message,_)}return d.result}async sendTransaction(r,e,t){if("version"in r){if(e&&Array.isArray(e))throw new Error("Invalid arguments");const o=r.serialize();return await this.sendRawTransaction(o,e)}if(e===void 0||!Array.isArray(e))throw new Error("Invalid arguments");const n=e;if(r.nonceInfo)r.sign(...n);else{let o=this._disableBlockhashCaching;for(;;){const s=await this._blockhashWithExpiryBlockHeight(o);if(r.lastValidBlockHeight=s.lastValidBlockHeight,r.recentBlockhash=s.blockhash,r.sign(...n),!r.signature)throw new Error("!signature");const a=r.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(a)){this._blockhashInfo.transactionSignatures.push(a);break}o=!0}}const i=r.serialize();return await this.sendRawTransaction(i,t)}async sendRawTransaction(r,e){const t=Ut(r).toString("base64");return await this.sendEncodedTransaction(t,e)}async sendEncodedTransaction(r,e){const t={encoding:"base64"},n=e&&e.skipPreflight,i=e&&e.preflightCommitment||this.commitment;e&&e.maxRetries!=null&&(t.maxRetries=e.maxRetries),e&&e.minContextSlot!=null&&(t.minContextSlot=e.minContextSlot),n&&(t.skipPreflight=n),i&&(t.preflightCommitment=i);const o=[r,t],s=We(await this._rpcRequest("sendTransaction",o),mI);if("error"in s){let a;throw"data"in s.error&&(a=s.error.data.logs),new ka("failed to send transaction: "+s.error.message,a)}return s.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(r){this._rpcWebSocketConnected=!1,console.error("ws error:",r.message)}_wsOnClose(r){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),r!==1e3?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([e,t])=>{this._setSubscription(e,{...t,state:"pending"})})):this._updateSubscriptions()}_setSubscription(r,e){var n;const t=(n=this._subscriptionsByHash[r])==null?void 0:n.state;if(this._subscriptionsByHash[r]=e,t!==e.state){const i=this._subscriptionStateChangeCallbacksByHash[r];i&&i.forEach(o=>{try{o(e.state)}catch{}})}}_onSubscriptionStateChange(r,e){var i;const t=this._subscriptionHashByClientSubscriptionId[r];if(t==null)return()=>{};const n=(i=this._subscriptionStateChangeCallbacksByHash)[t]||(i[t]=new Set);return n.add(e),()=>{n.delete(e),n.size===0&&delete this._subscriptionStateChangeCallbacksByHash[t]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log(`Error when closing socket connection: ${t.message}`)}},500)));if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const r=this._rpcWebSocketGeneration,e=()=>r===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async t=>{const n=this._subscriptionsByHash[t];if(n!==void 0)switch(n.state){case"pending":case"unsubscribed":if(n.callbacks.size===0)return delete this._subscriptionsByHash[t],n.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:i,method:o}=n;try{this._setSubscription(t,{...n,state:"subscribing"});const s=await this._rpcWebSocket.call(o,i);this._setSubscription(t,{...n,serverSubscriptionId:s,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[s]=n.callbacks,await this._updateSubscriptions()}catch(s){if(s instanceof Error&&console.error(`${o} error for argument`,i,s.message),!e())return;this._setSubscription(t,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":n.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:i,unsubscribeMethod:o}=n;if(this._subscriptionsAutoDisposedByRpc.has(i))this._subscriptionsAutoDisposedByRpc.delete(i);else{this._setSubscription(t,{...n,state:"unsubscribing"}),this._setSubscription(t,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(o,[i])}catch(s){return s instanceof Error&&console.error(`${o} error:`,s.message),e()?(this._setSubscription(t,{...n,state:"subscribed"}),void await this._updateSubscriptions()):void 0}}this._setSubscription(t,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(r,e){const t=this._subscriptionCallbacksByServerSubscriptionId[r];t!==void 0&&t.forEach(n=>{try{n(...e)}catch(i){console.error(i)}})}_wsOnAccountNotification(r){const{result:e,subscription:t}=We(r,K7);this._handleServerNotification(t,[e.value,e.context])}_makeSubscription(r,e){const t=this._nextClientSubscriptionId++,n=Xm([r.method,e],!0),i=this._subscriptionsByHash[n];return i===void 0?this._subscriptionsByHash[n]={...r,args:e,callbacks:new Set([r.callback]),state:"pending"}:i.callbacks.add(r.callback),this._subscriptionHashByClientSubscriptionId[t]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[t]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[t],delete this._subscriptionHashByClientSubscriptionId[t];const o=this._subscriptionsByHash[n];Yt(o!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${t}`),o.callbacks.delete(r.callback),await this._updateSubscriptions()},this._updateSubscriptions(),t}onAccountChange(r,e,t){const n=this._buildArgs([r.toBase58()],t||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},n)}async removeAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"account change")}_wsOnProgramAccountNotification(r){const{result:e,subscription:t}=We(r,q7);this._handleServerNotification(t,[{accountId:e.value.pubkey,accountInfo:e.value.account},e.context])}onProgramAccountChange(r,e,t,n){const i=this._buildArgs([r.toBase58()],t||this._commitment||"finalized","base64",n?{filters:n}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}async removeProgramAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"program account change")}onLogs(r,e,t){const n=this._buildArgs([typeof r=="object"?{mentions:[r.toString()]}:r],t||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(r){await this._unsubscribeClientSubscription(r,"logs")}_wsOnLogsNotification(r){const{result:e,subscription:t}=We(r,bI);this._handleServerNotification(t,[e.value,e.context])}_wsOnSlotNotification(r){const{result:e,subscription:t}=We(r,W7);this._handleServerNotification(t,[e])}onSlotChange(r){return this._makeSubscription({callback:r,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(r){await this._unsubscribeClientSubscription(r,"slot change")}_wsOnSlotUpdatesNotification(r){const{result:e,subscription:t}=We(r,G7);this._handleServerNotification(t,[e])}onSlotUpdate(r){return this._makeSubscription({callback:r,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(r){await this._unsubscribeClientSubscription(r,"slot update")}async _unsubscribeClientSubscription(r,e){const t=this._subscriptionDisposeFunctionsByClientSubscriptionId[r];t?await t():console.warn(`Ignored unsubscribe request because an active subscription with id \`${r}\` for '${e}' events could not be found.`)}_buildArgs(r,e,t,n){const i=e||this._commitment;if(i||t||n){let o={};t&&(o.encoding=t),i&&(o.commitment=i),n&&(o=Object.assign(o,n)),r.push(o)}return r}_buildArgsAtLeastConfirmed(r,e,t,n){const i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(r,e,t,n)}_wsOnSignatureNotification(r){const{result:e,subscription:t}=We(r,Y7);e.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(t),this._handleServerNotification(t,e.value==="receivedSignature"?[{type:"received"},e.context]:[{type:"status",result:e.value},e.context])}onSignature(r,e,t){const n=this._buildArgs([r],t||this._commitment||"finalized"),i=this._makeSubscription({callback:(o,s)=>{if(o.type==="status"){e(o.result,s);try{this.removeSignatureListener(i)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return i}onSignatureWithOptions(r,e,t){const{commitment:n,...i}={...t,commitment:t&&t.commitment||this._commitment||"finalized"},o=this._buildArgs([r],n,void 0,i),s=this._makeSubscription({callback:(a,u)=>{e(a,u);try{this.removeSignatureListener(s)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(r){await this._unsubscribeClientSubscription(r,"signature result")}_wsOnRootNotification(r){const{result:e,subscription:t}=We(r,J7);this._handleServerNotification(t,[e])}onRootChange(r){return this._makeSubscription({callback:r,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(r){await this._unsubscribeClientSubscription(r,"root change")}},Ed25519Program:yf,Enum:class extends H0{constructor(r){if(super(r),this.enum="",Object.keys(r).length!==1)throw new Error("Enum can only take single value");Object.keys(r).map(e=>{this.enum=e})}},EpochSchedule:Qm,FeeCalculatorLayout:c3,Keypair:Sa,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:po,Loader:Ts,Lockup:dc,MAX_SEED_LENGTH:32,Message:qo,MessageAccountKeys:lc,MessageV0:Fs,NONCE_ACCOUNT_LENGTH:hc,NonceAccount:ph,PACKET_DATA_SIZE:Aa,PUBLIC_KEY_LENGTH:Vn,PublicKey:ye,SIGNATURE_LENGTH_IN_BYTES:Va,SOLANA_SCHEMA:Hu,STAKE_CONFIG_ID:b3,STAKE_INSTRUCTION_LAYOUTS:Vr,SYSTEM_INSTRUCTION_LAYOUTS:hr,SYSVAR_CLOCK_PUBKEY:gi,SYSVAR_EPOCH_SCHEDULE_PUBKEY:e7,SYSVAR_INSTRUCTIONS_PUBKEY:t7,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Wl,SYSVAR_RENT_PUBKEY:Jo,SYSVAR_REWARDS_PUBKEY:r7,SYSVAR_SLOT_HASHES_PUBKEY:n7,SYSVAR_SLOT_HISTORY_PUBKEY:i7,SYSVAR_STAKE_HISTORY_PUBKEY:Zl,Secp256k1Program:Ia,SendTransactionError:ka,SolanaJSONRPCError:ot,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:EI,StakeInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const e=Qe("instruction").decode(r.data);let t;for(const[n,i]of Object.entries(Vr))if(i.index==e){t=n;break}if(!t)throw new Error("Instruction type incorrect; not a StakeInstruction");return t}static decodeInitialize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{authorized:e,lockup:t}=ir(Vr.Initialize,r.data);return{stakePubkey:r.keys[0].pubkey,authorized:new aw(new ye(e.staker),new ye(e.withdrawer)),lockup:new dc(t.unixTimestamp,t.epoch,new ye(t.custodian))}}static decodeDelegate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,6),ir(Vr.Delegate,r.data),{stakePubkey:r.keys[0].pubkey,votePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[5].pubkey}}static decodeAuthorize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{newAuthorized:e,stakeAuthorizationType:t}=ir(Vr.Authorize,r.data),n={stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey,newAuthorizedPubkey:new ye(e),stakeAuthorizationType:{index:t}};return r.keys.length>3&&(n.custodianPubkey=r.keys[3].pubkey),n}static decodeAuthorizeWithSeed(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{newAuthorized:e,stakeAuthorizationType:t,authoritySeed:n,authorityOwner:i}=ir(Vr.AuthorizeWithSeed,r.data),o={stakePubkey:r.keys[0].pubkey,authorityBase:r.keys[1].pubkey,authoritySeed:n,authorityOwner:new ye(i),newAuthorizedPubkey:new ye(e),stakeAuthorizationType:{index:t}};return r.keys.length>3&&(o.custodianPubkey=r.keys[3].pubkey),o}static decodeSplit(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{lamports:e}=ir(Vr.Split,r.data);return{stakePubkey:r.keys[0].pubkey,splitStakePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[2].pubkey,lamports:e}}static decodeMerge(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),ir(Vr.Merge,r.data),{stakePubkey:r.keys[0].pubkey,sourceStakePubKey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey}}static decodeWithdraw(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,5);const{lamports:e}=ir(Vr.Withdraw,r.data),t={stakePubkey:r.keys[0].pubkey,toPubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey,lamports:e};return r.keys.length>5&&(t.custodianPubkey=r.keys[5].pubkey),t}static decodeDeactivate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),ir(Vr.Deactivate,r.data),{stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey}}static checkProgramId(r){if(!r.equals(yh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(r,e){if(r.length({decode:r.decode.bind(r),encode:r.encode.bind(r)}),Gl=(r=>e=>{const t=lr(r,e),{encode:n,decode:i}=rg(t),o=t;return o.decode=(s,a)=>{const u=i(s,a);return j6(Ae.Buffer.from(u))},o.encode=(s,a,u)=>{const l=F1(s,r);return n(l,a,u)},o})(8),E3=r=>{const e=jt(r),{encode:t,decode:n}=rg(e),i=e;return i.decode=(o,s)=>!!n(o,s),i.encode=(o,s,a)=>{const u=Number(o);return t(u,s,a)},i},tn=r=>{const e=lr(32,r),{encode:t,decode:n}=rg(e),i=e;return i.decode=(o,s)=>{const a=n(o,s);return new ye(a)},i.encode=(o,s,a)=>{const u=o.toBuffer();return t(u,s,a)},i};class MI extends Error{constructor(e){super(e)}}class PI extends MI{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var hw;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Mint=1]="Mint",r[r.Account=2]="Account"})(hw||(hw={}));rt([jt("m"),jt("n"),E3("isInitialized"),tn("signer1"),tn("signer2"),tn("signer3"),tn("signer4"),tn("signer5"),tn("signer6"),tn("signer7"),tn("signer8"),tn("signer9"),tn("signer10"),tn("signer11")]).span;var fw;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initialized=1]="Initialized",r[r.Frozen=2]="Frozen"})(fw||(fw={}));const LI=rt([tn("mint"),tn("owner"),Gl("amount"),Qe("delegateOption"),tn("delegate"),jt("state"),Qe("isNativeOption"),Gl("isNative"),Gl("delegatedAmount"),Qe("closeAuthorityOption"),tn("closeAuthority")]);LI.span;const CI=rt([Qe("mintAuthorityOption"),tn("mintAuthority"),Gl("supply"),jt("decimals"),E3("isInitialized"),Qe("freezeAuthorityOption"),tn("freezeAuthority")]);CI.span;function dw(r,e,t=!1,n=mh,i=rp){if(!t&&!ye.isOnCurve(e.toBuffer()))throw new PI;const[o]=ye.findProgramAddressSync([e.toBuffer(),n.toBuffer(),r.toBuffer()],i);return o}function TI(r,e,t,n,i=mh,o=rp){return function(s,a,u,l,d,_=mh,E=rp){const m=[{pubkey:s,isSigner:!0,isWritable:!0},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!1},{pubkey:l,isSigner:!1,isWritable:!1},{pubkey:Cr.programId,isSigner:!1,isWritable:!1},{pubkey:_,isSigner:!1,isWritable:!1}];return new rr({keys:m,programId:E,data:d})}(r,e,t,n,Ae.Buffer.alloc(0),i,o)}var pc;(function(r){r.SymbolNotFound="SymbolNotFound",r.InvalidSubdomain="InvalidSubdomain",r.FavouriteDomainNotFound="FavouriteDomainNotFound",r.MissingParentOwner="MissingParentOwner",r.U32Overflow="U32Overflow",r.InvalidBufferLength="InvalidBufferLength",r.U64Overflow="U64Overflow",r.NoRecordData="NoRecordData",r.InvalidRecordData="InvalidRecordData",r.UnsupportedRecord="UnsupportedRecord",r.InvalidEvmAddress="InvalidEvmAddress",r.InvalidInjectiveAddress="InvalidInjectiveAddress",r.InvalidARecord="InvalidARecord",r.InvalidAAAARecord="InvalidAAAARecord",r.InvalidRecordInput="InvalidRecordInput",r.InvalidSignature="InvalidSignature",r.AccountDoesNotExist="AccountDoesNotExist",r.MultipleRegistries="MultipleRegistries",r.InvalidReverseTwitter="InvalidReverseTwitter",r.NoAccountData="NoAccountData",r.InvalidInput="InvalidInput",r.InvalidDomain="InvalidDomain",r.InvalidCustomBg="InvalidCustomBackground",r.UnsupportedSignature="UnsupportedSignature",r.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",r.RecordIsNotSigned="RecordIsNotSigned",r.UnsupportedSignatureType="UnsupportedSignatureType",r.InvalidSolRecordV2="InvalidSolRecordV2",r.MissingVerifier="MissingVerifier"})(pc||(pc={}));class gc extends Error{constructor(e,t){super(t),this.name="SNSError",this.type=e,Error.captureStackTrace&&Error.captureStackTrace(this,gc)}}class yc{constructor(e){this.tag=13,this.name=e.name,this.space=e.space,this.referrerIdxOpt=e.referrerIdxOpt}serialize(){return C1(yc.schema,this)}getInstruction(e,t,n,i,o,s,a,u,l,d,_,E,m,w,v,A,I){const B=Ze.Buffer.from(this.serialize());let S=[];return S.push({pubkey:t,isSigner:!1,isWritable:!1}),S.push({pubkey:n,isSigner:!1,isWritable:!1}),S.push({pubkey:i,isSigner:!1,isWritable:!0}),S.push({pubkey:o,isSigner:!1,isWritable:!0}),S.push({pubkey:s,isSigner:!1,isWritable:!1}),S.push({pubkey:a,isSigner:!1,isWritable:!1}),S.push({pubkey:u,isSigner:!0,isWritable:!0}),S.push({pubkey:l,isSigner:!1,isWritable:!0}),S.push({pubkey:d,isSigner:!1,isWritable:!1}),S.push({pubkey:_,isSigner:!1,isWritable:!1}),S.push({pubkey:E,isSigner:!1,isWritable:!1}),S.push({pubkey:m,isSigner:!1,isWritable:!0}),S.push({pubkey:w,isSigner:!1,isWritable:!1}),S.push({pubkey:v,isSigner:!1,isWritable:!1}),S.push({pubkey:A,isSigner:!1,isWritable:!1}),I&&S.push({pubkey:I,isSigner:!1,isWritable:!0}),new rr({keys:S,programId:e,data:B})}}yc.schema=new Map([[yc,{kind:"struct",fields:[["tag","u8"],["name","string"],["space","u32"],["referrerIdxOpt",{kind:"option",type:"u16"}]]}]]);new ye("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk");Ze.Buffer.from("tokenized_name");var pw;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.CentralState=1]="CentralState",r[r.ActiveRecord=2]="ActiveRecord",r[r.InactiveRecord=3]="InactiveRecord"})(pw||(pw={}));var x3={},Vt={},Wc=A3;function A3(r,e){if(!r)throw new Error(e||"Assertion failed")}A3.equal=function(r,e,t){if(r!=e)throw new Error(t||"Assertion failed: "+r+" != "+e)};var np={exports:{}};typeof Object.create=="function"?np.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:np.exports=function(r,e){if(e){r.super_=e;var t=function(){};t.prototype=e.prototype,r.prototype=new t,r.prototype.constructor=r}};var OI=np.exports,RI=Wc,UI=OI;function NI(r,e){return(64512&r.charCodeAt(e))==55296&&!(e<0||e+1>=r.length)&&(64512&r.charCodeAt(e+1))==56320}function gw(r){return(r>>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function yw(r){return r.length===1?"0"+r:r}function mw(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}Vt.inherits=UI,Vt.toArray=function(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),i=0;i>6|192,t[n++]=63&o|128):NI(r,i)?(o=65536+((1023&o)<<10)+(1023&r.charCodeAt(++i)),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128)}else for(i=0;i>>0}return o},Vt.split32=function(r,e){for(var t=new Array(4*r.length),n=0,i=0;n>>24,t[i+1]=o>>>16&255,t[i+2]=o>>>8&255,t[i+3]=255&o):(t[i+3]=o>>>24,t[i+2]=o>>>16&255,t[i+1]=o>>>8&255,t[i]=255&o)}return t},Vt.rotr32=function(r,e){return r>>>e|r<<32-e},Vt.rotl32=function(r,e){return r<>>32-e},Vt.sum32=function(r,e){return r+e>>>0},Vt.sum32_3=function(r,e,t){return r+e+t>>>0},Vt.sum32_4=function(r,e,t,n){return r+e+t+n>>>0},Vt.sum32_5=function(r,e,t,n,i){return r+e+t+n+i>>>0},Vt.sum64=function(r,e,t,n){var i=r[e],o=n+r[e+1]>>>0,s=(o>>0,r[e+1]=o},Vt.sum64_hi=function(r,e,t,n){return(e+n>>>0>>0},Vt.sum64_lo=function(r,e,t,n){return e+n>>>0},Vt.sum64_4_hi=function(r,e,t,n,i,o,s,a){var u=0,l=e;return u+=(l=l+n>>>0)>>0)>>0)>>0},Vt.sum64_4_lo=function(r,e,t,n,i,o,s,a){return e+n+o+a>>>0},Vt.sum64_5_hi=function(r,e,t,n,i,o,s,a,u,l){var d=0,_=e;return d+=(_=_+n>>>0)>>0)>>0)>>0)>>0},Vt.sum64_5_lo=function(r,e,t,n,i,o,s,a,u,l){return e+n+o+a+l>>>0},Vt.rotr64_hi=function(r,e,t){return(e<<32-t|r>>>t)>>>0},Vt.rotr64_lo=function(r,e,t){return(r<<32-t|e>>>t)>>>0},Vt.shr64_hi=function(r,e,t){return r>>>t},Vt.shr64_lo=function(r,e,t){return(r<<32-t|e>>>t)>>>0};var ou={},ww=Vt,DI=Wc;function wl(){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}ou.BlockHash=wl,wl.prototype.update=function(r,e){if(r=ww.toArray(r,e),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){var t=(r=this.pending).length%this._delta8;this.pending=r.slice(r.length-t,r.length),this.pending.length===0&&(this.pending=null),r=ww.join32(r,0,r.length-t,this.endian);for(var n=0;n>>24&255,n[i++]=r>>>16&255,n[i++]=r>>>8&255,n[i++]=255&r}else for(n[i++]=255&r,n[i++]=r>>>8&255,n[i++]=r>>>16&255,n[i++]=r>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3},Ti.g1_256=function(r){return Si(r,17)^Si(r,19)^r>>>10};var Wa=Vt,zI=ou,jI=Ti,Bd=Wa.rotl32,wu=Wa.sum32,FI=Wa.sum32_5,$I=jI.ft_1,k3=zI.BlockHash,KI=[1518500249,1859775393,2400959708,3395469782];function zi(){if(!(this instanceof zi))return new zi;k3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Wa.inherits(zi,k3);var VI=zi;zi.blockSize=512,zi.outSize=160,zi.hmacStrength=80,zi.padLength=64,zi.prototype._update=function(r,e){for(var t=this.W,n=0;n<16;n++)t[n]=r[e+n];for(;nthis.blockSize&&(r=new this.Hash().update(r).digest()),L9(r.length<=this.blockSize);for(var e=r.length;e{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}();var sp,di;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(sp||(sp={})),function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"}(di||(di={}));const Mw="0123456789abcdef";class Sr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();Yl[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),Iw>Yl[n]||console.log.apply(console,t)}debug(...e){this._log(Sr.levels.DEBUG,e)}info(...e){this._log(Sr.levels.INFO,e)}warn(...e){this._log(Sr.levels.WARNING,e)}makeError(e,t,n){if(Sw)return this.makeError("censored error",t,{});t||(t=Sr.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 _=0;_>4],d+=Mw[15&l[_]];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=${t}`),i.push(`version=${this.version}`);const o=e;let s="";switch(t){case di.NUMERIC_FAULT:{s="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":s+="-"+u;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case di.CALL_EXCEPTION:case di.INSUFFICIENT_FUNDS:case di.MISSING_NEW:case di.NONCE_EXPIRED:case di.REPLACEMENT_UNDERPRICED:case di.TRANSACTION_REPLACED:case di.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=o,a.code=t,Object.keys(n).forEach(function(u){a[u]=n[u]}),a}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,Sr.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,i){e||this.throwError(t,n,i)}assertArgument(e,t,n,i){e||this.throwArgumentError(t,n,i)}checkNormalize(e){Bw&&this.throwError("platform missing String.prototype.normalize",Sr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Bw})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Sr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Sr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",et&&this.throwError("too many arguments"+n,Sr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&e!=null||this.throwError("missing new",Sr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Sr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&e!=null||this.throwError("missing new",Sr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Ld||(Ld=new Sr("logger/5.7.0")),Ld}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Sr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),kw){if(!e)return;this.globalLogger().throwError("error censorship permanent",Sr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Sw=!!e,kw=!!t}static setLogLevel(e){const t=Yl[e.toLowerCase()];t!=null?Iw=t:Sr.globalLogger().warn("invalid log level - "+e)}static from(e){return new Sr(e)}}Sr.errors=di,Sr.levels=sp;const Cd=new Sr("bytes/5.7.0");function Jl(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return Jl(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function Pw(r){return typeof r=="number"&&r==r&&r%1==0}function O9(r,e){if(e||(e={}),typeof r=="number"){Cd.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(255&r),r=parseInt(String(r/256));return t.length===0&&t.push(0),Jl(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),function(t){return!!t.toHexString}(r)&&(r=r.toHexString()),function(t,n){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||n&&t.length!==2+2*n)}(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Cd.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let i=0;i=256)return!1}return!0}(r)?Jl(new Uint8Array(r)):Cd.throwArgumentError("invalid arrayify value","value",r)}function R9(r){return"0x"+T9.sha256().update(O9(r)).digest("hex")}const U3=new ye("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),U9="SPL Name Service",wh=new ye("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),vl=new ye("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR");new ye("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF");new ye("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc");new ye("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z");new ye("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi");new ye("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv");new ye("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7");const N9=new ye("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),N3=[new ye("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new ye("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new ye("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new ye("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new ye("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new ye("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new ye("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u")],D9=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["FeGn77dhg1KXRRFeSwwMiykZnZPw5JXW6naf2aQgZDQf","ETH"],["7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx","GMT"],["AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB","GST"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"]]),z9=new ye("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),j9=new ye("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi");new ye("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz");new ye("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT");new ye("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");var Lw={},ap=$c(_3),Ma={};Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.readBigUInt64LE=Ma.readBigInt64LE=void 0;var F9=function(){return new Error("Attempt to access memory outside buffer bounds")},$9=function(r,e,t){return new Error('The "'+r+'" argument must be of type '+e+". Received "+t)},Cw=function(r,e,t){return new Error('The value of "'+r+" is out of range. It must be "+e+". Received "+t)};function up(r,e){if(typeof r!="number")throw $9(e,"number",r)}function Tw(r,e){throw Math.floor(r)!==r?(up(r,"offset"),Cw("offset","an integer",r)):e<0?F9():Cw("offset",">= 0 and <= "+e,r)}Ma.readBigInt64LE=function(r,e){e===void 0&&(e=0),up(e,"offset");var t=r[e],n=r[e+7];t!==void 0&&n!==void 0||Tw(e,r.length-8);var i=r[e+4]+r[e+5]*Math.pow(2,8)+r[e+6]*Math.pow(2,16)+(n<<24);return(BigInt(i)<0&&l[l.length-1])||v[0]!==6&&v[0]!==2)){_=0;continue}if(v[0]===3&&(!l||v[1]>l[0]&&v[1]0&&u[u.length-1])||w[0]!==6&&w[0]!==2)){d=0;continue}if(w[0]===3&&(!u||w[1]>u[0]&&w[1]{if(typeof l!="string"&&!Array.isArray(l))throw new TypeError("Expected the input to be `string | string[]`");if(d={pascalCase:!1,preserveConsecutiveUppercase:!1,...d},l=Array.isArray(l)?l.map(m=>m.trim()).filter(m=>m.length).join("-"):l.trim(),l.length===0)return"";const _=d.locale===!1?m=>m.toLowerCase():m=>m.toLocaleLowerCase(d.locale),E=d.locale===!1?m=>m.toUpperCase():m=>m.toLocaleUpperCase(d.locale);return l.length===1?d.pascalCase?E(l):_(l):(l!==_(l)&&(l=((m,w,v)=>{let A=!1,I=!1,B=!1;for(let S=0;S(t.lastIndex=0,m.replace(t,v=>w(v))))(l,_):_(l),d.pascalCase&&(l=E(l.charAt(0))+l.slice(1)),((m,w)=>(s.lastIndex=0,a.lastIndex=0,m.replace(s,(v,A)=>w(A)).replace(a,v=>w(v))))(l,E))};return _l.exports=u,_l.exports.default=u,_l.exports}var dr=_i(cp()),Bt={},Je={};class ar{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function ng(r,e){return e.property?r+"["+e.property+"]":r}Je.Layout=ar,Je.nameWithProperty=ng,Je.bindConstructorLayout=function(r,e){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ar))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=e,e.boundConstructor_=r,e.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};class xn extends ar{isCount(){throw new Error("ExternalLayout is abstract")}}class jw extends xn{constructor(e,t){if(e===void 0&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){t===void 0&&(t=0);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}class lp extends xn{constructor(e,t,n){if(!(e instanceof ar))throw new TypeError("layout must be a Layout");if(t===void 0)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof Ui||this.layout instanceof ao}decode(e,t){return t===void 0&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return n===void 0&&(n=0),this.layout.encode(e,t,n+this.offset)}}class Ui extends ar{constructor(e,t){if(super(e,t),6s+i.encode(a,t,n+s),0);return this.count instanceof xn&&this.count.encode(e.length,t,n),o}}class Hw extends ar{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce((o,s)=>o&&s instanceof ar,!0))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&n===void 0&&(n=t,t=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,t);return t+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,t){t===void 0&&(t=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let u=a.span;if(s=0u&&(u=a.getSpan(t,n)))}o=n,n+=u}return o+s-i}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?t=-1:0<=t&&(t+=n.span)}}}class ig{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class bh extends ig{constructor(e,t){if(!(e instanceof xn&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class fp extends ar{constructor(e,t,n){const i=e instanceof Ui||e instanceof ao;if(i)e=new bh(new lp(e));else if(e instanceof xn&&e.isCount())e=new bh(e);else if(!(e instanceof ig))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof ar))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&i&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=i,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;t===void 0&&(t=0);const i=this.discriminator,o=i.decode(e,t);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(e,t+a)}else n=s.decode(e,t);return n}encode(e,t,n){n===void 0&&(n=0);const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(e[o.property],t,n),a+s.encode(e[s.property],t,n+a)}return i.encode(e,t,n)}addVariant(e,t,n){const i=new D3(this,e,t,n);return this.registry[e]=i,i}getVariant(e,t){let n=e;return Ae.Buffer.isBuffer(e)&&(t===void 0&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class D3 extends ar{constructor(e,t,n,i){if(!(e instanceof fp))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof ar))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(t===void 0&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],t,n+i),o+=this.layout.getSpan(t,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function pa(r){return 0>r&&(r+=4294967296),r}class dp extends ar{constructor(e,t,n){if(!(e instanceof Ui||e instanceof ao))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&n===void 0&&(n=t,t=void 0),4=t)throw new TypeError("bits must be positive integer");const i=8*e.span,o=e.fields.reduce((s,a)=>s+a.bits,0);if(t+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<>>this.start}encode(e){if(!Number.isInteger(e)||e!==pa(e&this.valueMask))throw new TypeError(ng("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=pa(e<n&&(n=this.length.decode(e,t)),n}decode(e,t){t===void 0&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof xn&&(i=e.length),!Ae.Buffer.isBuffer(e)||i!==e.length)throw new TypeError(ng("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,i,"hex"),this.length instanceof xn&&this.length.encode(i,t,n),i}}class Zw extends ar{constructor(e){super(-1,e)}getSpan(e,t){if(!Ae.Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");t===void 0&&(t=0);let n=t;for(;nt.length)throw new RangeError("encoding overruns Buffer");return i.copy(t,n),t[n+o]=0,o+1}}class Gw extends ar{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t){if(!Ae.Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");return t===void 0&&(t=0),e.length-t}decode(e,t,n){t===void 0&&(t=0);let i=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpant.length)throw new RangeError("encoding overruns Buffer");return i.copy(t,n),o}}class Yw extends ar{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}}Je.ExternalLayout=xn,Je.GreedyCount=jw,Je.OffsetLayout=lp,Je.UInt=Ui,Je.UIntBE=ao,Je.Int=as,Je.IntBE=ia,Je.Float=Fw,Je.FloatBE=$w,Je.Double=Kw,Je.DoubleBE=Vw,Je.Sequence=qw,Je.Structure=Hw,Je.UnionDiscriminator=ig,Je.UnionLayoutDiscriminator=bh,Je.Union=fp,Je.VariantLayout=D3,Je.BitStructure=dp,Je.BitField=Wu,Je.Boolean=z3,Je.Blob=Ww,Je.CString=Zw,Je.UTF8=Gw,Je.Constant=Yw,Je.greedy=(r,e)=>new jw(r,e),Je.offset=(r,e,t)=>new lp(r,e,t),Je.u8=r=>new Ui(1,r),Je.u16=r=>new Ui(2,r),Je.u24=r=>new Ui(3,r),Je.u32=r=>new Ui(4,r),Je.u40=r=>new Ui(5,r),Je.u48=r=>new Ui(6,r),Je.nu64=r=>new q9(r),Je.u16be=r=>new ao(2,r),Je.u24be=r=>new ao(3,r),Je.u32be=r=>new ao(4,r),Je.u40be=r=>new ao(5,r),Je.u48be=r=>new ao(6,r),Je.nu64be=r=>new H9(r),Je.s8=r=>new as(1,r),Je.s16=r=>new as(2,r),Je.s24=r=>new as(3,r),Je.s32=r=>new as(4,r),Je.s40=r=>new as(5,r),Je.s48=r=>new as(6,r),Je.ns64=r=>new W9(r),Je.s16be=r=>new ia(2,r),Je.s24be=r=>new ia(3,r),Je.s32be=r=>new ia(4,r),Je.s40be=r=>new ia(5,r),Je.s48be=r=>new ia(6,r),Je.ns64be=r=>new Z9(r),Je.f32=r=>new Fw(r),Je.f32be=r=>new $w(r),Je.f64=r=>new Kw(r),Je.f64be=r=>new Vw(r),Je.struct=(r,e,t)=>new Hw(r,e,t),Je.bits=(r,e,t)=>new dp(r,e,t),Je.seq=(r,e,t)=>new qw(r,e,t),Je.union=(r,e,t)=>new fp(r,e,t),Je.unionLayoutDiscriminator=(r,e)=>new bh(r,e),Je.blob=(r,e)=>new Ww(r,e),Je.cstr=r=>new Zw(r),Je.utf8=(r,e)=>new Gw(r,e),Je.const=(r,e)=>new Yw(r,e),function(r){var e=vt&&vt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const t=Je,n=ap,i=e(P1);var o=Je;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return o.struct}});class s extends t.Layout{constructor(v,A,I){super(v,I),this.blob=(0,t.blob)(v),this.signed=A}decode(v,A=0){const I=new i.default(this.blob.decode(v,A),10,"le");return this.signed?I.fromTwos(8*this.span).clone():I}encode(v,A,I=0){return this.signed&&(v=v.toTwos(8*this.span)),this.blob.encode(v.toArrayLike(Ae.Buffer,"le",this.span),A,I)}}function a(w){return new s(8,!1,w)}r.u64=a,r.i64=function(w){return new s(8,!0,w)},r.u128=function(w){return new s(16,!1,w)},r.i128=function(w){return new s(16,!0,w)},r.u256=function(w){return new s(32,!1,w)},r.i256=function(w){return new s(32,!0,w)};class u extends t.Layout{constructor(v,A,I,B){super(v.span,B),this.layout=v,this.decoder=A,this.encoder=I}decode(v,A){return this.decoder(this.layout.decode(v,A))}encode(v,A,I){return this.layout.encode(this.encoder(v),A,I)}getSpan(v,A){return this.layout.getSpan(v,A)}}r.publicKey=function(w){return new u((0,t.blob)(32),v=>new n.PublicKey(v),v=>v.toBuffer(),w)};class l extends t.Layout{constructor(v,A){super(-1,A),this.layout=v,this.discriminator=(0,t.u8)()}encode(v,A,I=0){return v==null?this.discriminator.encode(0,A,I):(this.discriminator.encode(1,A,I),this.layout.encode(v,A,I+1)+1)}decode(v,A=0){const I=this.discriminator.decode(v,A);if(I===0)return null;if(I===1)return this.layout.decode(v,A+1);throw new Error("Invalid option "+this.property)}getSpan(v,A=0){const I=this.discriminator.decode(v,A);if(I===0)return 1;if(I===1)return this.layout.getSpan(v,A+1)+1;throw new Error("Invalid option "+this.property)}}function d(w){if(w===0)return!1;if(w===1)return!0;throw new Error("Invalid bool: "+w)}function _(w){return w?1:0}function E(w){const v=(0,t.u32)("length"),A=(0,t.struct)([v,(0,t.blob)((0,t.offset)(v,-v.span),"data")]);return new u(A,({data:I})=>I,I=>({data:I}),w)}r.option=function(w,v){return new l(w,v)},r.bool=function(w){return new u((0,t.u8)(),d,_,w)},r.vec=function(w,v){const A=(0,t.u32)("length"),I=(0,t.struct)([A,(0,t.seq)(w,(0,t.offset)(A,-A.span),"values")]);return new u(I,({values:B})=>B,B=>({values:B}),v)},r.tagged=function(w,v,A){const I=(0,t.struct)([a("tag"),v.replicate("data")]);return new u(I,function({tag:B,data:S}){if(!B.eq(w))throw new Error("Invalid tag, expected: "+w.toString("hex")+", got: "+B.toString("hex"));return S},B=>({tag:w,data:B}),A)},r.vecU8=E,r.str=function(w){return new u(E(),v=>v.toString("utf-8"),v=>Ae.Buffer.from(v,"utf-8"),w)},r.rustEnum=function(w,v,A){const I=(0,t.union)(A??(0,t.u8)(),v);return w.forEach((B,S)=>I.addVariant(S,B,B.property)),I},r.array=function(w,v,A){const I=(0,t.struct)([(0,t.seq)(w,v,"values")]);return new u(I,({values:B})=>B,B=>({values:B}),A)};class m extends t.Layout{constructor(v,A,I){super(v.span+A.span,I),this.keyLayout=v,this.valueLayout=A}decode(v,A){return A=A||0,[this.keyLayout.decode(v,A),this.valueLayout.decode(v,A+this.keyLayout.getSpan(v,A))]}encode(v,A,I){I=I||0;const B=this.keyLayout.encode(v[0],A,I);return B+this.valueLayout.encode(v[1],A,I+B)}getSpan(v,A){return this.keyLayout.getSpan(v,A)+this.valueLayout.getSpan(v,A)}}r.map=function(w,v,A){const I=(0,t.u32)("length"),B=(0,t.struct)([I,(0,t.seq)(new m(w,v),(0,t.offset)(I,-I.span),"values")]);return new u(B,({values:S})=>new Map(S),S=>({values:Array.from(S.entries())}),A)}}(Bt);function au(r){let e=r.length;for(;--e>=0;)r[e]=0}const G9=30,Y9=new Array(576);au(Y9);const J9=new Array(60);au(J9);const X9=new Array(512);au(X9);const Q9=new Array(256);au(Q9);const eB=new Array(29);au(eB);const tB=new Array(G9);au(tB);var pp=(r,e,t,n)=>{let i=65535&r|0,o=r>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do i=i+e[n++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};const rB=new Uint32Array((()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;e[t]=r}return e})());var Ii=(r,e,t,n)=>{const i=rB,o=n+t;r^=-1;for(let s=n;s>>8^i[255&(r^e[s])];return-1^r},gp={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},og={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const nB=(r,e)=>Object.prototype.hasOwnProperty.call(r,e);var j3={assign:function(r){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const n in t)nB(t,n)&&(r[n]=t[n])}}return r},flattenChunks:r=>{let e=0;for(let n=0,i=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;mc[254]=mc[254]=1;var yp={string2buf:r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,n,i,o,s=r.length,a=0;for(i=0;i>>6,e[o++]=128|63&t):t<65536?(e[o++]=224|t>>>12,e[o++]=128|t>>>6&63,e[o++]=128|63&t):(e[o++]=240|t>>>18,e[o++]=128|t>>>12&63,e[o++]=128|t>>>6&63,e[o++]=128|63&t);return e},buf2string:(r,e)=>{const t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let n,i;const o=new Array(2*t);for(i=0,n=0;n4)o[i++]=65533,n+=a-1;else{for(s&=a===2?31:a===3?15:7;a>1&&n1?o[i++]=65533:s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|1023&s)}}return((s,a)=>{if(a<65534&&s.subarray&&F3)return String.fromCharCode.apply(null,s.length===a?s:s.subarray(0,a));let u="";for(let l=0;l{(e=e||r.length)>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(192&r[t])==128;)t--;return t<0||t===0?e:t+mc[r[t]]>e?t:e}},iB=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const El=16209;var oB=function(r,e){let t,n,i,o,s,a,u,l,d,_,E,m,w,v,A,I,B,S,P,C,R,j,H,N;const c=r.state;t=r.next_in,H=r.input,n=t+(r.avail_in-5),i=r.next_out,N=r.output,o=i-(e-r.avail_out),s=i+(r.avail_out-257),a=c.dmax,u=c.wsize,l=c.whave,d=c.wnext,_=c.window,E=c.hold,m=c.bits,w=c.lencode,v=c.distcode,A=(1<>>24,E>>>=S,m-=S,S=B>>>16&255,S===0)N[i++]=65535&B;else{if(!(16&S)){if(!(64&S)){B=w[(65535&B)+(E&(1<>>=S,m-=S),m<15&&(E+=H[t++]<>>24,E>>>=S,m-=S,S=B>>>16&255,!(16&S)){if(!(64&S)){B=v[(65535&B)+(E&(1<a){r.msg="invalid distance too far back",c.mode=El;break e}if(E>>>=S,m-=S,S=i-o,C>S){if(S=C-S,S>l&&c.sane){r.msg="invalid distance too far back",c.mode=El;break e}if(R=0,j=_,d===0){if(R+=u-S,S2;)N[i++]=j[R++],N[i++]=j[R++],N[i++]=j[R++],P-=3;P&&(N[i++]=j[R++],P>1&&(N[i++]=j[R++]))}else{R=i-C;do N[i++]=N[R++],N[i++]=N[R++],N[i++]=N[R++],P-=3;while(P>2);P&&(N[i++]=N[R++],P>1&&(N[i++]=N[R++]))}break}}break}}while(t>3,t-=P,m-=P<<3,E&=(1<{const u=a.bits;let l,d,_,E,m,w,v=0,A=0,I=0,B=0,S=0,P=0,C=0,R=0,j=0,H=0,N=null;const c=new Uint16Array(16),p=new Uint16Array(16);let x,g,h,y=null;for(v=0;v<=xl;v++)c[v]=0;for(A=0;A=1&&c[B]===0;B--);if(S>B&&(S=B),B===0)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(I=1;I0&&(r===0||B!==1))return-1;for(p[1]=0,v=1;v852||r===2&&j>592)return 1;for(;;){x=v-C,s[A]+1=w?(g=y[s[A]-w],h=N[s[A]-w]):(g=96,h=0),l=1<>C)+d]=x<<24|g<<16|h|0;while(d!==0);for(l=1<>=1;if(l!==0?(H&=l-1,H+=l):H=0,A++,--c[v]==0){if(v===B)break;v=e[t+s[A]]}if(v>S&&(H&E)!==_){for(C===0&&(C=S),m+=I,P=v-C,R=1<852||r===2&&j>592)return 1;_=H&E,i[_]=S<<24|P<<16|m-o|0}}return H!==0&&(i[m+H]=v-C<<24|64<<16|0),a.bits=S,0};const{Z_FINISH:Jw,Z_BLOCK:lB,Z_TREES:Al,Z_OK:$s,Z_STREAM_END:hB,Z_NEED_DICT:fB,Z_STREAM_ERROR:oi,Z_DATA_ERROR:$3,Z_MEM_ERROR:K3,Z_BUF_ERROR:dB,Z_DEFLATED:Xw}=og,bf=16180,vh=16190,Qi=16191,Td=16192,Od=16194,kl=16199,Sl=16200,Rd=16206,yr=16209,Qw=r=>(r>>>24&255)+(r>>>8&65280)+((65280&r)<<8)+((255&r)<<24);function pB(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Js=r=>{if(!r)return 1;const e=r.state;return!e||e.strm!==r||e.mode16211?1:0},V3=r=>{if(Js(r))return oi;const e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=1&e.wrap),e.mode=bf,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,$s},q3=r=>{if(Js(r))return oi;const e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,V3(r)},H3=(r,e)=>{let t;if(Js(r))return oi;const n=r.state;return e<0?(t=0,e=-e):(t=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?oi:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,q3(r))},e2=(r,e)=>{if(!r)return oi;const t=new pB;r.state=t,t.strm=r,t.window=null,t.mode=bf;const n=H3(r,e);return n!==$s&&(r.state=null),n};let Ud,Nd,t2=!0;const gB=r=>{if(t2){Ud=new Int32Array(512),Nd=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(Zu(1,r.lens,0,288,Ud,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Zu(2,r.lens,0,32,Nd,0,r.work,{bits:5}),t2=!1}r.lencode=Ud,r.lenbits=9,r.distcode=Nd,r.distbits=5},W3=(r,e,t,n)=>{let i;const o=r.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(e.subarray(t-o.wsize,t),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(t-n,t-n+i),o.wnext),(n-=i)?(o.window.set(e.subarray(t-n,t),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let t,n,i,o,s,a,u,l,d,_,E,m,w,v,A,I,B,S,P,C,R,j,H=0;const N=new Uint8Array(4);let c,p;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Js(r)||!r.output||!r.input&&r.avail_in!==0)return oi;t=r.state,t.mode===Qi&&(t.mode=Td),s=r.next_out,i=r.output,u=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,l=t.hold,d=t.bits,_=a,E=u,j=$s;e:for(;;)switch(t.mode){case bf:if(t.wrap===0){t.mode=Td;break}for(;d<16;){if(a===0)break e;a--,l+=n[o++]<>>8&255,t.check=Ii(t.check,N,2,0),l=0,d=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&l)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=yr;break}if((15&l)!==Xw){r.msg="unknown compression method",t.mode=yr;break}if(l>>>=4,d-=4,R=8+(15&l),t.wbits===0&&(t.wbits=R),R>15||R>t.wbits){r.msg="invalid window size",t.mode=yr;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(N[0]=255&l,N[1]=l>>>8&255,t.check=Ii(t.check,N,2,0)),l=0,d=0,t.mode=16182;case 16182:for(;d<32;){if(a===0)break e;a--,l+=n[o++]<>>8&255,N[2]=l>>>16&255,N[3]=l>>>24&255,t.check=Ii(t.check,N,4,0)),l=0,d=0,t.mode=16183;case 16183:for(;d<16;){if(a===0)break e;a--,l+=n[o++]<>8),512&t.flags&&4&t.wrap&&(N[0]=255&l,N[1]=l>>>8&255,t.check=Ii(t.check,N,2,0)),l=0,d=0,t.mode=16184;case 16184:if(1024&t.flags){for(;d<16;){if(a===0)break e;a--,l+=n[o++]<>>8&255,t.check=Ii(t.check,N,2,0)),l=0,d=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(m=t.length,m>a&&(m=a),m&&(t.head&&(R=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(o,o+m),R)),512&t.flags&&4&t.wrap&&(t.check=Ii(t.check,n,m,o)),a-=m,o+=m,t.length-=m),t.length))break e;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(a===0)break e;m=0;do R=n[o+m++],t.head&&R&&t.length<65536&&(t.head.name+=String.fromCharCode(R));while(R&&m>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Qi;break;case 16189:for(;d<32;){if(a===0)break e;a--,l+=n[o++]<>>=7&d,d-=7&d,t.mode=Rd;break}for(;d<3;){if(a===0)break e;a--,l+=n[o++]<>>=1,d-=1,3&l){case 0:t.mode=16193;break;case 1:if(gB(t),t.mode=kl,e===Al){l>>>=2,d-=2;break e}break;case 2:t.mode=16196;break;case 3:r.msg="invalid block type",t.mode=yr}l>>>=2,d-=2;break;case 16193:for(l>>>=7&d,d-=7&d;d<32;){if(a===0)break e;a--,l+=n[o++]<>>16^65535)){r.msg="invalid stored block lengths",t.mode=yr;break}if(t.length=65535&l,l=0,d=0,t.mode=Od,e===Al)break e;case Od:t.mode=16195;case 16195:if(m=t.length,m){if(m>a&&(m=a),m>u&&(m=u),m===0)break e;i.set(n.subarray(o,o+m),s),a-=m,o+=m,u-=m,s+=m,t.length-=m;break}t.mode=Qi;break;case 16196:for(;d<14;){if(a===0)break e;a--,l+=n[o++]<>>=5,d-=5,t.ndist=1+(31&l),l>>>=5,d-=5,t.ncode=4+(15&l),l>>>=4,d-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=yr;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,d-=3}for(;t.have<19;)t.lens[x[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,c={bits:t.lenbits},j=Zu(0,t.lens,0,19,t.lencode,0,t.work,c),t.lenbits=c.bits,j){r.msg="invalid code lengths set",t.mode=yr;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,I=H>>>16&255,B=65535&H,!(A<=d);){if(a===0)break e;a--,l+=n[o++]<>>=A,d-=A,t.lens[t.have++]=B;else{if(B===16){for(p=A+2;d>>=A,d-=A,t.have===0){r.msg="invalid bit length repeat",t.mode=yr;break}R=t.lens[t.have-1],m=3+(3&l),l>>>=2,d-=2}else if(B===17){for(p=A+3;d>>=A,d-=A,R=0,m=3+(7&l),l>>>=3,d-=3}else{for(p=A+7;d>>=A,d-=A,R=0,m=11+(127&l),l>>>=7,d-=7}if(t.have+m>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=yr;break}for(;m--;)t.lens[t.have++]=R}}if(t.mode===yr)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=yr;break}if(t.lenbits=9,c={bits:t.lenbits},j=Zu(1,t.lens,0,t.nlen,t.lencode,0,t.work,c),t.lenbits=c.bits,j){r.msg="invalid literal/lengths set",t.mode=yr;break}if(t.distbits=6,t.distcode=t.distdyn,c={bits:t.distbits},j=Zu(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,c),t.distbits=c.bits,j){r.msg="invalid distances set",t.mode=yr;break}if(t.mode=kl,e===Al)break e;case kl:t.mode=Sl;case Sl:if(a>=6&&u>=258){r.next_out=s,r.avail_out=u,r.next_in=o,r.avail_in=a,t.hold=l,t.bits=d,oB(r,E),s=r.next_out,i=r.output,u=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,l=t.hold,d=t.bits,t.mode===Qi&&(t.back=-1);break}for(t.back=0;H=t.lencode[l&(1<>>24,I=H>>>16&255,B=65535&H,!(A<=d);){if(a===0)break e;a--,l+=n[o++]<>S)],A=H>>>24,I=H>>>16&255,B=65535&H,!(S+A<=d);){if(a===0)break e;a--,l+=n[o++]<>>=S,d-=S,t.back+=S}if(l>>>=A,d-=A,t.back+=A,t.length=B,I===0){t.mode=16205;break}if(32&I){t.back=-1,t.mode=Qi;break}if(64&I){r.msg="invalid literal/length code",t.mode=yr;break}t.extra=15&I,t.mode=16201;case 16201:if(t.extra){for(p=t.extra;d>>=t.extra,d-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;H=t.distcode[l&(1<>>24,I=H>>>16&255,B=65535&H,!(A<=d);){if(a===0)break e;a--,l+=n[o++]<>S)],A=H>>>24,I=H>>>16&255,B=65535&H,!(S+A<=d);){if(a===0)break e;a--,l+=n[o++]<>>=S,d-=S,t.back+=S}if(l>>>=A,d-=A,t.back+=A,64&I){r.msg="invalid distance code",t.mode=yr;break}t.offset=B,t.extra=15&I,t.mode=16203;case 16203:if(t.extra){for(p=t.extra;d>>=t.extra,d-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=yr;break}t.mode=16204;case 16204:if(u===0)break e;if(m=E-u,t.offset>m){if(m=t.offset-m,m>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=yr;break}m>t.wnext?(m-=t.wnext,w=t.wsize-m):w=t.wnext-m,m>t.length&&(m=t.length),v=t.window}else v=i,w=s-t.offset,m=t.length;m>u&&(m=u),u-=m,t.length-=m;do i[s++]=v[w++];while(--m);t.length===0&&(t.mode=Sl);break;case 16205:if(u===0)break e;i[s++]=t.length,u--,t.mode=Sl;break;case Rd:if(t.wrap){for(;d<32;){if(a===0)break e;a--,l|=n[o++]<{if(Js(r))return oi;let e=r.state;return e.window&&(e.window=null),r.state=null,$s},wB=(r,e)=>{if(Js(r))return oi;const t=r.state;return 2&t.wrap?(t.head=e,e.done=!1,$s):oi},bB=(r,e)=>{const t=e.length;let n,i,o;return Js(r)?oi:(n=r.state,n.wrap!==0&&n.mode!==vh?oi:n.mode===vh&&(i=1,i=pp(i,e,t,0),i!==n.check)?$3:(o=W3(r,e,t,t),o?(n.mode=16210,K3):(n.havedict=1,$s)))},uo={inflateReset:q3,inflateReset2:H3,inflateResetKeep:V3,inflateInit:r=>e2(r,15),inflateInit2:e2,inflate:yB,inflateEnd:mB,inflateGetHeader:wB,inflateSetDictionary:bB,inflateInfo:"pako inflate (from Nodeca project)"},vB=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Z3=Object.prototype.toString,{Z_NO_FLUSH:_B,Z_FINISH:EB,Z_OK:Gu,Z_STREAM_END:Dd,Z_NEED_DICT:zd,Z_STREAM_ERROR:xB,Z_DATA_ERROR:r2,Z_MEM_ERROR:AB}=og;function Yu(r){this.options=j3.assign({chunkSize:65536,windowBits:15,to:""},r||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||r&&r.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new iB,this.strm.avail_out=0;let t=uo.inflateInit2(this.strm,e.windowBits);if(t!==Gu)throw new Error(gp[t]);if(this.header=new vB,uo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=yp.string2buf(e.dictionary):Z3.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=uo.inflateSetDictionary(this.strm,e.dictionary),t!==Gu)))throw new Error(gp[t])}function jd(r,e){const t=new Yu(e);if(t.push(r),t.err)throw t.msg||gp[t.err];return t.result}Yu.prototype.push=function(r,e){const t=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=e===~~e?e:e===!0?EB:_B,Z3.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),o=uo.inflate(t,s),o===zd&&i&&(o=uo.inflateSetDictionary(t,i),o===Gu?o=uo.inflate(t,s):o===r2&&(o=zd));t.avail_in>0&&o===Dd&&t.state.wrap>0&&r[t.next_in]!==0;)uo.inflateReset(t),o=uo.inflate(t,s);switch(o){case xB:case r2:case zd:case AB:return this.onEnd(o),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||o===Dd))if(this.options.to==="string"){let u=yp.utf8border(t.output,t.next_out),l=t.next_out-u,d=yp.buf2string(t.output,u);t.next_out=l,t.avail_out=n-l,l&&t.output.set(t.output.subarray(u,u+l),0),this.onData(d)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(o!==Gu||a!==0){if(o===Dd)return o=uo.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},Yu.prototype.onData=function(r){this.chunks.push(r)},Yu.prototype.onEnd=function(r){r===Gu&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=j3.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var kB={Inflate:Yu,inflate:jd,inflateRaw:function(r,e){return(e=e||{}).raw=!0,jd(r,e)},ungzip:jd,constants:og};const{Inflate:sN,inflate:SB,inflateRaw:aN,ungzip:uN}=kB;var IB=SB,BB=_i(q1());const Eu=r=>"version"in r;var MB=Object.freeze({__proto__:null,encode:function(r){return r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),"0x")},decode:function(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2==1&&(r="0"+r);let e=r.match(/.{2}/g);return e===null?Ze.Buffer.from([]):Ze.Buffer.from(e.map(t=>parseInt(t,16)))}});function G3(r){return new TextDecoder("utf-8").decode(r)}function Y3(r){return new TextEncoder().encode(r)}var PB=Object.freeze({__proto__:null,decode:G3,encode:Y3});function mp(r){return Pa.encode(r)}var LB=Object.freeze({__proto__:null,encode:mp,decode:function(r){return Pa.decode(r)}});function J3(r){return Ze.Buffer.from(Q5(r))}var CB=Object.freeze({__proto__:null,encode:function(r){return U0(r)},decode:J3}),TB=Object.freeze({__proto__:null,hex:MB,utf8:PB,bs58:LB,base64:CB});function X3(r){const e=new Map;return r.errors&&r.errors.forEach(t=>{var n;let i=(n=t.msg)!==null&&n!==void 0?n:t.name;e.set(t.code,i)}),e}function Q3(r,...e){if(r.args.length!=e.length)throw new Error("Invalid argument length");const t={};let n=0;return r.args.forEach(i=>{t[i.name]=e[n],n+=1}),t}function sg(r,e={}){r.forEach(t=>{if("accounts"in t)sg(t.accounts,e[t.name]);else if(e[t.name]===void 0)throw new Error(`Invalid arguments: ${t.name} not provided.`)})}function Sn(r){return r instanceof ye?r:new ye(r)}class OB extends TypeError{constructor(e,t){let n;const{message:i,...o}=e,{path:s}=e;super(s.length===0?i:"At path: "+s.join(".")+" -- "+i),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var a;return(a=n)!=null?a:n=[e,...t()]}}}function La(r){return typeof r=="object"&&r!=null}function Xo(r){return typeof r=="string"?JSON.stringify(r):""+r}function RB(r,e,t,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:o}=e,{type:s}=t,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+Xo(n)+"`"}=r;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...r,message:u}}function*n2(r,e,t,n){(function(i){return La(i)&&typeof i[Symbol.iterator]=="function"})(r)||(r=[r]);for(const i of r){const o=RB(i,e,t,n);o&&(yield o)}}function*ag(r,e,t){t===void 0&&(t={});const{path:n=[],branch:i=[r],coerce:o=!1,mask:s=!1}=t,a={path:n,branch:i};if(o&&(r=e.coercer(r,a),s&&e.type!=="type"&&La(e.schema)&&La(r)&&!Array.isArray(r)))for(const l in r)e.schema[l]===void 0&&delete r[l];let u=!0;for(const l of e.validator(r,a))u=!1,yield[l,void 0];for(let[l,d,_]of e.entries(r,a)){const E=ag(d,_,{path:l===void 0?n:[...n,l],branch:l===void 0?i:[...i,d],coerce:o,mask:s});for(const m of E)m[0]?(u=!1,yield[m[0],void 0]):o&&(d=m[1],l===void 0?r=d:r instanceof Map?r.set(l,d):r instanceof Set?r.add(d):La(r)&&(r[l]=d))}if(u)for(const l of e.refiner(r,a))u=!1,yield[l,void 0];u&&(yield[void 0,r])}class rs{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:i,refiner:o,coercer:s=u=>u,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=s,this.validator=i?(u,l)=>n2(i(u,l),l,this,u):()=>[],this.refiner=o?(u,l)=>n2(o(u,l),l,this,u):()=>[]}assert(e){return function(t,n){const i=Ju(t,n);if(i[0])throw i[0]}(e,this)}create(e){return ug(e,this)}is(e){return e8(e,this)}mask(e){return function(t,n){const i=Ju(t,n,{coerce:!0,mask:!0});if(i[0])throw i[0];return i[1]}(e,this)}validate(e,t){return t===void 0&&(t={}),Ju(e,this,t)}}function ug(r,e){const t=Ju(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function e8(r,e){return!Ju(r,e)[0]}function Ju(r,e,t){t===void 0&&(t={});const n=ag(r,e,t),i=function(o){const{done:s,value:a}=o.next();return s?void 0:a}(n);return i[0]?[new OB(i[0],function*(){for(const s of n)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function Zc(r,e){return new rs({type:r,schema:null,validator:e})}function Fd(r){return new rs({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,r]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+Xo(e)})}function i2(r){const e=Xo(r),t=typeof r;return new rs({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+e+"`, but received: "+Xo(n)})}function Il(r){return new rs({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function Bl(){return Zc("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+Xo(r))}function Xl(r){return new rs({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function Es(){return Zc("string",r=>typeof r=="string"||"Expected a string, but received: "+Xo(r))}function Ro(r){const e=Object.keys(r);return new rs({type:"type",schema:r,*entries(t){if(La(t))for(const n of e)yield[n,t[n],r[n]]},validator:t=>La(t)||"Expected an object, but received: "+Xo(t)})}function t8(r){const e=r.map(t=>t.type).join(" | ");return new rs({type:"union",schema:null,coercer(t,n){return(r.find(o=>{const[s]=o.validate(t,{coerce:!0});return!s})||cg()).coercer(t,n)},validator(t,n){const i=[];for(const o of r){const[...s]=ag(t,o,n),[a]=s;if(!a[0])return[];for(const[u]of s)u&&i.push(u)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Xo(t),...i]}})}function cg(){return Zc("unknown",()=>!0)}const o2=99;async function wp(r,e,t){if(e.length<=o2)return await s2(r,e,t);{const n=function(i,o){return Array.apply(0,new Array(Math.ceil(i.length/o))).map((s,a)=>i.slice(a*o,(a+1)*o))}(e,o2);return(await Promise.all(n.map(i=>s2(r,i,t)))).flat()}}async function s2(r,e,t){const n=t??r.commitment,{value:i,context:o}=await r.getMultipleAccountsInfoAndContext(e,n);return i.map((s,a)=>s===null?null:{publicKey:e[a],account:s,context:o})}async function r8(r,e,t,n,i){var o;t&&t.length>0&&e.sign(...t);const s=e._compile(),a=s.serialize(),u=e._serialize(a).toString("base64"),l={encoding:"base64",commitment:n??r.commitment};if(i){const E=(Array.isArray(i)?i:s.nonProgramIds()).map(m=>m.toBase58());l.accounts={encoding:"base64",addresses:E}}t&&(l.sigVerify=!0);const d=[u,l],_=ug(await r._rpcRequest("simulateTransaction",d),DB);if("error"in _){let E;if("data"in _.error&&(E=(o=_.error.data)===null||o===void 0?void 0:o.logs,E&&Array.isArray(E))){const m=` - `,w=m+E.join(m);console.error(_.error.message,w)}throw new ka("failed to simulate transaction: "+_.error.message,E)}return _.result}function UB(r){return function(e,t,n){return new rs({...e,coercer:(i,o)=>e8(i,t)?e.coercer(n(i,o),o):e.coercer(i,o)})}(n8(r),NB,e=>"error"in e?e:{...e,result:ug(e.result,r)})}const NB=n8(cg());function n8(r){return t8([Ro({jsonrpc:i2("2.0"),id:Es(),result:r}),Ro({jsonrpc:i2("2.0"),id:Es(),error:Ro({code:cg(),message:Es(),data:Xl(Zc("any",()=>!0))})})])}const DB=(a2=Ro({err:Il(t8([Ro({}),Es()])),logs:Il(Fd(Es())),accounts:Xl(Il(Fd(Il(Ro({executable:Zc("boolean",r=>typeof r=="boolean"),owner:Es(),lamports:Bl(),data:Fd(Es()),rentEpoch:Xl(Bl())}))))),unitsConsumed:Xl(Bl())}),UB(Ro({context:Ro({slot:Bl()}),value:a2})));var a2,zB=Object.freeze({__proto__:null,invoke:async function(r,e,t,n){r=Sn(r),n||(n=wc());const i=new Gt;if(i.add(new rr({programId:r,keys:e??[],data:t})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(i,[])},getMultipleAccounts:async function(r,e,t){return(await wp(r,e,t)).map(n=>n?{publicKey:n.publicKey,account:n.account}:null)},getMultipleAccountsAndContext:wp,simulateTransaction:r8});class i8{constructor(e,t,n){this.connection=e,this.wallet=t,this.opts=n,this.publicKey=t==null?void 0:t.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(e,t){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(e,t,n){var i,o,s,a;if(n===void 0&&(n=this.opts),Eu(e))t&&e.sign(t);else if(e.feePayer=(i=e.feePayer)!==null&&i!==void 0?i:this.wallet.publicKey,e.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,t)for(const l of t)e.partialSign(l);const u=(e=await this.wallet.signTransaction(e)).serialize();try{return await u2(this.connection,u,n)}catch(l){if(l instanceof bp){const d=mp(Eu(e)?((o=e.signatures)===null||o===void 0?void 0:o[0])||new Uint8Array:(s=e.signature)!==null&&s!==void 0?s:new Uint8Array),_=await this.connection.getTransaction(d,{commitment:"confirmed"});if(_){const E=(a=_.meta)===null||a===void 0?void 0:a.logMessages;throw E?new ka(l.message,E):l}throw l}throw l}}async sendAll(e,t){var n,i,o;t===void 0&&(t=this.opts);const s=(await this.connection.getLatestBlockhash(t.preflightCommitment)).blockhash;let a=e.map(d=>{var _,E;if(Eu(d.tx)){let m=d.tx;return d.signers&&m.sign(d.signers),m}{let m=d.tx,w=(_=d.signers)!==null&&_!==void 0?_:[];return m.feePayer=(E=m.feePayer)!==null&&E!==void 0?E:this.wallet.publicKey,m.recentBlockhash=s,w.forEach(v=>{m.partialSign(v)}),m}});const u=await this.wallet.signAllTransactions(a),l=[];for(let d=0;dl.startsWith("Program log: AnchorError"));if(t===-1)return null;const n=e[t],i=[n];let o;if(t+11)return null;i=a[0].match(/([0-9]+)/g)[0]}try{o=parseInt(i)}catch{return null}let s=t.get(o);return s!==void 0?new vc(o,s,e.logs):(s=s8.get(o),s!==void 0?new vc(o,s,e.logs):null)}get program(){var e;return(e=this._programErrorStack)===null||e===void 0?void 0:e.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var e;return(e=this._programErrorStack)===null||e===void 0?void 0:e.stack}toString(){return this.msg}}function hg(r,e){lg("debug-logs")&&console.log("Translating error:",r);const t=Ca.parse(r.logs);if(t)return t;const n=vc.parse(r,e);if(n)return n;if(r.logs){const i={get:function(o,s){return s==="programErrorStack"?o.programErrorStack.stack:s==="program"?o.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=uu.parse(r.logs),new Proxy(r,i)}return r}const ft={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},s8=new Map([[ft.InstructionMissing,"8 byte instruction identifier not provided"],[ft.InstructionFallbackNotFound,"Fallback functions are not supported"],[ft.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[ft.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[ft.IdlInstructionStub,"The program was compiled without idl instructions"],[ft.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[ft.ConstraintMut,"A mut constraint was violated"],[ft.ConstraintHasOne,"A has one constraint was violated"],[ft.ConstraintSigner,"A signer constraint was violated"],[ft.ConstraintRaw,"A raw constraint was violated"],[ft.ConstraintOwner,"An owner constraint was violated"],[ft.ConstraintRentExempt,"A rent exemption constraint was violated"],[ft.ConstraintSeeds,"A seeds constraint was violated"],[ft.ConstraintExecutable,"An executable constraint was violated"],[ft.ConstraintState,"Deprecated Error, feel free to replace with something else"],[ft.ConstraintAssociated,"An associated constraint was violated"],[ft.ConstraintAssociatedInit,"An associated init constraint was violated"],[ft.ConstraintClose,"A close constraint was violated"],[ft.ConstraintAddress,"An address constraint was violated"],[ft.ConstraintZero,"Expected zero account discriminant"],[ft.ConstraintTokenMint,"A token mint constraint was violated"],[ft.ConstraintTokenOwner,"A token owner constraint was violated"],[ft.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[ft.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[ft.ConstraintMintDecimals,"A mint decimals constraint was violated"],[ft.ConstraintSpace,"A space constraint was violated"],[ft.ConstraintAccountIsNone,"A required account for the constraint is None"],[ft.RequireViolated,"A require expression was violated"],[ft.RequireEqViolated,"A require_eq expression was violated"],[ft.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[ft.RequireNeqViolated,"A require_neq expression was violated"],[ft.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[ft.RequireGtViolated,"A require_gt expression was violated"],[ft.RequireGteViolated,"A require_gte expression was violated"],[ft.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[ft.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[ft.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[ft.AccountDidNotDeserialize,"Failed to deserialize the account"],[ft.AccountDidNotSerialize,"Failed to serialize the account"],[ft.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[ft.AccountNotMutable,"The given account is not mutable"],[ft.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[ft.InvalidProgramId,"Program ID was not as expected"],[ft.InvalidProgramExecutable,"Program account is not executable"],[ft.AccountNotSigner,"The given account did not sign"],[ft.AccountNotSystemOwned,"The given account is not owned by the system program"],[ft.AccountNotInitialized,"The program expected this account to be already initialized"],[ft.AccountNotProgramData,"The given account is not a program data account"],[ft.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[ft.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[ft.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[ft.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[ft.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[ft.Deprecated,"The API being used is deprecated and should no longer be used"]]);var _p=function(){return _p=Object.assign||function(r){for(var e,t=1,n=arguments.length;ts.name===i);if(o.length!==1)throw new bc(`Type not found: ${JSON.stringify(e)}`);return Fn.typeDefLayout(o[0],t,n)}if("array"in e.type){let i=e.type.array[0],o=e.type.array[1],s=Fn.fieldLayout({name:void 0,type:i},t);return Bt.array(s,o,n)}throw new Error(`Not yet implemented: ${e}`)}}static typeDefLayout(e,t=[],n){if(e.type.kind==="struct"){const i=e.type.fields.map(o=>Fn.fieldLayout(o,t));return Bt.struct(i,n)}if(e.type.kind==="enum"){let i=e.type.variants.map(o=>{const s=dr(o.name);if(o.fields===void 0)return Bt.struct([],s);const a=o.fields.map((u,l)=>u.hasOwnProperty("name")?Fn.fieldLayout(u,t):Fn.fieldLayout({type:u,name:l.toString()},t));return Bt.struct(a,s)});return n!==void 0?Bt.rustEnum(i).replicate(n):Bt.rustEnum(i,n)}throw new Error(`Unknown type kint: ${e}`)}}const l2="global";class vf{constructor(e){this.idl=e,this.ixLayout=vf.parseIxLayout(e);const t=new Map;e.instructions.forEach(n=>{const i=h2(l2,n.name);t.set(Pa.encode(i),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=t}encode(e,t){return this._encode(l2,e,t)}_encode(e,t,n){const i=Ze.Buffer.alloc(1e3),o=dr(t),s=this.ixLayout.get(o);if(!s)throw new Error(`Unknown method: ${o}`);const a=s.encode(n,i),u=i.slice(0,a);return Ze.Buffer.concat([h2(e,t),u])}static parseIxLayout(e){const t=e.instructions.map(n=>{let i=n.args.map(s=>{var a,u;return Fn.fieldLayout(s,Array.from([...(a=e.accounts)!==null&&a!==void 0?a:[],...(u=e.types)!==null&&u!==void 0?u:[]]))});const o=dr(n.name);return[o,Bt.struct(i,o)]});return new Map(t)}decode(e,t="hex"){typeof e=="string"&&(e=t==="hex"?Ze.Buffer.from(e,"hex"):Pa.decode(e));let n=Pa.encode(e.slice(0,8)),i=e.slice(8);const o=this.sighashLayouts.get(n);return o?{data:o.layout.decode(i),name:o.name}:null}format(e,t){return io.format(e,t,this.idl)}}class io{static format(e,t,n){const i=n.instructions.filter(a=>e.name===a.name)[0];if(i===void 0)return console.error("Invalid instruction given"),null;const o=i.args.map(a=>({name:a.name,type:io.formatIdlType(a.type),data:io.formatIdlData(a,e.data[a.name],n.types)})),s=io.flattenIdlAccounts(i.accounts);return{args:o,accounts:t.map((a,u)=>u`;if("option"in e)return`Option<${this.formatIdlType(e.option)}>`;if("defined"in e)return e.defined;if("array"in e)return`Array<${e.array[0]}; ${e.array[1]}>`;throw new Error(`Unknown IDL type: ${e}`)}static formatIdlData(e,t,n){if(typeof e.type=="string")return t.toString();if(e.type.hasOwnProperty("vec"))return"["+t.map(i=>this.formatIdlData({name:"",type:e.type.vec},i)).join(", ")+"]";if(e.type.hasOwnProperty("option"))return t===null?"null":this.formatIdlData({name:"",type:e.type.option},t,n);if(e.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const i=n.filter(o=>o.name===e.type.defined);if(i.length!==1)throw new Error(`Type not found: ${e.type.defined}`);return io.formatIdlDataDefined(i[0],t,n)}return"unknown"}static formatIdlDataDefined(e,t,n){if(e.type.kind==="struct"){const i=e.type;return"{ "+Object.keys(t).map(s=>{const a=i.fields.filter(u=>u.name===s)[0];if(a===void 0)throw new Error("Unable to find type");return s+": "+io.formatIdlData(a,t[s],n)}).join(", ")+" }"}if(e.type.variants.length===0)return"{}";if(e.type.variants[0].name){const i=e.type.variants,o=Object.keys(t)[0],s=t[o],a=Object.keys(s).map(l=>{var d;const _=s[l],E=(d=i[o])===null||d===void 0?void 0:d.filter(m=>m.name===l)[0];if(E===void 0)throw new Error("Unable to find variant");return l+": "+io.formatIdlData(E,_,n)}).join(", "),u=dr(o,{pascalCase:!0});return a.length===0?u:`${u} { ${a} }`}return"Tuple formatting not yet implemented"}static flattenIdlAccounts(e,t){return e.map(n=>{const i=function(o){const s=o.replace(/([A-Z])/g," $1");return s.charAt(0).toUpperCase()+s.slice(1)}(n.name);if(n.hasOwnProperty("accounts")){const o=t?`${t} > ${i}`:i;return io.flattenIdlAccounts(n.accounts,o)}return{...n,name:t?`${t} > ${i}`:i}}).flat()}}function h2(r,e){var t;let n=`${r}:${t===void 0&&(t={}),HB(e,_p({delimiter:"_"},t))}`;return Ze.Buffer.from(js(n).slice(0,8))}function fg(r,e){if(e.type.kind==="enum"){const t=e.type.variants.map(n=>n.fields?n.fields.map(i=>Xu(r,typeof i=="object"&&"name"in i?i.type:i)).reduce((i,o)=>i+o,0):0);return Math.max(...t)+1}return e.type.fields.map(t=>Xu(r,t.type)).reduce((t,n)=>t+n,0)}function Xu(r,e){var t,n;switch(e){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in e)return 1;if("option"in e)return 1+Xu(r,e.option);if("coption"in e)return 4+Xu(r,e.coption);if("defined"in e){const i=(n=(t=r.types)===null||t===void 0?void 0:t.filter(o=>o.name===e.defined))!==null&&n!==void 0?n:[];if(i.length!==1)throw new bc(`Type not found: ${JSON.stringify(e)}`);return fg(r,i[0])}if("array"in e){let i=e.array[0],o=e.array[1];return Xu(r,i)*o}throw new Error(`Invalid type ${JSON.stringify(e)}`)}}const _h=8;function a8(r){return Ae.Buffer.from(js(r).slice(0,_h))}class xs{constructor(e){if(e.accounts===void 0)return void(this.accountLayouts=new Map);const t=e.accounts.map(n=>[n.name,Fn.typeDefLayout(n,e.types)]);this.accountLayouts=new Map(t),this.idl=e}async encode(e,t){const n=Ze.Buffer.alloc(1e3),i=this.accountLayouts.get(e);if(!i)throw new Error(`Unknown account: ${e}`);const o=i.encode(t,n);let s=n.slice(0,o),a=xs.accountDiscriminator(e);return Ze.Buffer.concat([a,s])}decode(e,t){if(xs.accountDiscriminator(e).compare(t.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(e,t)}decodeAny(e){const t=e.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(i=>xs.accountDiscriminator(i).equals(t));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,e)}decodeUnchecked(e,t){const n=t.subarray(_h),i=this.accountLayouts.get(e);if(!i)throw new Error(`Unknown account: ${e}`);return i.decode(n)}memcmp(e,t){const n=xs.accountDiscriminator(e);return{offset:0,bytes:Pa.encode(t?Ze.Buffer.concat([n,t]):n)}}size(e){var t;return _h+((t=fg(this.idl,e))!==null&&t!==void 0?t:0)}static accountDiscriminator(e){return a8(`account:${dr(e,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class u8{constructor(e){if(e.events===void 0)return void(this.layouts=new Map);const t=e.events.map(n=>{let i={name:n.name,type:{kind:"struct",fields:n.fields.map(o=>({name:o.name,type:o.type}))}};return[n.name,Fn.typeDefLayout(i,e.types)]});this.layouts=new Map(t),this.discriminators=new Map(e.events===void 0?[]:e.events.map(n=>[U0(c8(n.name)),n.name]))}decode(e){let t;try{t=Ze.Buffer.from(Q5(e))}catch{return null}const n=U0(t.slice(0,8)),i=this.discriminators.get(n);if(i===void 0)return null;const o=this.layouts.get(i);if(!o)throw new Error(`Unknown event: ${i}`);return{data:o.decode(t.slice(8)),name:i}}}function c8(r){return a8(`event:${r}`)}class WB{constructor(e){if(e.types===void 0)return void(this.typeLayouts=new Map);const t=e.types.map(n=>[n.name,Fn.typeDefLayout(n,e.types)]);this.typeLayouts=new Map(t),this.idl=e}encode(e,t){const n=Ze.Buffer.alloc(1e3),i=this.typeLayouts.get(e);if(!i)throw new Error(`Unknown type: ${e}`);const o=i.encode(t,n);return n.slice(0,o)}decode(e,t){const n=this.typeLayouts.get(e);if(!n)throw new Error(`Unknown type: ${e}`);return n.decode(t)}}class dg{constructor(e){this.instruction=new vf(e),this.accounts=new xs(e),this.events=new u8(e),this.types=new WB(e)}}var ZB=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ae.global<"u"?Ae.global:typeof self<"u"?self:{};function GB(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class Ln{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}var _f=Ln;class As extends Ln{isCount(){throw new Error("ExternalLayout is abstract")}}class l8 extends As{constructor(e,t,n){if(!(e instanceof Ln))throw new TypeError("layout must be a Layout");if(t===void 0)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof Ef||this.layout instanceof h8}decode(e,t){return t===void 0&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return n===void 0&&(n=0),this.layout.encode(e,t,n+this.offset)}}class Ef extends Ln{constructor(e,t){if(super(e,t),6o&&s instanceof Ln,!0))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&n===void 0&&(n=t,t=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,t);return t+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,t){t===void 0&&(t=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let u=a.span;if(s=0u&&(u=a.getSpan(t,n)))}o=n,n+=u}return o+s-i}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?t=-1:0<=t&&(t+=n.span)}}}class p8{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class f2 extends p8{constructor(e,t){if(!(e instanceof As&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class g8 extends Ln{constructor(e,t,n){const i=e instanceof Ef||e instanceof h8;if(i)e=new f2(new l8(e));else if(e instanceof As&&e.isCount())e=new f2(e);else if(!(e instanceof p8))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof Ln))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&i&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=i,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;t===void 0&&(t=0);const i=this.discriminator,o=i.decode(e,t);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(e,t+a)}else n=s.decode(e,t);return n}encode(e,t,n){n===void 0&&(n=0);const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(e[o.property],t,n),a+s.encode(e[s.property],t,n+a)}return i.encode(e,t,n)}addVariant(e,t,n){const i=new QB(this,e,t,n);return this.registry[e]=i,i}getVariant(e,t){let n=e;return Ae.Buffer.isBuffer(e)&&(t===void 0&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class QB extends Ln{constructor(e,t,n,i){if(!(e instanceof g8))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof Ln))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(t===void 0&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],t,n+i),o+=this.layout.getSpan(t,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}class eM extends Ln{constructor(e,t){if(!(e instanceof As&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof As||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){t===void 0&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof As&&(i=e.length),!Ae.Buffer.isBuffer(e)||i!==e.length)throw new TypeError(function(o,s){return s.property?o+"["+s.property+"]":o}("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,i,"hex"),this.length instanceof As&&this.length.encode(i,t,n),i}}var tM=(r,e,t)=>new l8(r,e,t),wo=r=>new Ef(4,r),eo=r=>new JB(r),Nr=(r,e,t)=>new XB(r,e,t),y8=(r,e,t)=>new g8(r,e,t),Gc=(r,e)=>new eM(r,e);class rM{constructor(e){}encode(e,t){switch(dr(e)){case"createAccount":return function({lamports:n,space:i,owner:o}){return Wn({createAccount:{lamports:n,space:i,owner:o.toBuffer()}})}(t);case"assign":return function({owner:n}){return Wn({assign:{owner:n.toBuffer()}})}(t);case"transfer":return function({lamports:n}){return Wn({transfer:{lamports:n}})}(t);case"createAccountWithSeed":return function({base:n,seed:i,lamports:o,space:s,owner:a}){return Wn({createAccountWithSeed:{base:n.toBuffer(),seed:i,lamports:o,space:s,owner:a.toBuffer()}},Kr.getVariant(3).span+i.length)}(t);case"advanceNonceAccount":return function({authorized:n}){return Wn({advanceNonceAccount:{authorized:n.toBuffer()}})}(t);case"withdrawNonceAccount":return function({lamports:n}){return Wn({withdrawNonceAccount:{lamports:n}})}(t);case"initializeNonceAccount":return function({authorized:n}){return Wn({initializeNonceAccount:{authorized:n.toBuffer()}})}(t);case"authorizeNonceAccount":return function({authorized:n}){return Wn({authorizeNonceAccount:{authorized:n.toBuffer()}})}(t);case"allocate":return function({space:n}){return Wn({allocate:{space:n}})}(t);case"allocateWithSeed":return function({base:n,seed:i,space:o,owner:s}){return Wn({allocateWithSeed:{base:n.toBuffer(),seed:i,space:o,owner:s.toBuffer()}},Kr.getVariant(9).span+i.length)}(t);case"assignWithSeed":return function({base:n,seed:i,owner:o}){return Wn({assignWithSeed:{base:n.toBuffer(),seed:i,owner:o.toBuffer()}},Kr.getVariant(10).span+i.length)}(t);case"transferWithSeed":return function({lamports:n,seed:i,owner:o}){return Wn({transferWithSeed:{lamports:n,seed:i,owner:o.toBuffer()}},Kr.getVariant(11).span+i.length)}(t);default:throw new Error(`Invalid instruction: ${e}`)}}encodeState(e,t){throw new Error("System does not have state")}}class nM extends _f{constructor(e){super(-1,e),this.property=e,this.layout=Nr([wo("length"),wo("lengthPadding"),Gc(tM(wo(),-8),"chars")],this.property)}encode(e,t,n=0){if(e==null)return this.layout.span;const i={chars:Ae.Buffer.from(e,"utf8")};return this.layout.encode(i,t,n)}decode(e,t=0){return this.layout.decode(e,t).chars.toString()}getSpan(e,t=0){return wo().span+wo().span+new ac(new Uint8Array(e).slice(t,t+4),10,"le").toNumber()}}function Ml(r){return new nM(r)}function Hn(r){return Gc(32,r)}const Kr=y8(wo("instruction"));function Wn(r,e){const t=Ae.Buffer.alloc(e??iM),n=Kr.encode(r,t);return e===void 0?t.slice(0,n):t}Kr.addVariant(0,Nr([eo("lamports"),eo("space"),Hn("owner")]),"createAccount"),Kr.addVariant(1,Nr([Hn("owner")]),"assign"),Kr.addVariant(2,Nr([eo("lamports")]),"transfer"),Kr.addVariant(3,Nr([Hn("base"),Ml("seed"),eo("lamports"),eo("space"),Hn("owner")]),"createAccountWithSeed"),Kr.addVariant(4,Nr([Hn("authorized")]),"advanceNonceAccount"),Kr.addVariant(5,Nr([eo("lamports")]),"withdrawNonceAccount"),Kr.addVariant(6,Nr([Hn("authorized")]),"initializeNonceAccount"),Kr.addVariant(7,Nr([Hn("authorized")]),"authorizeNonceAccount"),Kr.addVariant(8,Nr([eo("space")]),"allocate"),Kr.addVariant(9,Nr([Hn("base"),Ml("seed"),eo("space"),Hn("owner")]),"allocateWithSeed"),Kr.addVariant(10,Nr([Hn("base"),Ml("seed"),Hn("owner")]),"assignWithSeed"),Kr.addVariant(11,Nr([eo("lamports"),Ml("seed"),Hn("owner")]),"transferWithSeed");const iM=Math.max(...Object.values(Kr.registry).map(r=>r.span));class oM{constructor(e){this.idl=e}async encode(e,t){if(e==="nonce"){const n=Ae.Buffer.alloc(hc),i=p2.encode(t,n);return n.slice(0,i)}throw new Error(`Invalid account name: ${e}`)}decode(e,t){return this.decodeUnchecked(e,t)}decodeUnchecked(e,t){if(e==="nonce")return function(n){return p2.decode(n)}(t);throw new Error(`Invalid account name: ${e}`)}memcmp(e,t){if(e==="nonce")return{dataSize:hc};throw new Error(`Invalid account name: ${e}`)}size(e){var t;return(t=fg(this.idl,e))!==null&&t!==void 0?t:0}}class sM extends _f{constructor(e,t,n,i){super(e.span,i),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}function d2(r){return new sM(Gc(32),e=>new ye(e),e=>e.toBuffer(),r)}const p2=Nr([wo("version"),wo("state"),d2("authorizedPubkey"),d2("nonce"),Nr([(g2="lamportsPerSignature",new YB(g2))],"feeCalculator")]);var g2;class aM{constructor(e){}decode(e){throw new Error("System program does not have events")}}class uM{constructor(e){}encode(e,t){throw new Error("System does not have user-defined types")}decode(e,t){throw new Error("System does not have user-defined types")}}class m8{constructor(e){this.instruction=new rM(e),this.accounts=new oM(e),this.events=new aM(e),this.types=new uM(e)}}var cM=Object.freeze({__proto__:null,hash:function(r){return new TextDecoder().decode(js(r))}});function w8(r,...e){let t=[Ze.Buffer.from([97,110,99,104,111,114])];e.forEach(i=>{t.push(i instanceof Ze.Buffer?i:Sn(i).toBuffer())});const[n]=ye.findProgramAddressSync(t,Sn(r));return n}var lM=Object.freeze({__proto__:null,createWithSeedSync:function(r,e,t){const n=Ze.Buffer.concat([r.toBuffer(),Ze.Buffer.from(e),t.toBuffer()]);return new ye(js(n))},associated:w8});const Ap=new ye("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),kp=new ye("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var hM=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Ap,ASSOCIATED_PROGRAM_ID:kp,associatedAddress:function({mint:r,owner:e}){return ye.findProgramAddressSync([e.toBuffer(),Ap.toBuffer(),r.toBuffer()],kp)[0]}}),Sp={exports:{}};(function(r,e){var t=typeof self<"u"?self:ZB,n=function(){function o(){this.fetch=!1,this.DOMException=t.DOMException}return o.prototype=t,new o}();(function(o){(function(s){var a="URLSearchParams"in o,u="Symbol"in o&&"iterator"in Symbol,l="FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),d="FormData"in o,_="ArrayBuffer"in o;if(_)var E=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(g){return g&&E.indexOf(Object.prototype.toString.call(g))>-1};function w(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}function v(g){return typeof g!="string"&&(g=String(g)),g}function A(g){var h={next:function(){var y=g.shift();return{done:y===void 0,value:y}}};return u&&(h[Symbol.iterator]=function(){return h}),h}function I(g){this.map={},g instanceof I?g.forEach(function(h,y){this.append(y,h)},this):Array.isArray(g)?g.forEach(function(h){this.append(h[0],h[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(h){this.append(h,g[h])},this)}function B(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}function S(g){return new Promise(function(h,y){g.onload=function(){h(g.result)},g.onerror=function(){y(g.error)}})}function P(g){var h=new FileReader,y=S(h);return h.readAsArrayBuffer(g),y}function C(g){if(g.slice)return g.slice(0);var h=new Uint8Array(g.byteLength);return h.set(new Uint8Array(g)),h.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(g){var h;this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:l&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:d&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:a&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():_&&l&&(h=g)&&DataView.prototype.isPrototypeOf(h)?(this._bodyArrayBuffer=C(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(g)||m(g))?this._bodyArrayBuffer=C(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="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&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l&&(this.blob=function(){var g=B(this);if(g)return g;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?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(P)}),this.text=function(){var g=B(this);if(g)return g;if(this._bodyBlob)return function(h){var y=new FileReader,L=S(y);return y.readAsText(h),L}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(h){for(var y=new Uint8Array(h),L=new Array(y.length),F=0;F-1?L:y),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&F)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(F)}function N(g){var h=new FormData;return g.trim().split("&").forEach(function(y){if(y){var L=y.split("="),F=L.shift().replace(/\+/g," "),K=L.join("=").replace(/\+/g," ");h.append(decodeURIComponent(F),decodeURIComponent(K))}}),h}function c(g,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new I(h.headers),this.url=h.url||"",this._initBody(g)}H.prototype.clone=function(){return new H(this,{body:this._bodyInit})},R.call(H.prototype),R.call(c.prototype),c.prototype.clone=function(){return new c(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},c.error=function(){var g=new c(null,{status:0,statusText:""});return g.type="error",g};var p=[301,302,303,307,308];c.redirect=function(g,h){if(p.indexOf(h)===-1)throw new RangeError("Invalid status code");return new c(null,{status:h,headers:{location:g}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(h,y){this.message=h,this.name=y;var L=Error(h);this.stack=L.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function x(g,h){return new Promise(function(y,L){var F=new H(g,h);if(F.signal&&F.signal.aborted)return L(new s.DOMException("Aborted","AbortError"));var K=new XMLHttpRequest;function V(){K.abort()}K.onload=function(){var W,Z,G={status:K.status,statusText:K.statusText,headers:(W=K.getAllResponseHeaders()||"",Z=new I,W.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(X){var te=X.split(":"),ge=te.shift().trim();if(ge){var ce=te.join(":").trim();Z.append(ge,ce)}}),Z)};G.url="responseURL"in K?K.responseURL:G.headers.get("X-Request-URL");var ne="response"in K?K.response:K.responseText;y(new c(ne,G))},K.onerror=function(){L(new TypeError("Network request failed"))},K.ontimeout=function(){L(new TypeError("Network request failed"))},K.onabort=function(){L(new s.DOMException("Aborted","AbortError"))},K.open(F.method,F.url,!0),F.credentials==="include"?K.withCredentials=!0:F.credentials==="omit"&&(K.withCredentials=!1),"responseType"in K&&l&&(K.responseType="blob"),F.headers.forEach(function(W,Z){K.setRequestHeader(Z,W)}),F.signal&&(F.signal.addEventListener("abort",V),K.onreadystatechange=function(){K.readyState===4&&F.signal.removeEventListener("abort",V)}),K.send(F._bodyInit===void 0?null:F._bodyInit)})}x.polyfill=!0,o.fetch||(o.fetch=x,o.Headers=I,o.Request=H,o.Response=c),s.Headers=I,s.Request=H,s.Response=c,s.fetch=x,Object.defineProperty(s,"__esModule",{value:!0})})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(Sp,Sp.exports);var fM=GB(Sp.exports);async function y2(r,e){const t=await r.getAccountInfo(e);if(t===null)throw new Error("program account not found");const{program:n}=Ip(t.data),i=await r.getAccountInfo(n.programdataAddress);if(i===null)throw new Error("program data account not found");const{programData:o}=Ip(i.data);return o}const dM=Bt.rustEnum([Bt.struct([],"uninitialized"),Bt.struct([Bt.option(Bt.publicKey(),"authorityAddress")],"buffer"),Bt.struct([Bt.publicKey("programdataAddress")],"program"),Bt.struct([Bt.u64("slot"),Bt.option(Bt.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,Bt.u32());function Ip(r){return dM.decode(r)}var pM=Object.freeze({__proto__:null,verifiedBuild:async function(r,e,t=5){const n=`https://api.apr.dev/api/v0/program/${e.toString()}/latest?limit=${t}`,[i,o]=await Promise.all([y2(r,e),fM(n)]),s=(await o.json()).filter(u=>!u.aborted&&u.state==="Built"&&u.verified==="Verified");if(s.length===0)return null;const a=s[0];return i.slot.toNumber()!==a.verified_slot?null:a},fetchData:y2,decodeUpgradeableLoaderState:Ip}),gM=Object.freeze({__proto__:null,sha256:cM,rpc:zB,publicKey:lM,bytes:TB,token:hM,features:$B,registry:pM});function yM(r){return"accounts"in r}const mM=Bt.struct([Bt.publicKey("authority"),Bt.vecU8("data")]);function Yc(r,e){var t,n;let i={};const o=r.args?r.args.length:0;if(e.length>o){if(e.length!==o+1)throw new Error(`provided too many arguments ${e} to instruction ${r==null?void 0:r.name} expecting: ${(n=(t=r.args)===null||t===void 0?void 0:t.map(s=>s.name))!==null&&n!==void 0?n:[]}`);i=e.pop()}return[e,i]}class Eh{static build(e,t,n){if(e.name==="_inner")throw new bc("the _inner name is reserved");const i=(...o)=>{const[s,a]=Yc(e,[...o]);sg(e.accounts,a.accounts);const u=i.accounts(a.accounts);return a.remainingAccounts!==void 0&&u.push(...a.remainingAccounts),lg("debug-logs")&&console.log("Outgoing account metas:",u),new rr({keys:u,programId:n,data:t(e.name,Q3(e,...s))})};return i.accounts=o=>Eh.accountsArray(o,e.accounts,n,e.name),i}static accountsArray(e,t,n,i){return e?t.map(o=>{if(("accounts"in o?o.accounts:void 0)!==void 0){const s=e[o.name];return Eh.accountsArray(s,o.accounts,n,i).flat()}{const s=o;let a;try{a=Sn(e[o.name])}catch{throw new Error(`Wrong input type for account "${o.name}" in the instruction accounts object${i!==void 0?' for instruction "'+i+'"':""}. Expected PublicKey or string.`)}const u=s.isOptional&&a.equals(n);return{pubkey:a,isWritable:s.isMut&&!u,isSigner:s.isSigner&&!u}}}).flat():[]}}class wM{static build(e,t){return(...n)=>{var i,o,s;const[,a]=Yc(e,[...n]),u=new Gt;if(a.preInstructions&&a.instructions)throw new Error("instructions is deprecated, use preInstructions");return(i=a.preInstructions)===null||i===void 0||i.forEach(l=>u.add(l)),(o=a.instructions)===null||o===void 0||o.forEach(l=>u.add(l)),u.add(t(...n)),(s=a.postInstructions)===null||s===void 0||s.forEach(l=>u.add(l)),u}}}class bM{static build(e,t,n,i){return async(...o)=>{var s;const a=t(...o),[,u]=Yc(e,[...o]);if(i.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await i.sendAndConfirm(a,(s=u.signers)!==null&&s!==void 0?s:[],u.options)}catch(l){throw hg(l,n)}}}}class vM{static build(e,t,n,i){var o;const s={};return(o=e.accounts)===null||o===void 0||o.forEach(a=>{const u=dr(a.name);s[u]=new b8(e,a,n,i,t)}),s}}class b8{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(e,t,n,i,o){this._idlAccount=t,this._programId=n,this._provider=i??wc(),this._coder=o??new dg(e),this._size=this._coder.accounts.size(t)}async fetchNullable(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);return n}async fetchNullableAndContext(e,t){const n=await this.getAccountInfoAndContext(e,t),{value:i,context:o}=n;return{data:i&&i.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,i.data):null,context:o}}async fetch(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);if(n===null)throw new Error(`Account does not exist or has no data ${e.toString()}`);return n}async fetchAndContext(e,t){const{data:n,context:i}=await this.fetchNullableAndContext(e,t);if(n===null)throw new Error(`Account does not exist ${e.toString()}`);return{data:n,context:i}}async fetchMultiple(e,t){return(await this.fetchMultipleAndContext(e,t)).map(n=>n?n.data:null)}async fetchMultipleAndContext(e,t){return(await wp(this._provider.connection,e.map(n=>Sn(n)),t)).map(n=>{if(n==null)return null;const{account:i,context:o}=n;return{data:this._coder.accounts.decode(this._idlAccount.name,i.data),context:o}})}async all(e){const t=this.coder.accounts.memcmp(this._idlAccount.name,e instanceof Ae.Buffer?e:void 0),n=[];return(t==null?void 0:t.offset)!=null&&(t==null?void 0:t.bytes)!=null&&n.push({memcmp:{offset:t.offset,bytes:t.bytes}}),(t==null?void 0:t.dataSize)!=null&&n.push({dataSize:t.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(e)?e:[]]})).map(({pubkey:i,account:o})=>({publicKey:i,account:this._coder.accounts.decode(this._idlAccount.name,o.data)}))}subscribe(e,t){const n=xu.get(e.toString());if(n)return n.ee;const i=new BB;e=Sn(e);const o=this._provider.connection.onAccountChange(e,s=>{const a=this._coder.accounts.decode(this._idlAccount.name,s.data);i.emit("change",a)},t);return xu.set(e.toString(),{ee:i,listener:o}),i}async unsubscribe(e){let t=xu.get(e.toString());t?xu&&await this._provider.connection.removeAccountChangeListener(t.listener).then(()=>{xu.delete(e.toString())}).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(e,t){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return Cr.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:e.publicKey,space:t??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(t??n),programId:this._programId})}async associated(...e){const t=await this.associatedAddress(...e);return await this.fetch(t)}async associatedAddress(...e){return await w8(this._programId,...e)}async getAccountInfo(e,t){return await this._provider.connection.getAccountInfo(Sn(e),t)}async getAccountInfoAndContext(e,t){return await this._provider.connection.getAccountInfoAndContext(Sn(e),t)}}const xu=new Map,m2="Program log: ",_M="Program data: ";class v8{constructor(e,t,n){this._programId=e,this._provider=t,this._eventParser=new pg(e,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(e,t){var n;let i=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.set(e,((n=this._eventListeners.get(e))!==null&&n!==void 0?n:[]).concat(i)),this._eventCallbacks.set(i,[e,t]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(o,s)=>{if(!o.err)for(const a of this._eventParser.parseLogs(o.logs)){const u=this._eventListeners.get(a.name);u&&u.forEach(l=>{const d=this._eventCallbacks.get(l);if(d){const[,_]=d;_(a.data,s.slot,o.signature)}})}})),i}async removeEventListener(e){const t=this._eventCallbacks.get(e);if(!t)throw new Error(`Event listener ${e} doesn't exist!`);const[n]=t;let i=this._eventListeners.get(n);if(!i)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(e),i=i.filter(o=>o!==e),this._eventListeners.set(n,i),i.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class pg{constructor(e,t){this.coder=t,this.programId=e}*parseLogs(e,t=!1){const n=new xM(e),i=new EM;let o=n.next();for(;o!==null;){let[s,a,u]=this.handleLog(i,o,t);s&&(yield s),a&&i.push(a),u&&i.pop(),o=n.next()}}handleLog(e,t,n){return e.stack.length>0&&e.program()===this.programId.toString()?this.handleProgramLog(t,n):[null,...this.handleSystemLog(t)]}handleProgramLog(e,t){if(e.startsWith(m2)||e.startsWith(_M)){const n=e.startsWith(m2)?e.slice(13):e.slice(14),i=this.coder.events.decode(n);if(t&&i===null)throw new Error(`Unable to decode event ${n}`);return[i,null,!1]}return[null,...this.handleSystemLog(e)]}handleSystemLog(e){const t=e.split(":")[0];return t.match(/^Program (.*) success/g)!==null?[null,!0]:t.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:t.includes("invoke")?["cpi",!1]:[null,!1]}}class EM{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(e){this.stack.push(e)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class xM{constructor(e){this.logs=e}next(){if(this.logs.length===0)return null;let e=this.logs[0];return this.logs=this.logs.slice(1),e}}class AM{static build(e,t,n,i,o,s,a){return async(...u)=>{var l;const d=t(...u),[,_]=Yc(e,[...u]);let E;if(i.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{E=await i.simulate(d,_.signers,(l=_.options)===null||l===void 0?void 0:l.commitment)}catch(v){throw hg(v,n)}if(E===void 0)throw new Error("Unable to simulate transaction");const m=E.logs;if(!m)throw new Error("Simulated logs not found");const w=[];if(a.events){let v=new pg(s,o);for(const A of v.parseLogs(m))w.push(A)}return{events:w,raw:m}}}}function $d(r){return new _8(Gc(8),e=>gg.fromBuffer(e),e=>e.toBuffer(),r)}function Pl(r){return new _8(Gc(32),e=>new ye(e),e=>e.toBuffer(),r)}function Kd(r,e){return new kM(r,e)}class _8 extends _f{constructor(e,t,n,i){super(e.span,i),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}class kM extends _f{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=wo()}encode(e,t,n=0){return e==null?this.layout.span+this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+4)+4)}decode(e,t=0){const n=this.discriminator.decode(e,t);if(n===0)return null;if(n===1)return this.layout.decode(e,t+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e,t=0){return this.layout.getSpan(e,t+4)+4}}class gg extends ac{toBuffer(){const e=super.toArray().reverse(),t=Ae.Buffer.from(e);if(t.length===8)return t;if(t.length>=8)throw new Error("u64 too large");const n=Ae.Buffer.alloc(8);return t.copy(n),n}static fromBuffer(e){if(e.length!==8)throw new Error(`Invalid buffer length: ${e.length}`);return new gg([...e].reverse().map(t=>`00${t.toString(16)}`.slice(-2)).join(""),16)}}const SM=Nr([Pl("mint"),Pl("owner"),$d("amount"),Kd(Pl(),"delegate"),(r=>{const e=y8((t=>new Ef(1,t))("discriminator"),null,"state");return e.addVariant(0,Nr([]),"uninitialized"),e.addVariant(1,Nr([]),"initialized"),e.addVariant(2,Nr([]),"frozen"),e})(),Kd($d(),"isNative"),$d("delegatedAmount"),Kd(Pl(),"closeAuthority")]);class _c{constructor(e,t,n,i,o,s,a,u){this._accounts=t,this._provider=n,this._programId=i,this._idlIx=o,this._idlTypes=a,this._customResolver=u,this._args=e,this._accountStore=new IM(n,s,this._programId)}args(e){this._args=e}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:e,resolved:t}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=e,t}return 0}resolveOptionalsHelper(e,t){const n={};for(const i of t){const o=i.name,s=e[o];s!==void 0&&(x8(s)?yM(i)?n[o]=this.resolveOptionalsHelper(s,i.accounts):n[o]=A8(s,!0):s!==null?n[o]=Sn(s):i.isOptional&&(n[o]=this._programId))}return n}resolveOptionals(e){Object.assign(this._accounts,this.resolveOptionalsHelper(e,this._idlIx.accounts))}get(e){const t=e.reduce((n,i)=>n&&n[i],this._accounts);if(t&&t.toBase58)return t}set(e,t){let n=this._accounts;e.forEach((i,o)=>{o==e.length-1&&(n[i]=t),n[i]=n[i]||{},n=n[i]})}async resolveConst(e,t=[]){for(let n=0;n0&&!this.get([...t,u])&&await this.autoPopulatePda(a,t)&&(n+=1)}return n}async resolveRelations(e,t=[]){let n=0;for(let i=0;i!this.get([...t,dr(E)]));if(n+=_.length,_.length>0){const E=await this._accountStore.fetchAccount({publicKey:d});await Promise.all(_.map(async m=>{const w=dr(m);return this.set([...t,w],E[w]),E[w]}))}}}return n}async autoPopulatePda(e,t=[]){if(!e.pda||!e.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(e.pda.seeds.map(s=>this.toBuffer(s,t)));if(n.some(s=>s===void 0))return;const i=await this.parseProgramId(e,t);if(!i)return;const[o]=await ye.findProgramAddress(n,i);this.set([...t,dr(e.name)],o)}async parseProgramId(e,t=[]){var n;if(!(!((n=e.pda)===null||n===void 0)&&n.programId))return this._programId;switch(e.pda.programId.kind){case"const":return new ye(this.toBufferConst(e.pda.programId.value));case"arg":return this.argValue(e.pda.programId);case"account":return await this.accountValue(e.pda.programId,t);default:throw new Error(`Unexpected program seed kind: ${e.pda.programId.kind}`)}}async toBuffer(e,t=[]){switch(e.kind){case"const":return this.toBufferConst(e);case"arg":return await this.toBufferArg(e);case"account":return await this.toBufferAccount(e,t);default:throw new Error(`Unexpected seed kind: ${e.kind}`)}}getType(e,t=[]){if(t.length>0&&e.defined){const n=this._idlTypes.find(o=>o.name===e.defined);if(!n)throw new Error(`Cannot find type ${e.defined}`);const i=n.type.fields.find(o=>o.name===t[0]);return this.getType(i.type,t.slice(1))}return e}toBufferConst(e){return this.toBufferValue(this.getType(e.type,(e.path||"").split(".").slice(1)),e.value)}async toBufferArg(e){const t=this.argValue(e);if(t!==void 0)return this.toBufferValue(this.getType(e.type,(e.path||"").split(".").slice(1)),t)}argValue(e){const t=e.path.split("."),n=dr(t[0]),i=this._idlIx.args.findIndex(o=>o.name===n);if(i===-1)throw new Error(`Unable to find argument for seed: ${n}`);return t.slice(1).reduce((o,s)=>(o||{})[s],this._args[i])}async toBufferAccount(e,t=[]){const n=await this.accountValue(e,t);if(n)return this.toBufferValue(e.type,n)}async accountValue(e,t=[]){const n=e.path.split("."),i=n[0],o=this.get([...t,dr(i)]);if(o===null)throw new Error("fieldPubkey is null");if(n.length===1)return o;const s=await this._accountStore.fetchAccount({publicKey:o,name:e.account});return this.parseAccountValue(s,n.slice(1))}parseAccountValue(e,t){let n;for(;t.length>0;)n=e[dr(t[0])],t=t.slice(1);return n}toBufferValue(e,t){switch(e){case"u8":return Ae.Buffer.from([t]);case"u16":let n=Ae.Buffer.alloc(2);return n.writeUInt16LE(t),n;case"u32":let i=Ae.Buffer.alloc(4);return i.writeUInt32LE(t),i;case"u64":let o=Ae.Buffer.alloc(8);return o.writeBigUInt64LE(BigInt(t)),o;case"string":return Ae.Buffer.from(Y3(t));case"publicKey":return t.toBuffer();default:if(e.array)return Ae.Buffer.from(t);throw new Error(`Unexpected seed type: ${e}`)}}}_c.CONST_ACCOUNTS={associatedTokenProgram:kp,rent:Jo,systemProgram:Cr.programId,tokenProgram:Ap,clock:gi};class IM{constructor(e,t,n){this._provider=e,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=t}async ensureIdl(e){if(!this._idls[e.toBase58()]){const t=await Ks.fetchIdl(e,this._provider);if(t){const n=new Ks(t,e,this._provider);this._idls[e.toBase58()]=n.account}}return this._idls[e.toBase58()]}async fetchAccount({publicKey:e,name:t,programId:n=this._programId}){const i=e.toString();if(!this._cache.has(i))if(t==="TokenAccount"){const o=await this._provider.connection.getAccountInfo(e);if(o===null)throw new Error(`invalid account info for ${i}`);const s=function(a){return SM.decode(a)}(o.data);this._cache.set(i,s)}else if(t){const o=await this.ensureIdl(n);if(o){const s=o[dr(t)];if(s){const a=await s.fetch(e);this._cache.set(i,a)}}}else{const o=await this._provider.connection.getAccountInfo(e);if(o===null)throw new Error(`invalid account info for ${i}`);const s=o.data,a=await this.ensureIdl(o.owner);if(a){const u=Object.values(a)[0];if(!u)throw new Error("No accounts for this program");const l=u.coder.accounts.decodeAny(s);this._cache.set(i,l)}}return this._cache.get(i)}}class E8{static build(e,t,n,i,o,s,a,u,l,d,_){return(...E)=>new BM(E,i,o,s,a,u,e,t,n,l,d,_)}}function x8(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function A8(r,e){const t={};for(const n in r){const i=r[n];if(i!==null)t[n]=x8(i)?A8(i,!0):Sn(i);else if(e)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return t}class BM{constructor(e,t,n,i,o,s,a,u,l,d,_,E){this._ixFn=t,this._txFn=n,this._rpcFn=i,this._simulateFn=o,this._viewFn=s,this._programId=u,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=e,this._accountsResolver=new _c(e,this._accounts,a,u,l,d,_,E)}args(e){this._args=e,this._accountsResolver.args(e)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(e){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(e),this}accountsStrict(e){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(e),this}signers(e){return this._signers=this._signers.concat(e),this}remainingAccounts(e){return this._remainingAccounts=this._remainingAccounts.concat(e),this}preInstructions(e){return this._preInstructions=this._preInstructions.concat(e),this}postInstructions(e){return this._postInstructions=this._postInstructions.concat(e),this}async rpc(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async rpcAndKeys(e){return{pubkeys:await this.pubkeys(),signature:await this.rpc(e)}}async view(e){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async simulate(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class MM{static build(e,t,n,i){const o=t.accounts.find(a=>a.isMut),s=!!t.returns;if(!(o||!s))return async(...a)=>{var u,l;let d=await n(...a);const _=`Program return: ${e} `;let E=d.raw.find(v=>v.startsWith(_));if(!E)throw new Error("View expected return log");let m=J3(E.slice(_.length)),w=t.returns;if(!w)throw new Error("View expected return type");return Fn.fieldLayout({type:w},Array.from([...(u=i.accounts)!==null&&u!==void 0?u:[],...(l=i.types)!==null&&l!==void 0?l:[]])).decode(m)}}}class PM{static build(e,t,n,i,o){const s={},a={},u={},l={},d={},_={},E=X3(e),m=e.accounts?vM.build(e,t,n,i):{};return e.instructions.forEach(w=>{const v=Eh.build(w,(R,j)=>t.instruction.encode(R,j),n),A=wM.build(w,v),I=bM.build(w,A,E,i),B=AM.build(w,A,E,i,t,n,e),S=MM.build(n,w,B,e),P=E8.build(i,n,w,v,A,I,B,S,m,e.types||[],o&&o(w)),C=dr(w.name);a[C]=v,u[C]=A,s[C]=I,l[C]=B,d[C]=P,S&&(_[C]=S)}),[s,a,u,m,l,d,_]}}class Ks{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(e,t,n,i,o){t=Sn(t),n||(n=wc()),this._idl=e,this._provider=n,this._programId=t,this._coder=i??new dg(e),this._events=new v8(this._programId,n,this._coder);const[s,a,u,l,d,_,E]=PM.build(e,this._coder,t,n,o??(()=>{}));this.rpc=s,this.instruction=a,this.transaction=u,this.account=l,this.simulate=d,this.methods=_,this.views=E}static async at(e,t){const n=Sn(e),i=await Ks.fetchIdl(n,t);if(!i)throw new Error(`IDL not found for program: ${e.toString()}`);return new Ks(i,n,t)}static async fetchIdl(e,t){t=t??wc();const n=Sn(e),i=await async function(l){const d=(await ye.findProgramAddress([],l))[0];return await ye.createWithSeed(d,"anchor:idl",l)}(n),o=await t.connection.getAccountInfo(i);if(!o)return null;let s=(a=o.data.slice(8),mM.decode(a));var a;const u=IB(s.data);return JSON.parse(G3(u))}addEventListener(e,t){return this._events.addEventListener(e,t)}async removeEventListener(e){return await this._events.removeEventListener(e)}}const LM=new ye("11111111111111111111111111111111");function CM(r){return new Ks(w2,LM,r,new m8(w2))}const w2={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};var b2,k8=$c(Object.freeze({__proto__:null,web3:_3,AccountClient:b8,AnchorError:Ca,AnchorProvider:i8,BorshAccountsCoder:xs,BorshCoder:dg,BorshEventCoder:u8,BorshInstructionCoder:vf,DISCRIMINATOR_SIZE:_h,EventManager:v8,EventParser:pg,IdlError:bc,LangErrorCode:ft,LangErrorMessage:s8,MethodsBuilderFactory:E8,Native:class{static system(r){return CM(r)}},Program:Ks,ProgramError:vc,ProgramErrorStack:uu,SystemCoder:m8,eventDiscriminator:c8,getProvider:wc,parseIdlErrors:X3,setProvider:function(r){vp=r},splitArgsAndCtx:Yc,toInstruction:Q3,translateAddress:Sn,translateError:hg,utils:gM,validateAccounts:sg,BN:ac})),Au={},ku={},v2,Su={};function TM(){if(v2)return Su;v2=1;var r=vt&&vt.__awaiter||function(n,i,o,s){return new(o||(o=Promise))(function(a,u){function l(E){try{_(s.next(E))}catch(m){u(m)}}function d(E){try{_(s.throw(E))}catch(m){u(m)}}function _(E){E.done?a(E.value):function(m){return m instanceof o?m:new o(function(w){w(m)})}(E.value).then(l,d)}_((s=s.apply(n,i||[])).next())})},e=vt&&vt.__generator||function(n,i){var o,s,a,u,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return u={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function d(_){return function(E){return function(m){if(o)throw new TypeError("Generator is already executing.");for(;l;)try{if(o=1,s&&(a=2&m[0]?s.return:m[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,m[1])).done)return a;switch(s=0,a&&(m=[2&m[0],a.value]),m[0]){case 0:case 1:a=m;break;case 4:return l.label++,{value:m[1],done:!1};case 5:l.label++,s=m[1],m=[0];continue;case 7:m=l.ops.pop(),l.trys.pop();continue;default:if(a=l.trys,!((a=a.length>0&&a[a.length-1])||m[0]!==6&&m[0]!==2)){l=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t>>0,A=new Uint8Array(v);_[E];){var I=e[_.charCodeAt(E)];if(I===255)return;for(var B=0,S=v-1;(I!==0||B>>0,A[S]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");w=B,E++}for(var P=v-w;P!==v&&A[P]===0;)P++;for(var C=new Uint8Array(m+(v-P)),R=m;P!==v;)C[R++]=A[P++];return C}return{encode:function(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var E=0,m=0,w=0,v=_.length;w!==v&&_[w]===0;)w++,E++;for(var A=(v-w)*l+1>>>0,I=new Uint8Array(A);w!==v;){for(var B=_[w],S=0,P=A-1;(B!==0||S>>0,I[P]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");m=S,w++}for(var C=A-m;C!==A&&I[C]===0;)C++;for(var R=a.repeat(E);C464)throw new Error("The metadata is too long");var R=w.subarray(0,B);return s.Buffer.concat([I,R])}var j=A.encode(m,w);return R=w.subarray(0,j),s.Buffer.concat([I,R])},_.parseIxLayout=function(E){var m=E.instructions.map(function(w){var v=w.args.map(function(I){var B,S;return l.IdlCoder.fieldLayout(I,Array.from(n(n([],(B=E.accounts)!==null&&B!==void 0?B:[]),(S=E.types)!==null&&S!==void 0?S:[])))}),A=a.default(w.name);return[A,u.struct(v,A)]});return new Map(m)},_.prototype.decode=function(E,m){m===void 0&&(m="hex"),typeof E=="string"&&(E=m==="hex"?s.Buffer.from(E,"hex"):s.Buffer.from(o.default.decode(E)));var w=o.default.encode(E.subarray(0,this.discriminatorLength)),v=E.subarray(this.discriminatorLength),A=this.discriminatorLayouts.get(w);if(!A)return null;if(A.name==="updProduct"||A.name==="addProduct"){for(var I={},B=0;Br.MAX_SLOT_DIFFERENCE&&(be=e.Unknown),be===e.Trading&&(B=$e.price,S=$e.confidence);for(var me=[],se=240;me.length0?i-4:i;for(t=0;t>16&255,s[a++]=e>>8&255,s[a++]=255&e;return o===2&&(e=Jn[r.charCodeAt(t)]<<2|Jn[r.charCodeAt(t+1)]>>4,s[a++]=255&e),o===1&&(e=Jn[r.charCodeAt(t)]<<10|Jn[r.charCodeAt(t+1)]<<4|Jn[r.charCodeAt(t+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(r){for(var e,t=r.length,n=t%3,i=[],o=16383,s=0,a=t-n;sa?a:s+o));return n===1?(e=r[t-1],i.push(Fi[e>>2]+Fi[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Fi[e>>10]+Fi[e>>4&63]+Fi[e<<2&63]+"=")),i.join("")}},Fi=[],Jn=[],zM=typeof Uint8Array<"u"?Uint8Array:Array,L2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oa=0;oa<64;++oa)Fi[oa]=L2[oa],Jn[L2.charCodeAt(oa)]=oa;function C2(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");return t===-1&&(t=e),[t,t===e?0:4-t%4]}function jM(r,e,t){for(var n,i,o=[],s=e;s>18&63]+Fi[i>>12&63]+Fi[i>>6&63]+Fi[63&i]);return o.join("")}Jn["-".charCodeAt(0)]=62,Jn["_".charCodeAt(0)]=63;var Vd={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function T2(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function B8(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function xh(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}Vd.read=function(r,e,t,n,i){var o,s,a=8*i-n-1,u=(1<>1,d=-7,_=t?i-1:0,E=t?-1:1,m=r[e+_];for(_+=E,o=m&(1<<-d)-1,m>>=-d,d+=a;d>0;o=256*o+r[e+_],_+=E,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=n;d>0;s=256*s+r[e+_],_+=E,d-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:1/0*(m?-1:1);s+=Math.pow(2,n),o-=l}return(m?-1:1)*s*Math.pow(2,o-n)},Vd.write=function(r,e,t,n,i,o){var s,a,u,l=8*o-i-1,d=(1<>1,E=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,w=n?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+_>=1?E/u:E*Math.pow(2,1-_))*u>=2&&(s++,u/=2),s+_>=d?(a=0,s=d):s+_>=1?(a=(e*u-1)*Math.pow(2,i),s+=_):(a=e*Math.pow(2,_-1)*Math.pow(2,i),s=0));i>=8;r[t+m]=255&a,m+=w,a/=256,i-=8);for(s=s<0;r[t+m]=255&s,m+=w,s/=256,l-=8);r[t+m-w]|=128*v},function(r){const e=DM,t=Vd,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=function(f){return+f!=f&&(f=0),s.alloc(+f)},r.INSPECT_MAX_BYTES=50;const i=2147483647;function o(f){if(f>i)throw new RangeError('The value "'+f+'" is invalid for option "size"');const b=new Uint8Array(f);return Object.setPrototypeOf(b,s.prototype),b}function s(f,b,k){if(typeof f=="number"){if(typeof b=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return l(f)}return a(f,b,k)}function a(f,b,k){if(typeof f=="string")return function($,Y){if(typeof Y=="string"&&Y!==""||(Y="utf8"),!s.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);const de=0|m($,Y);let Ke=o(de);const Oe=Ke.write($,Y);return Oe!==de&&(Ke=Ke.slice(0,Oe)),Ke}(f,b);if(ArrayBuffer.isView(f))return function($){if(me($,Uint8Array)){const Y=new Uint8Array($);return _(Y.buffer,Y.byteOffset,Y.byteLength)}return d($)}(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(me(f,ArrayBuffer)||f&&me(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(me(f,SharedArrayBuffer)||f&&me(f.buffer,SharedArrayBuffer)))return _(f,b,k);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const T=f.valueOf&&f.valueOf();if(T!=null&&T!==f)return s.from(T,b,k);const U=function($){if(s.isBuffer($)){const Y=0|E($.length),de=o(Y);return de.length===0||$.copy(de,0,0,Y),de}return $.length!==void 0?typeof $.length!="number"||se($.length)?o(0):d($):$.type==="Buffer"&&Array.isArray($.data)?d($.data):void 0}(f);if(U)return U;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return s.from(f[Symbol.toPrimitive]("string"),b,k);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}function u(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function l(f){return u(f),o(f<0?0:0|E(f))}function d(f){const b=f.length<0?0:0|E(f.length),k=o(b);for(let T=0;T=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|f}function m(f,b){if(s.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||me(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const k=f.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&k===0)return 0;let U=!1;for(;;)switch(b){case"ascii":case"latin1":case"binary":return k;case"utf8":case"utf-8":return we(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*k;case"hex":return k>>>1;case"base64":return $e(f).length;default:if(U)return T?-1:we(f).length;b=(""+b).toLowerCase(),U=!0}}function w(f,b,k){let T=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((k===void 0||k>this.length)&&(k=this.length),k<=0)||(k>>>=0)<=(b>>>=0))return"";for(f||(f="utf8");;)switch(f){case"hex":return x(this,b,k);case"utf8":case"utf-8":return H(this,b,k);case"ascii":return c(this,b,k);case"latin1":case"binary":return p(this,b,k);case"base64":return j(this,b,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,b,k);default:if(T)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),T=!0}}function v(f,b,k){const T=f[b];f[b]=f[k],f[k]=T}function A(f,b,k,T,U){if(f.length===0)return-1;if(typeof k=="string"?(T=k,k=0):k>2147483647?k=2147483647:k<-2147483648&&(k=-2147483648),se(k=+k)&&(k=U?0:f.length-1),k<0&&(k=f.length+k),k>=f.length){if(U)return-1;k=f.length-1}else if(k<0){if(!U)return-1;k=0}if(typeof b=="string"&&(b=s.from(b,T)),s.isBuffer(b))return b.length===0?-1:I(f,b,k,T,U);if(typeof b=="number")return b&=255,typeof Uint8Array.prototype.indexOf=="function"?U?Uint8Array.prototype.indexOf.call(f,b,k):Uint8Array.prototype.lastIndexOf.call(f,b,k):I(f,[b],k,T,U);throw new TypeError("val must be string, number or Buffer")}function I(f,b,k,T,U){let $,Y=1,de=f.length,Ke=b.length;if(T!==void 0&&((T=String(T).toLowerCase())==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(f.length<2||b.length<2)return-1;Y=2,de/=2,Ke/=2,k/=2}function Oe(xe,nt){return Y===1?xe[nt]:xe.readUInt16BE(nt*Y)}if(U){let xe=-1;for($=k;$de&&(k=de-Ke),$=k;$>=0;$--){let xe=!0;for(let nt=0;ntU&&(T=U):T=U;const $=b.length;let Y;for(T>$/2&&(T=$/2),Y=0;Y>8,Ke=Y%256,Oe.push(Ke),Oe.push(de);return Oe}(b,f.length-k),f,k,T)}function j(f,b,k){return b===0&&k===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(b,k))}function H(f,b,k){k=Math.min(f.length,k);const T=[];let U=b;for(;U239?4:$>223?3:$>191?2:1;if(U+de<=k){let Ke,Oe,xe,nt;switch(de){case 1:$<128&&(Y=$);break;case 2:Ke=f[U+1],(192&Ke)==128&&(nt=(31&$)<<6|63&Ke,nt>127&&(Y=nt));break;case 3:Ke=f[U+1],Oe=f[U+2],(192&Ke)==128&&(192&Oe)==128&&(nt=(15&$)<<12|(63&Ke)<<6|63&Oe,nt>2047&&(nt<55296||nt>57343)&&(Y=nt));break;case 4:Ke=f[U+1],Oe=f[U+2],xe=f[U+3],(192&Ke)==128&&(192&Oe)==128&&(192&xe)==128&&(nt=(15&$)<<18|(63&Ke)<<12|(63&Oe)<<6|63&xe,nt>65535&&nt<1114112&&(Y=nt))}}Y===null?(Y=65533,de=1):Y>65535&&(Y-=65536,T.push(Y>>>10&1023|55296),Y=56320|1023&Y),T.push(Y),U+=de}return function($){const Y=$.length;if(Y<=N)return String.fromCharCode.apply(String,$);let de="",Ke=0;for(;Ke"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(f,b,k){return a(f,b,k)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(f,b,k){return function(T,U,$){return u(T),T<=0?o(T):U!==void 0?typeof $=="string"?o(T).fill(U,$):o(T).fill(U):o(T)}(f,b,k)},s.allocUnsafe=function(f){return l(f)},s.allocUnsafeSlow=function(f){return l(f)},s.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==s.prototype},s.compare=function(f,b){if(me(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),me(b,Uint8Array)&&(b=s.from(b,b.offset,b.byteLength)),!s.isBuffer(f)||!s.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===b)return 0;let k=f.length,T=b.length;for(let U=0,$=Math.min(k,T);U<$;++U)if(f[U]!==b[U]){k=f[U],T=b[U];break}return kT.length?(s.isBuffer($)||($=s.from($)),$.copy(T,U)):Uint8Array.prototype.set.call(T,$,U);else{if(!s.isBuffer($))throw new TypeError('"list" argument must be an Array of Buffers');$.copy(T,U)}U+=$.length}return T},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const f=this.length;if(f%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;bb&&(f+=" ... "),""},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(f,b,k,T,U){if(me(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(b===void 0&&(b=0),k===void 0&&(k=f?f.length:0),T===void 0&&(T=0),U===void 0&&(U=this.length),b<0||k>f.length||T<0||U>this.length)throw new RangeError("out of range index");if(T>=U&&b>=k)return 0;if(T>=U)return-1;if(b>=k)return 1;if(this===f)return 0;let $=(U>>>=0)-(T>>>=0),Y=(k>>>=0)-(b>>>=0);const de=Math.min($,Y),Ke=this.slice(T,U),Oe=f.slice(b,k);for(let xe=0;xe>>=0,isFinite(k)?(k>>>=0,T===void 0&&(T="utf8")):(T=k,k=void 0)}const U=this.length-b;if((k===void 0||k>U)&&(k=U),f.length>0&&(k<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let $=!1;for(;;)switch(T){case"hex":return B(this,f,b,k);case"utf8":case"utf-8":return S(this,f,b,k);case"ascii":case"latin1":case"binary":return P(this,f,b,k);case"base64":return C(this,f,b,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,f,b,k);default:if($)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),$=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function c(f,b,k){let T="";k=Math.min(f.length,k);for(let U=b;UT)&&(k=T);let U="";for(let $=b;$k)throw new RangeError("Trying to access beyond buffer length")}function y(f,b,k,T,U,$){if(!s.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>U||b<$)throw new RangeError('"value" argument is out of bounds');if(k+T>f.length)throw new RangeError("Index out of range")}function L(f,b,k,T,U){X(b,T,U,f,k,7);let $=Number(b&BigInt(4294967295));f[k++]=$,$>>=8,f[k++]=$,$>>=8,f[k++]=$,$>>=8,f[k++]=$;let Y=Number(b>>BigInt(32)&BigInt(4294967295));return f[k++]=Y,Y>>=8,f[k++]=Y,Y>>=8,f[k++]=Y,Y>>=8,f[k++]=Y,k}function F(f,b,k,T,U){X(b,T,U,f,k,7);let $=Number(b&BigInt(4294967295));f[k+7]=$,$>>=8,f[k+6]=$,$>>=8,f[k+5]=$,$>>=8,f[k+4]=$;let Y=Number(b>>BigInt(32)&BigInt(4294967295));return f[k+3]=Y,Y>>=8,f[k+2]=Y,Y>>=8,f[k+1]=Y,Y>>=8,f[k]=Y,k+8}function K(f,b,k,T,U,$){if(k+T>f.length)throw new RangeError("Index out of range");if(k<0)throw new RangeError("Index out of range")}function V(f,b,k,T,U){return b=+b,k>>>=0,U||K(f,0,k,4),t.write(f,b,k,T,23,4),k+4}function W(f,b,k,T,U){return b=+b,k>>>=0,U||K(f,0,k,8),t.write(f,b,k,T,52,8),k+8}s.prototype.slice=function(f,b){const k=this.length;(f=~~f)<0?(f+=k)<0&&(f=0):f>k&&(f=k),(b=b===void 0?k:~~b)<0?(b+=k)<0&&(b=0):b>k&&(b=k),b>>=0,b>>>=0,k||h(f,b,this.length);let T=this[f],U=1,$=0;for(;++$>>=0,b>>>=0,k||h(f,b,this.length);let T=this[f+--b],U=1;for(;b>0&&(U*=256);)T+=this[f+--b]*U;return T},s.prototype.readUint8=s.prototype.readUInt8=function(f,b){return f>>>=0,b||h(f,1,this.length),this[f]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(f,b){return f>>>=0,b||h(f,2,this.length),this[f]|this[f+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(f,b){return f>>>=0,b||h(f,2,this.length),this[f]<<8|this[f+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(f,b){return f>>>=0,b||h(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+16777216*this[f+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(f,b){return f>>>=0,b||h(f,4,this.length),16777216*this[f]+(this[f+1]<<16|this[f+2]<<8|this[f+3])},s.prototype.readBigUInt64LE=oe(function(f){te(f>>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=b+256*this[++f]+65536*this[++f]+this[++f]*2**24,U=this[++f]+256*this[++f]+65536*this[++f]+k*2**24;return BigInt(T)+(BigInt(U)<>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=b*2**24+65536*this[++f]+256*this[++f]+this[++f],U=this[++f]*2**24+65536*this[++f]+256*this[++f]+k;return(BigInt(T)<>>=0,b>>>=0,k||h(f,b,this.length);let T=this[f],U=1,$=0;for(;++$=U&&(T-=Math.pow(2,8*b)),T},s.prototype.readIntBE=function(f,b,k){f>>>=0,b>>>=0,k||h(f,b,this.length);let T=b,U=1,$=this[f+--T];for(;T>0&&(U*=256);)$+=this[f+--T]*U;return U*=128,$>=U&&($-=Math.pow(2,8*b)),$},s.prototype.readInt8=function(f,b){return f>>>=0,b||h(f,1,this.length),128&this[f]?-1*(255-this[f]+1):this[f]},s.prototype.readInt16LE=function(f,b){f>>>=0,b||h(f,2,this.length);const k=this[f]|this[f+1]<<8;return 32768&k?4294901760|k:k},s.prototype.readInt16BE=function(f,b){f>>>=0,b||h(f,2,this.length);const k=this[f+1]|this[f]<<8;return 32768&k?4294901760|k:k},s.prototype.readInt32LE=function(f,b){return f>>>=0,b||h(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},s.prototype.readInt32BE=function(f,b){return f>>>=0,b||h(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},s.prototype.readBigInt64LE=oe(function(f){te(f>>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=this[f+4]+256*this[f+5]+65536*this[f+6]+(k<<24);return(BigInt(T)<>>=0,"offset");const b=this[f],k=this[f+7];b!==void 0&&k!==void 0||ge(f,this.length-8);const T=(b<<24)+65536*this[++f]+256*this[++f]+this[++f];return(BigInt(T)<>>=0,b||h(f,4,this.length),t.read(this,f,!0,23,4)},s.prototype.readFloatBE=function(f,b){return f>>>=0,b||h(f,4,this.length),t.read(this,f,!1,23,4)},s.prototype.readDoubleLE=function(f,b){return f>>>=0,b||h(f,8,this.length),t.read(this,f,!0,52,8)},s.prototype.readDoubleBE=function(f,b){return f>>>=0,b||h(f,8,this.length),t.read(this,f,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(f,b,k,T){f=+f,b>>>=0,k>>>=0,T||y(this,f,b,k,Math.pow(2,8*k)-1,0);let U=1,$=0;for(this[b]=255&f;++$>>=0,k>>>=0,T||y(this,f,b,k,Math.pow(2,8*k)-1,0);let U=k-1,$=1;for(this[b+U]=255&f;--U>=0&&($*=256);)this[b+U]=f/$&255;return b+k},s.prototype.writeUint8=s.prototype.writeUInt8=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,1,255,0),this[b]=255&f,b+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,65535,0),this[b]=255&f,this[b+1]=f>>>8,b+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,65535,0),this[b]=f>>>8,this[b+1]=255&f,b+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,4294967295,0),this[b+3]=f>>>24,this[b+2]=f>>>16,this[b+1]=f>>>8,this[b]=255&f,b+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,4294967295,0),this[b]=f>>>24,this[b+1]=f>>>16,this[b+2]=f>>>8,this[b+3]=255&f,b+4},s.prototype.writeBigUInt64LE=oe(function(f,b=0){return L(this,f,b,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=oe(function(f,b=0){return F(this,f,b,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(f,b,k,T){if(f=+f,b>>>=0,!T){const de=Math.pow(2,8*k-1);y(this,f,b,k,de-1,-de)}let U=0,$=1,Y=0;for(this[b]=255&f;++U>0)-Y&255;return b+k},s.prototype.writeIntBE=function(f,b,k,T){if(f=+f,b>>>=0,!T){const de=Math.pow(2,8*k-1);y(this,f,b,k,de-1,-de)}let U=k-1,$=1,Y=0;for(this[b+U]=255&f;--U>=0&&($*=256);)f<0&&Y===0&&this[b+U+1]!==0&&(Y=1),this[b+U]=(f/$>>0)-Y&255;return b+k},s.prototype.writeInt8=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,1,127,-128),f<0&&(f=255+f+1),this[b]=255&f,b+1},s.prototype.writeInt16LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,32767,-32768),this[b]=255&f,this[b+1]=f>>>8,b+2},s.prototype.writeInt16BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,2,32767,-32768),this[b]=f>>>8,this[b+1]=255&f,b+2},s.prototype.writeInt32LE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,2147483647,-2147483648),this[b]=255&f,this[b+1]=f>>>8,this[b+2]=f>>>16,this[b+3]=f>>>24,b+4},s.prototype.writeInt32BE=function(f,b,k){return f=+f,b>>>=0,k||y(this,f,b,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[b]=f>>>24,this[b+1]=f>>>16,this[b+2]=f>>>8,this[b+3]=255&f,b+4},s.prototype.writeBigInt64LE=oe(function(f,b=0){return L(this,f,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=oe(function(f,b=0){return F(this,f,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeFloatLE=function(f,b,k){return V(this,f,b,!0,k)},s.prototype.writeFloatBE=function(f,b,k){return V(this,f,b,!1,k)},s.prototype.writeDoubleLE=function(f,b,k){return W(this,f,b,!0,k)},s.prototype.writeDoubleBE=function(f,b,k){return W(this,f,b,!1,k)},s.prototype.copy=function(f,b,k,T){if(!s.isBuffer(f))throw new TypeError("argument should be a Buffer");if(k||(k=0),T||T===0||(T=this.length),b>=f.length&&(b=f.length),b||(b=0),T>0&&T=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),f.length-b>>=0,k=k===void 0?this.length:k>>>0,f||(f=0),typeof f=="number")for(U=b;U=T+4;k-=3)b=`_${f.slice(k-3,k)}${b}`;return`${f.slice(0,k)}${b}`}function X(f,b,k,T,U,$){if(f>k||f3?b===0||b===BigInt(0)?`>= 0${Y} and < 2${Y} ** ${8*($+1)}${Y}`:`>= -(2${Y} ** ${8*($+1)-1}${Y}) and < 2 ** ${8*($+1)-1}${Y}`:`>= ${b}${Y} and <= ${k}${Y}`,new Z.ERR_OUT_OF_RANGE("value",de,f)}(function(Y,de,Ke){te(de,"offset"),Y[de]!==void 0&&Y[de+Ke]!==void 0||ge(de,Y.length-(Ke+1))})(T,U,$)}function te(f,b){if(typeof f!="number")throw new Z.ERR_INVALID_ARG_TYPE(b,"number",f)}function ge(f,b,k){throw Math.floor(f)!==f?(te(f,k),new Z.ERR_OUT_OF_RANGE(k||"offset","an integer",f)):b<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(k||"offset",`>= ${k?1:0} and <= ${b}`,f)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(f,b){return`The "${f}" argument must be of type number. Received type ${typeof b}`},TypeError),G("ERR_OUT_OF_RANGE",function(f,b,k){let T=`The value of "${f}" is out of range.`,U=k;return Number.isInteger(k)&&Math.abs(k)>2**32?U=ne(String(k)):typeof k=="bigint"&&(U=String(k),(k>BigInt(2)**BigInt(32)||k<-(BigInt(2)**BigInt(32)))&&(U=ne(U)),U+="n"),T+=` It must be ${b}. Received ${U}`,T},RangeError);const ce=/[^+/0-9A-Za-z-_]/g;function we(f,b){let k;b=b||1/0;const T=f.length;let U=null;const $=[];for(let Y=0;Y55295&&k<57344){if(!U){if(k>56319){(b-=3)>-1&&$.push(239,191,189);continue}if(Y+1===T){(b-=3)>-1&&$.push(239,191,189);continue}U=k;continue}if(k<56320){(b-=3)>-1&&$.push(239,191,189),U=k;continue}k=65536+(U-55296<<10|k-56320)}else U&&(b-=3)>-1&&$.push(239,191,189);if(U=null,k<128){if((b-=1)<0)break;$.push(k)}else if(k<2048){if((b-=2)<0)break;$.push(k>>6|192,63&k|128)}else if(k<65536){if((b-=3)<0)break;$.push(k>>12|224,k>>6&63|128,63&k|128)}else{if(!(k<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;$.push(k>>18|240,k>>12&63|128,k>>6&63|128,63&k|128)}}return $}function $e(f){return e.toByteArray(function(b){if((b=(b=b.split("=")[0]).trim().replace(ce,"")).length<2)return"";for(;b.length%4!=0;)b+="=";return b}(f))}function be(f,b,k,T){let U;for(U=0;U=b.length||U>=f.length);++U)b[U+k]=f[U];return U}function me(f,b){return f instanceof b||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===b.name}function se(f){return f!=f}const ie=function(){const f="0123456789abcdef",b=new Array(256);for(let k=0;k<16;++k){const T=16*k;for(let U=0;U<16;++U)b[T+U]=f[k]+f[U]}return b}();function oe(f){return typeof BigInt>"u"?Fe:f}function Fe(){throw new Error("BigInt not supported")}}(_r);const qd=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,M8=r=>r instanceof Uint8Array,Hd=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Bi=(r,e)=>r<<32-e|r>>>e;if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function wg(r){if(typeof r=="string"&&(r=function(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(r)),!M8(r))throw new Error("expected Uint8Array, got "+typeof r);return r}class P8{clone(){return this._cloneInto()}}function L8(r){const e=n=>r().update(wg(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function C8(r=32){if(qd&&typeof qd.getRandomValues=="function")return qd.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}class T8 extends P8{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,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=Hd(this.buffer)}update(e){xh(this);const{view:t,buffer:n,blockLen:i}=this,o=(e=wg(e)).length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let _=s;_>v&A),B=Number(m&A),S=w?4:0,P=w?0:4;_.setUint32(E+S,I,w),_.setUint32(E+P,B,w)})(n,i-8,BigInt(8*this.length),o),this.process(n,0);const a=Hd(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 _=0;_>Bp&Ll)}:{h:0|Number(r>>Bp&Ll),l:0|Number(r&Ll)}}const FM={fromBig:O2,split:function(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;iBigInt(r>>>0)<>>0),shrSH:(r,e,t)=>r>>>t,shrSL:(r,e,t)=>r<<32-t|e>>>t,rotrSH:(r,e,t)=>r>>>t|e<<32-t,rotrSL:(r,e,t)=>r<<32-t|e>>>t,rotrBH:(r,e,t)=>r<<64-t|e>>>t-32,rotrBL:(r,e,t)=>r>>>t-32|e<<64-t,rotr32H:(r,e)=>e,rotr32L:(r,e)=>r,rotlSH:(r,e,t)=>r<>>32-t,rotlSL:(r,e,t)=>e<>>32-t,rotlBH:(r,e,t)=>e<>>64-t,rotlBL:(r,e,t)=>r<>>64-t,add:function(r,e,t,n){const i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:0|i}},add3L:(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),add3H:(r,e,t,n)=>e+t+n+(r/2**32|0)|0,add4L:(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),add4H:(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,add5H:(r,e,t,n,i,o)=>e+t+n+i+o+(r/2**32|0)|0,add5L:(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0)};var Ot=FM;const[$M,KM]=Ot.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Lo=new Uint32Array(80),Co=new Uint32Array(80);class VM extends T8{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:d,Fh:_,Fl:E,Gh:m,Gl:w,Hh:v,Hl:A}=this;return[e,t,n,i,o,s,a,u,l,d,_,E,m,w,v,A]}set(e,t,n,i,o,s,a,u,l,d,_,E,m,w,v,A){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|i,this.Ch=0|o,this.Cl=0|s,this.Dh=0|a,this.Dl=0|u,this.Eh=0|l,this.El=0|d,this.Fh=0|_,this.Fl=0|E,this.Gh=0|m,this.Gl=0|w,this.Hh=0|v,this.Hl=0|A}process(e,t){for(let S=0;S<16;S++,t+=4)Lo[S]=e.getUint32(t),Co[S]=e.getUint32(t+=4);for(let S=16;S<80;S++){const P=0|Lo[S-15],C=0|Co[S-15],R=Ot.rotrSH(P,C,1)^Ot.rotrSH(P,C,8)^Ot.shrSH(P,C,7),j=Ot.rotrSL(P,C,1)^Ot.rotrSL(P,C,8)^Ot.shrSL(P,C,7),H=0|Lo[S-2],N=0|Co[S-2],c=Ot.rotrSH(H,N,19)^Ot.rotrBH(H,N,61)^Ot.shrSH(H,N,6),p=Ot.rotrSL(H,N,19)^Ot.rotrBL(H,N,61)^Ot.shrSL(H,N,6),x=Ot.add4L(j,p,Co[S-7],Co[S-16]),g=Ot.add4H(x,R,c,Lo[S-7],Lo[S-16]);Lo[S]=0|g,Co[S]=0|x}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:d,Eh:_,El:E,Fh:m,Fl:w,Gh:v,Gl:A,Hh:I,Hl:B}=this;for(let S=0;S<80;S++){const P=Ot.rotrSH(_,E,14)^Ot.rotrSH(_,E,18)^Ot.rotrBH(_,E,41),C=Ot.rotrSL(_,E,14)^Ot.rotrSL(_,E,18)^Ot.rotrBL(_,E,41),R=_&m^~_&v,j=E&w^~E&A,H=Ot.add5L(B,C,j,KM[S],Co[S]),N=Ot.add5H(H,I,P,R,$M[S],Lo[S]),c=0|H,p=Ot.rotrSH(n,i,28)^Ot.rotrBH(n,i,34)^Ot.rotrBH(n,i,39),x=Ot.rotrSL(n,i,28)^Ot.rotrBL(n,i,34)^Ot.rotrBL(n,i,39),g=n&o^n&a^o&a,h=i&s^i&u^s&u;I=0|v,B=0|A,v=0|m,A=0|w,m=0|_,w=0|E,{h:_,l:E}=Ot.add(0|l,0|d,0|N,0|c),l=0|a,d=0|u,a=0|o,u=0|s,o=0|n,s=0|i;const y=Ot.add3L(c,x,h);n=Ot.add3H(y,N,p,g),i=0|y}({h:n,l:i}=Ot.add(0|this.Ah,0|this.Al,0|n,0|i)),{h:o,l:s}=Ot.add(0|this.Bh,0|this.Bl,0|o,0|s),{h:a,l:u}=Ot.add(0|this.Ch,0|this.Cl,0|a,0|u),{h:l,l:d}=Ot.add(0|this.Dh,0|this.Dl,0|l,0|d),{h:_,l:E}=Ot.add(0|this.Eh,0|this.El,0|_,0|E),{h:m,l:w}=Ot.add(0|this.Fh,0|this.Fl,0|m,0|w),{h:v,l:A}=Ot.add(0|this.Gh,0|this.Gl,0|v,0|A),{h:I,l:B}=Ot.add(0|this.Hh,0|this.Hl,0|I,0|B),this.set(n,i,o,s,a,u,l,d,_,E,m,w,v,A,I,B)}roundClean(){Lo.fill(0),Co.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const qM=L8(()=>new VM),R2=BigInt(0),Ql=BigInt(1),HM=BigInt(2),xf=r=>r instanceof Uint8Array,WM=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Rs(r){if(!xf(r))throw new Error("Uint8Array expected");let e="";for(let t=0;tn+i.length,0));let t=0;return r.forEach(n=>{if(!xf(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}const vg=r=>(HM<new Uint8Array(r),N2=r=>Uint8Array.from(r);function O8(r,e,t){if(typeof r!="number"||r<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 t!="function")throw new Error("hmacFn must be a function");let n=Wd(r),i=Wd(r),o=0;const s=()=>{n.fill(1),i.fill(0),o=0},a=(...d)=>t(i,n,...d),u=(d=Wd())=>{i=a(N2([0]),d),n=a(),d.length!==0&&(i=a(N2([1]),d),n=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const _=[];for(;d{let E;for(s(),u(d);!(E=_(l()));)u();return s(),E}}const ZM={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Ya(r,e,t={}){const n=(i,o,s)=>{const a=ZM[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);const u=r[i];if(!(s&&u===void 0||a(u,r)))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${o}`)};for(const[i,o]of Object.entries(e))n(i,o,!1);for(const[i,o]of Object.entries(t))n(i,o,!0);return r}var GM=Object.freeze({__proto__:null,bytesToHex:Rs,numberToHexUnpadded:U2,hexToNumber:bg,hexToBytes:Ga,bytesToNumberBE:ys,bytesToNumberLE:Ta,numberToBytesBE:Oa,numberToBytesLE:Ec,numberToVarBytesBE:function(r){return Ga(U2(r))},ensureBytes:Dr,concatBytes:Us,equalBytes:function(r,e){if(r.length!==e.length)return!1;for(let t=0;tR2;r>>=Ql,e+=1);return e},bitGet:function(r,e){return r>>BigInt(e)&Ql},bitSet:(r,e,t)=>r|(t?Ql:R2)<=Hr?t:e+t}function JM(r,e,t){if(t<=Hr||e 0");if(t===vr)return Hr;let n=vr;for(;e>Hr;)e&vr&&(n=n*r%t),r=r*r%t,e>>=vr;return n}function Br(r,e,t){let n=r;for(;e-- >Hr;)n*=n,n%=t;return n}function Mp(r,e){if(r===Hr||e<=Hr)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=br(r,e),n=e,i=Hr,o=vr;for(;t!==Hr;){const s=n%t,a=i-o*(n/t);n=t,t=s,i=o,o=a}if(n!==vr)throw new Error("invert: does not exist");return br(i,e)}BigInt(9),BigInt(16);const XM=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function R8(r,e){const t=e!==void 0?e:r.toString(2).length;return{nBitLength:t,nByteLength:Math.ceil(t/8)}}function U8(r,e,t=!1,n={}){if(r<=Hr)throw new Error(`Expected Field ORDER > 0, got ${r}`);const{nBitLength:i,nByteLength:o}=R8(r,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=function(u){if(u%Zd===YM){const l=(u+vr)/Zd;return function(d,_){const E=d.pow(_,l);if(!d.eql(d.sqr(E),_))throw new Error("Cannot find square root");return E}}if(u%z2===D2){const l=(u-D2)/z2;return function(d,_){const E=d.mul(_,us),m=d.pow(E,l),w=d.mul(_,m),v=d.mul(d.mul(w,us),m),A=d.mul(w,d.sub(v,d.ONE));if(!d.eql(d.sqr(A),_))throw new Error("Cannot find square root");return A}}return function(l){const d=(l-vr)/us;let _,E,m;for(_=l-vr,E=0;_%us===Hr;_/=us,E++);for(m=us;mbr(u,r),isValid:u=>{if(typeof u!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof u);return Hr<=u&&uu===Hr,isOdd:u=>(u&vr)===vr,neg:u=>br(-u,r),eql:(u,l)=>u===l,sqr:u=>br(u*u,r),add:(u,l)=>br(u+l,r),sub:(u,l)=>br(u-l,r),mul:(u,l)=>br(u*l,r),pow:(u,l)=>function(d,_,E){if(E 0");if(E===Hr)return d.ONE;if(E===vr)return _;let m=d.ONE,w=_;for(;E>Hr;)E&vr&&(m=d.mul(m,w)),w=d.sqr(w),E>>=vr;return m}(a,u,l),div:(u,l)=>br(u*Mp(l,r),r),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>Mp(u,r),sqrt:n.sqrt||(u=>s(a,u)),invertBatch:u=>function(l,d){const _=new Array(d.length),E=d.reduce((w,v,A)=>l.is0(v)?w:(_[A]=w,l.mul(w,v)),l.ONE),m=l.inv(E);return d.reduceRight((w,v,A)=>l.is0(v)?w:(_[A]=l.mul(w,_[A]),l.mul(w,v)),m),_}(a,u),cmov:(u,l,d)=>d?l:u,toBytes:u=>t?Ec(u,o):Oa(u,o),fromBytes:u=>{if(u.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${u.length}`);return t?Ta(u):ys(u)}});return Object.freeze(a)}function N8(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const e=r.toString(2).length;return Math.ceil(e/8)}function j2(r){const e=N8(r);return e+Math.ceil(e/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const QM=BigInt(0),Gd=BigInt(1);function D8(r,e){const t=(i,o)=>{const s=o.negate();return i?s:o},n=i=>({windows:Math.ceil(e/i)+1,windowSize:2**(i-1)});return{constTimeNegate:t,unsafeLadder(i,o){let s=r.ZERO,a=i;for(;o>QM;)o&Gd&&(s=s.add(a)),a=a.double(),o>>=Gd;return s},precomputeWindow(i,o){const{windows:s,windowSize:a}=n(o),u=[];let l=i,d=l;for(let _=0;_>=m,A>u&&(A-=E,s+=Gd);const I=v,B=v+Math.abs(A)-1,S=w%2!=0,P=A<0;A===0?d=d.add(t(S,o[I])):l=l.add(t(P,o[B]))}return{p:l,f:d}},wNAFCached(i,o,s,a){const u=i._WINDOW_SIZE||1;let l=o.get(i);return l||(l=this.precomputeWindow(i,u),u!==1&&o.set(i,a(l))),this.wNAF(u,l,s)}}}function Pp(r){return Ya(r.Fp,XM.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),Ya(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...R8(r.n,r.nBitLength),...r,p:r.Fp.ORDER});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */}const hi=BigInt(0),Rn=BigInt(1),Cl=BigInt(2),eP=BigInt(8),tP={zip215:!0};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Lp=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),F2=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const rP=BigInt(1),Cp=BigInt(2),nP=BigInt(5),$2=BigInt(10),iP=BigInt(20),oP=BigInt(40),K2=BigInt(80),oo=U8(Lp,void 0,!0),sP={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:oo,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:qM,randomBytes:C8,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,e){const t=Lp,n=br(e*e*e,t),i=function(E){const m=Lp,w=E*E%m*E%m,v=Br(w,Cp,m)*w%m,A=Br(v,rP,m)*E%m,I=Br(A,nP,m)*A%m,B=Br(I,$2,m)*I%m,S=Br(B,iP,m)*B%m,P=Br(S,oP,m)*S%m,C=Br(P,K2,m)*P%m,R=Br(C,K2,m)*P%m,j=Br(R,$2,m)*I%m;return{pow_p_5_8:Br(j,Cp,m)*E%m,b2:w}}(r*br(n*n*e,t)).pow_p_5_8;let o=br(r*n*i,t);const s=br(e*o*o,t),a=o,u=br(o*F2,t),l=s===r,d=s===br(-r,t),_=s===br(-r*F2,t);return l&&(o=a),(d||_)&&(o=u),(br(o,t)&vr)===vr&&(o=br(-o,t)),{isValid:l||d,value:o}}},aP=function(r){const e=function(h){const y=Pp(h);return Ya(h,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...y})}(r),{Fp:t,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=e,l=Cl<{try{return{isValid:!0,value:t.sqrt(h*t.inv(y))}}catch{return{isValid:!1,value:hi}}}),E=e.adjustScalarBytes||(h=>h),m=e.domain||((h,y,L)=>{if(y.length||L)throw new Error("Contexts/pre-hash are not supported");return h}),w=h=>typeof h=="bigint"&&hiw(h)&&w(y)&&hh===hi||v(h,l);function I(h,y){if(v(h,y))return h;throw new Error(`Expected valid scalar < ${y}, got ${typeof h} ${h}`)}function B(h){return h===hi?h:I(h,n)}const S=new Map;function P(h){if(!(h instanceof C))throw new Error("ExtendedPoint expected")}class C{constructor(y,L,F,K){if(this.ex=y,this.ey=L,this.ez=F,this.et=K,!A(y))throw new Error("x required");if(!A(L))throw new Error("y required");if(!A(F))throw new Error("z required");if(!A(K))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(y){if(y instanceof C)throw new Error("extended point not allowed");const{x:L,y:F}=y||{};if(!A(L)||!A(F))throw new Error("invalid affine point");return new C(L,F,Rn,d(L*F))}static normalizeZ(y){const L=t.invertBatch(y.map(F=>F.ez));return y.map((F,K)=>F.toAffine(L[K])).map(C.fromAffine)}_setWindowSize(y){this._WINDOW_SIZE=y,S.delete(this)}assertValidity(){const{a:y,d:L}=e;if(this.is0())throw new Error("bad point: ZERO");const{ex:F,ey:K,ez:V,et:W}=this,Z=d(F*F),G=d(K*K),ne=d(V*V),X=d(ne*ne),te=d(Z*y);if(d(ne*d(te+G))!==d(X+d(L*d(Z*G))))throw new Error("bad point: equation left != right (1)");if(d(F*K)!==d(V*W))throw new Error("bad point: equation left != right (2)")}equals(y){P(y);const{ex:L,ey:F,ez:K}=this,{ex:V,ey:W,ez:Z}=y,G=d(L*Z),ne=d(V*K),X=d(F*Z),te=d(W*K);return G===ne&&X===te}is0(){return this.equals(C.ZERO)}negate(){return new C(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:y}=e,{ex:L,ey:F,ez:K}=this,V=d(L*L),W=d(F*F),Z=d(Cl*d(K*K)),G=d(y*V),ne=L+F,X=d(d(ne*ne)-V-W),te=G+W,ge=te-Z,ce=G-W,we=d(X*ge),$e=d(te*ce),be=d(X*ce),me=d(ge*te);return new C(we,$e,me,be)}add(y){P(y);const{a:L,d:F}=e,{ex:K,ey:V,ez:W,et:Z}=this,{ex:G,ey:ne,ez:X,et:te}=y;if(L===BigInt(-1)){const k=d((V-K)*(ne+G)),T=d((V+K)*(ne-G)),U=d(T-k);if(U===hi)return this.double();const $=d(W*Cl*te),Y=d(Z*Cl*X),de=Y+$,Ke=T+k,Oe=Y-$,xe=d(de*U),nt=d(Ke*Oe),pt=d(de*Oe),gt=d(U*Ke);return new C(xe,nt,gt,pt)}const ge=d(K*G),ce=d(V*ne),we=d(Z*F*te),$e=d(W*X),be=d((K+V)*(G+ne)-ge-ce),me=$e-we,se=$e+we,ie=d(ce-L*ge),oe=d(be*me),Fe=d(se*ie),f=d(be*ie),b=d(me*se);return new C(oe,Fe,b,f)}subtract(y){return this.add(y.negate())}wNAF(y){return H.wNAFCached(this,S,y,C.normalizeZ)}multiply(y){const{p:L,f:F}=this.wNAF(I(y,n));return C.normalizeZ([L,F])[0]}multiplyUnsafe(y){let L=B(y);return L===hi?j:this.equals(j)||L===Rn?this:this.equals(R)?this.wNAF(L).p:H.unsafeLadder(this,L)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return H.unsafeLadder(this,n).is0()}toAffine(y){const{ex:L,ey:F,ez:K}=this,V=this.is0();y==null&&(y=V?eP:t.inv(K));const W=d(L*y),Z=d(F*y),G=d(K*y);if(V)return{x:hi,y:Rn};if(G!==Rn)throw new Error("invZ was invalid");return{x:W,y:Z}}clearCofactor(){const{h:y}=e;return y===Rn?this:this.multiplyUnsafe(y)}static fromHex(y,L=!1){const{d:F,a:K}=e,V=t.BYTES,W=(y=Dr("pointHex",y,V)).slice(),Z=y[V-1];W[V-1]=-129&Z;const G=Ta(W);G===hi||I(G,L?l:t.ORDER);const ne=d(G*G),X=d(ne-Rn),te=d(F*ne-K);let{isValid:ge,value:ce}=_(X,te);if(!ge)throw new Error("Point.fromHex: invalid y coordinate");const we=(ce&Rn)===Rn,$e=(128&Z)!=0;if(!L&&ce===hi&&$e)throw new Error("Point.fromHex: x=0 and x_0=1");return $e!==we&&(ce=d(-ce)),C.fromAffine({x:ce,y:G})}static fromPrivateKey(y){return p(y).point}toRawBytes(){const{x:y,y:L}=this.toAffine(),F=Ec(L,t.BYTES);return F[F.length-1]|=y&Rn?128:0,F}toHex(){return Rs(this.toRawBytes())}}C.BASE=new C(e.Gx,e.Gy,Rn,d(e.Gx*e.Gy)),C.ZERO=new C(hi,Rn,Rn,hi);const{BASE:R,ZERO:j}=C,H=D8(C,8*a);function N(h){return br(h,n)}function c(h){return N(Ta(h))}function p(h){const y=a;h=Dr("private key",h,y);const L=Dr("hashed private key",o(h),2*y),F=E(L.slice(0,y)),K=L.slice(y,2*y),V=c(F),W=R.multiply(V),Z=W.toRawBytes();return{head:F,prefix:K,scalar:V,point:W,pointBytes:Z}}function x(h=new Uint8Array,...y){const L=Us(...y);return c(o(m(L,Dr("context",h),!!i)))}const g=tP;return R._setWindowSize(8),{CURVE:e,getPublicKey:function(h){return p(h).pointBytes},sign:function(h,y,L={}){h=Dr("message",h),i&&(h=i(h));const{prefix:F,scalar:K,pointBytes:V}=p(y),W=x(L.context,F,h),Z=R.multiply(W).toRawBytes(),G=N(W+x(L.context,Z,V,h)*K);return B(G),Dr("result",Us(Z,Ec(G,t.BYTES)),2*a)},verify:function(h,y,L,F=g){const{context:K,zip215:V}=F,W=t.BYTES;h=Dr("signature",h,2*W),y=Dr("message",y),i&&(y=i(y));const Z=Ta(h.slice(W,2*W));let G,ne,X;try{G=C.fromHex(L,V),ne=C.fromHex(h.slice(0,W),V),X=R.multiplyUnsafe(Z)}catch{return!1}if(!V&&G.isSmallOrder())return!1;const te=x(K,ne.toRawBytes(),G.toRawBytes(),y);return ne.add(G.multiplyUnsafe(te)).subtract(X).clearCofactor().equals(C.ZERO)},ExtendedPoint:C,utils:{getExtendedPublicKey:p,randomPrivateKey:()=>s(t.BYTES),precompute:(h=8,y=C.BASE)=>(y._setWindowSize(h),y.multiply(BigInt(3)),y)}}}(sP),uP=(oo.ORDER+BigInt(3))/BigInt(8);oo.pow(Cp,uP),oo.sqrt(oo.neg(oo.ONE)),oo.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,e){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const t=r.sqrt(e);r.isOdd(t)&&r.neg(t)}(oo,oo.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Tp={exports:{}},cP=mg(Object.freeze({__proto__:null,default:{}}));(function(r,e){function t(c,p){if(!c)throw new Error(p||"Assertion failed")}function n(c,p){c.super_=p;var x=function(){};x.prototype=p.prototype,c.prototype=new x,c.prototype.constructor=c}function i(c,p,x){if(i.isBN(c))return c;this.negative=0,this.words=null,this.length=0,this.red=null,c!==null&&(p!=="le"&&p!=="be"||(x=p,p=10),this._init(c||0,p||10,x||"be"))}var o;typeof Tp=="object"?Tp.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:cP.Buffer}catch{}function s(c,p){var x=c.charCodeAt(p);return x>=48&&x<=57?x-48:x>=65&&x<=70?x-55:x>=97&&x<=102?x-87:void t(!1,"Invalid character in "+c)}function a(c,p,x){var g=s(c,x);return x-1>=p&&(g|=s(c,x-1)<<4),g}function u(c,p,x,g){for(var h=0,y=0,L=Math.min(c.length,x),F=p;F=49?K-49+10:K>=17?K-17+10:K,t(K>=0&&y0?c:p},i.min=function(c,p){return c.cmp(p)<0?c:p},i.prototype._init=function(c,p,x){if(typeof c=="number")return this._initNumber(c,p,x);if(typeof c=="object")return this._initArray(c,p,x);p==="hex"&&(p=16),t(p===(0|p)&&p>=2&&p<=36);var g=0;(c=c.toString().replace(/\s+/g,""))[0]==="-"&&(g++,this.negative=1),g=0;g-=3)y=c[g]|c[g-1]<<8|c[g-2]<<16,this.words[h]|=y<>>26-L&67108863,(L+=24)>=26&&(L-=26,h++);else if(x==="le")for(g=0,h=0;g>>26-L&67108863,(L+=24)>=26&&(L-=26,h++);return this._strip()},i.prototype._parseHex=function(c,p,x){this.length=Math.ceil((c.length-p)/6),this.words=new Array(this.length);for(var g=0;g=p;g-=2)h=a(c,p,g)<=18?(y-=18,L+=1,this.words[L]|=h>>>26):y+=8;else for(g=(c.length-p)%2==0?p+1:p;g=18?(y-=18,L+=1,this.words[L]|=h>>>26):y+=8;this._strip()},i.prototype._parseBase=function(c,p,x){this.words=[0],this.length=1;for(var g=0,h=1;h<=67108863;h*=p)g++;g--,h=h/p|0;for(var y=c.length-x,L=y%g,F=Math.min(y,y-L)+x,K=0,V=x;V1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{i.prototype.inspect=d}else i.prototype.inspect=d;function d(){return(this.red?""}var _=["","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"],E=[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];function w(c,p,x){x.negative=p.negative^c.negative;var g=c.length+p.length|0;x.length=g,g=g-1|0;var h=0|c.words[0],y=0|p.words[0],L=h*y,F=67108863&L,K=L/67108864|0;x.words[0]=F;for(var V=1;V>>26,Z=67108863&K,G=Math.min(V,p.length-1),ne=Math.max(0,V-c.length+1);ne<=G;ne++){var X=V-ne|0;W+=(L=(h=0|c.words[X])*(y=0|p.words[ne])+Z)/67108864|0,Z=67108863&L}x.words[V]=0|Z,K=0|W}return K!==0?x.words[V]=0|K:x.length--,x._strip()}i.prototype.toString=function(c,p){var x;if(p=0|p||1,(c=c||10)===16||c==="hex"){x="";for(var g=0,h=0,y=0;y>>24-g&16777215,(g+=2)>=26&&(g-=26,y--),x=h!==0||y!==this.length-1?_[6-F.length]+F+x:F+x}for(h!==0&&(x=h.toString(16)+x);x.length%p!=0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(c===(0|c)&&c>=2&&c<=36){var K=E[c],V=m[c];x="";var W=this.clone();for(W.negative=0;!W.isZero();){var Z=W.modrn(V).toString(c);x=(W=W.idivn(V)).isZero()?Z+x:_[K-Z.length]+Z+x}for(this.isZero()&&(x="0"+x);x.length%p!=0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}t(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=67108864*this.words[1]:this.length===3&&this.words[2]===1?c+=4503599627370496+67108864*this.words[1]:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(c,p){return this.toArrayLike(o,c,p)}),i.prototype.toArray=function(c,p){return this.toArrayLike(Array,c,p)},i.prototype.toArrayLike=function(c,p,x){this._strip();var g=this.byteLength(),h=x||Math.max(1,g);t(g<=h,"byte array longer than desired length"),t(h>0,"Requested array length <= 0");var y=function(L,F){return L.allocUnsafe?L.allocUnsafe(F):new L(F)}(c,h);return this["_toArrayLike"+(p==="le"?"LE":"BE")](y,g),y},i.prototype._toArrayLikeLE=function(c,p){for(var x=0,g=0,h=0,y=0;h>8&255),x>16&255),y===6?(x>24&255),g=0,y=0):(g=L>>>24,y+=2)}if(x=0&&(c[x--]=L>>8&255),x>=0&&(c[x--]=L>>16&255),y===6?(x>=0&&(c[x--]=L>>24&255),g=0,y=0):(g=L>>>24,y+=2)}if(x>=0)for(c[x--]=g;x>=0;)c[x--]=0},Math.clz32?i.prototype._countBits=function(c){return 32-Math.clz32(c)}:i.prototype._countBits=function(c){var p=c,x=0;return p>=4096&&(x+=13,p>>>=13),p>=64&&(x+=7,p>>>=7),p>=8&&(x+=4,p>>>=4),p>=2&&(x+=2,p>>>=2),x+p},i.prototype._zeroBits=function(c){if(c===0)return 26;var p=c,x=0;return!(8191&p)&&(x+=13,p>>>=13),!(127&p)&&(x+=7,p>>>=7),!(15&p)&&(x+=4,p>>>=4),!(3&p)&&(x+=2,p>>>=2),!(1&p)&&x++,x},i.prototype.bitLength=function(){var c=this.words[this.length-1],p=this._countBits(c);return 26*(this.length-1)+p},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,p=0;pc.length?this.clone().ior(c):c.clone().ior(this)},i.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},i.prototype.iuand=function(c){var p;p=this.length>c.length?c:this;for(var x=0;xc.length?this.clone().iand(c):c.clone().iand(this)},i.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},i.prototype.iuxor=function(c){var p,x;this.length>c.length?(p=this,x=c):(p=c,x=this);for(var g=0;gc.length?this.clone().ixor(c):c.clone().ixor(this)},i.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},i.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var p=0|Math.ceil(c/26),x=c%26;this._expand(p),x>0&&p--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-x),this._strip()},i.prototype.notn=function(c){return this.clone().inotn(c)},i.prototype.setn=function(c,p){t(typeof c=="number"&&c>=0);var x=c/26|0,g=c%26;return this._expand(x+1),this.words[x]=p?this.words[x]|1<c.length?(x=this,g=c):(x=c,g=this);for(var h=0,y=0;y>>26;for(;h!==0&&y>>26;if(this.length=x.length,h!==0)this.words[this.length]=h,this.length++;else if(x!==this)for(;yc.length?this.clone().iadd(c):c.clone().iadd(this)},i.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var p=this.iadd(c);return c.negative=1,p._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var x,g,h=this.cmp(c);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(x=this,g=c):(x=c,g=this);for(var y=0,L=0;L>26,this.words[L]=67108863&p;for(;y!==0&&L>26,this.words[L]=67108863&p;if(y===0&&L>>13,ne=0|L[1],X=8191&ne,te=ne>>>13,ge=0|L[2],ce=8191&ge,we=ge>>>13,$e=0|L[3],be=8191&$e,me=$e>>>13,se=0|L[4],ie=8191&se,oe=se>>>13,Fe=0|L[5],f=8191&Fe,b=Fe>>>13,k=0|L[6],T=8191&k,U=k>>>13,$=0|L[7],Y=8191&$,de=$>>>13,Ke=0|L[8],Oe=8191&Ke,xe=Ke>>>13,nt=0|L[9],pt=8191&nt,gt=nt>>>13,ko=0|F[0],lt=8191&ko,Pt=ko>>>13,z=0|F[1],D=8191&z,q=z>>>13,M=0|F[2],O=8191&M,Q=M>>>13,re=0|F[3],ue=8191&re,J=re>>>13,De=0|F[4],Pe=8191&De,Ee=De>>>13,st=0|F[5],Le=8191&st,ke=st>>>13,ut=0|F[6],Ne=8191&ut,Ue=ut>>>13,ht=0|F[7],Re=8191&ht,Se=ht>>>13,ct=0|F[8],qe=8191&ct,Me=ct>>>13,_e=0|F[9],pe=8191&_e,ve=_e>>>13;x.negative=c.negative^p.negative,x.length=19;var Ce=(V+(g=Math.imul(Z,lt))|0)+((8191&(h=(h=Math.imul(Z,Pt))+Math.imul(G,lt)|0))<<13)|0;V=((y=Math.imul(G,Pt))+(h>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,g=Math.imul(X,lt),h=(h=Math.imul(X,Pt))+Math.imul(te,lt)|0,y=Math.imul(te,Pt);var Te=(V+(g=g+Math.imul(Z,D)|0)|0)+((8191&(h=(h=h+Math.imul(Z,q)|0)+Math.imul(G,D)|0))<<13)|0;V=((y=y+Math.imul(G,q)|0)+(h>>>13)|0)+(Te>>>26)|0,Te&=67108863,g=Math.imul(ce,lt),h=(h=Math.imul(ce,Pt))+Math.imul(we,lt)|0,y=Math.imul(we,Pt),g=g+Math.imul(X,D)|0,h=(h=h+Math.imul(X,q)|0)+Math.imul(te,D)|0,y=y+Math.imul(te,q)|0;var ze=(V+(g=g+Math.imul(Z,O)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Q)|0)+Math.imul(G,O)|0))<<13)|0;V=((y=y+Math.imul(G,Q)|0)+(h>>>13)|0)+(ze>>>26)|0,ze&=67108863,g=Math.imul(be,lt),h=(h=Math.imul(be,Pt))+Math.imul(me,lt)|0,y=Math.imul(me,Pt),g=g+Math.imul(ce,D)|0,h=(h=h+Math.imul(ce,q)|0)+Math.imul(we,D)|0,y=y+Math.imul(we,q)|0,g=g+Math.imul(X,O)|0,h=(h=h+Math.imul(X,Q)|0)+Math.imul(te,O)|0,y=y+Math.imul(te,Q)|0;var kt=(V+(g=g+Math.imul(Z,ue)|0)|0)+((8191&(h=(h=h+Math.imul(Z,J)|0)+Math.imul(G,ue)|0))<<13)|0;V=((y=y+Math.imul(G,J)|0)+(h>>>13)|0)+(kt>>>26)|0,kt&=67108863,g=Math.imul(ie,lt),h=(h=Math.imul(ie,Pt))+Math.imul(oe,lt)|0,y=Math.imul(oe,Pt),g=g+Math.imul(be,D)|0,h=(h=h+Math.imul(be,q)|0)+Math.imul(me,D)|0,y=y+Math.imul(me,q)|0,g=g+Math.imul(ce,O)|0,h=(h=h+Math.imul(ce,Q)|0)+Math.imul(we,O)|0,y=y+Math.imul(we,Q)|0,g=g+Math.imul(X,ue)|0,h=(h=h+Math.imul(X,J)|0)+Math.imul(te,ue)|0,y=y+Math.imul(te,J)|0;var St=(V+(g=g+Math.imul(Z,Pe)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Ee)|0)+Math.imul(G,Pe)|0))<<13)|0;V=((y=y+Math.imul(G,Ee)|0)+(h>>>13)|0)+(St>>>26)|0,St&=67108863,g=Math.imul(f,lt),h=(h=Math.imul(f,Pt))+Math.imul(b,lt)|0,y=Math.imul(b,Pt),g=g+Math.imul(ie,D)|0,h=(h=h+Math.imul(ie,q)|0)+Math.imul(oe,D)|0,y=y+Math.imul(oe,q)|0,g=g+Math.imul(be,O)|0,h=(h=h+Math.imul(be,Q)|0)+Math.imul(me,O)|0,y=y+Math.imul(me,Q)|0,g=g+Math.imul(ce,ue)|0,h=(h=h+Math.imul(ce,J)|0)+Math.imul(we,ue)|0,y=y+Math.imul(we,J)|0,g=g+Math.imul(X,Pe)|0,h=(h=h+Math.imul(X,Ee)|0)+Math.imul(te,Pe)|0,y=y+Math.imul(te,Ee)|0;var Et=(V+(g=g+Math.imul(Z,Le)|0)|0)+((8191&(h=(h=h+Math.imul(Z,ke)|0)+Math.imul(G,Le)|0))<<13)|0;V=((y=y+Math.imul(G,ke)|0)+(h>>>13)|0)+(Et>>>26)|0,Et&=67108863,g=Math.imul(T,lt),h=(h=Math.imul(T,Pt))+Math.imul(U,lt)|0,y=Math.imul(U,Pt),g=g+Math.imul(f,D)|0,h=(h=h+Math.imul(f,q)|0)+Math.imul(b,D)|0,y=y+Math.imul(b,q)|0,g=g+Math.imul(ie,O)|0,h=(h=h+Math.imul(ie,Q)|0)+Math.imul(oe,O)|0,y=y+Math.imul(oe,Q)|0,g=g+Math.imul(be,ue)|0,h=(h=h+Math.imul(be,J)|0)+Math.imul(me,ue)|0,y=y+Math.imul(me,J)|0,g=g+Math.imul(ce,Pe)|0,h=(h=h+Math.imul(ce,Ee)|0)+Math.imul(we,Pe)|0,y=y+Math.imul(we,Ee)|0,g=g+Math.imul(X,Le)|0,h=(h=h+Math.imul(X,ke)|0)+Math.imul(te,Le)|0,y=y+Math.imul(te,ke)|0;var Ct=(V+(g=g+Math.imul(Z,Ne)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Ue)|0)+Math.imul(G,Ne)|0))<<13)|0;V=((y=y+Math.imul(G,Ue)|0)+(h>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,g=Math.imul(Y,lt),h=(h=Math.imul(Y,Pt))+Math.imul(de,lt)|0,y=Math.imul(de,Pt),g=g+Math.imul(T,D)|0,h=(h=h+Math.imul(T,q)|0)+Math.imul(U,D)|0,y=y+Math.imul(U,q)|0,g=g+Math.imul(f,O)|0,h=(h=h+Math.imul(f,Q)|0)+Math.imul(b,O)|0,y=y+Math.imul(b,Q)|0,g=g+Math.imul(ie,ue)|0,h=(h=h+Math.imul(ie,J)|0)+Math.imul(oe,ue)|0,y=y+Math.imul(oe,J)|0,g=g+Math.imul(be,Pe)|0,h=(h=h+Math.imul(be,Ee)|0)+Math.imul(me,Pe)|0,y=y+Math.imul(me,Ee)|0,g=g+Math.imul(ce,Le)|0,h=(h=h+Math.imul(ce,ke)|0)+Math.imul(we,Le)|0,y=y+Math.imul(we,ke)|0,g=g+Math.imul(X,Ne)|0,h=(h=h+Math.imul(X,Ue)|0)+Math.imul(te,Ne)|0,y=y+Math.imul(te,Ue)|0;var Dt=(V+(g=g+Math.imul(Z,Re)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Se)|0)+Math.imul(G,Re)|0))<<13)|0;V=((y=y+Math.imul(G,Se)|0)+(h>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(Oe,lt),h=(h=Math.imul(Oe,Pt))+Math.imul(xe,lt)|0,y=Math.imul(xe,Pt),g=g+Math.imul(Y,D)|0,h=(h=h+Math.imul(Y,q)|0)+Math.imul(de,D)|0,y=y+Math.imul(de,q)|0,g=g+Math.imul(T,O)|0,h=(h=h+Math.imul(T,Q)|0)+Math.imul(U,O)|0,y=y+Math.imul(U,Q)|0,g=g+Math.imul(f,ue)|0,h=(h=h+Math.imul(f,J)|0)+Math.imul(b,ue)|0,y=y+Math.imul(b,J)|0,g=g+Math.imul(ie,Pe)|0,h=(h=h+Math.imul(ie,Ee)|0)+Math.imul(oe,Pe)|0,y=y+Math.imul(oe,Ee)|0,g=g+Math.imul(be,Le)|0,h=(h=h+Math.imul(be,ke)|0)+Math.imul(me,Le)|0,y=y+Math.imul(me,ke)|0,g=g+Math.imul(ce,Ne)|0,h=(h=h+Math.imul(ce,Ue)|0)+Math.imul(we,Ne)|0,y=y+Math.imul(we,Ue)|0,g=g+Math.imul(X,Re)|0,h=(h=h+Math.imul(X,Se)|0)+Math.imul(te,Re)|0,y=y+Math.imul(te,Se)|0;var zt=(V+(g=g+Math.imul(Z,qe)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Me)|0)+Math.imul(G,qe)|0))<<13)|0;V=((y=y+Math.imul(G,Me)|0)+(h>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(pt,lt),h=(h=Math.imul(pt,Pt))+Math.imul(gt,lt)|0,y=Math.imul(gt,Pt),g=g+Math.imul(Oe,D)|0,h=(h=h+Math.imul(Oe,q)|0)+Math.imul(xe,D)|0,y=y+Math.imul(xe,q)|0,g=g+Math.imul(Y,O)|0,h=(h=h+Math.imul(Y,Q)|0)+Math.imul(de,O)|0,y=y+Math.imul(de,Q)|0,g=g+Math.imul(T,ue)|0,h=(h=h+Math.imul(T,J)|0)+Math.imul(U,ue)|0,y=y+Math.imul(U,J)|0,g=g+Math.imul(f,Pe)|0,h=(h=h+Math.imul(f,Ee)|0)+Math.imul(b,Pe)|0,y=y+Math.imul(b,Ee)|0,g=g+Math.imul(ie,Le)|0,h=(h=h+Math.imul(ie,ke)|0)+Math.imul(oe,Le)|0,y=y+Math.imul(oe,ke)|0,g=g+Math.imul(be,Ne)|0,h=(h=h+Math.imul(be,Ue)|0)+Math.imul(me,Ne)|0,y=y+Math.imul(me,Ue)|0,g=g+Math.imul(ce,Re)|0,h=(h=h+Math.imul(ce,Se)|0)+Math.imul(we,Re)|0,y=y+Math.imul(we,Se)|0,g=g+Math.imul(X,qe)|0,h=(h=h+Math.imul(X,Me)|0)+Math.imul(te,qe)|0,y=y+Math.imul(te,Me)|0;var at=(V+(g=g+Math.imul(Z,pe)|0)|0)+((8191&(h=(h=h+Math.imul(Z,ve)|0)+Math.imul(G,pe)|0))<<13)|0;V=((y=y+Math.imul(G,ve)|0)+(h>>>13)|0)+(at>>>26)|0,at&=67108863,g=Math.imul(pt,D),h=(h=Math.imul(pt,q))+Math.imul(gt,D)|0,y=Math.imul(gt,q),g=g+Math.imul(Oe,O)|0,h=(h=h+Math.imul(Oe,Q)|0)+Math.imul(xe,O)|0,y=y+Math.imul(xe,Q)|0,g=g+Math.imul(Y,ue)|0,h=(h=h+Math.imul(Y,J)|0)+Math.imul(de,ue)|0,y=y+Math.imul(de,J)|0,g=g+Math.imul(T,Pe)|0,h=(h=h+Math.imul(T,Ee)|0)+Math.imul(U,Pe)|0,y=y+Math.imul(U,Ee)|0,g=g+Math.imul(f,Le)|0,h=(h=h+Math.imul(f,ke)|0)+Math.imul(b,Le)|0,y=y+Math.imul(b,ke)|0,g=g+Math.imul(ie,Ne)|0,h=(h=h+Math.imul(ie,Ue)|0)+Math.imul(oe,Ne)|0,y=y+Math.imul(oe,Ue)|0,g=g+Math.imul(be,Re)|0,h=(h=h+Math.imul(be,Se)|0)+Math.imul(me,Re)|0,y=y+Math.imul(me,Se)|0,g=g+Math.imul(ce,qe)|0,h=(h=h+Math.imul(ce,Me)|0)+Math.imul(we,qe)|0,y=y+Math.imul(we,Me)|0;var yt=(V+(g=g+Math.imul(X,pe)|0)|0)+((8191&(h=(h=h+Math.imul(X,ve)|0)+Math.imul(te,pe)|0))<<13)|0;V=((y=y+Math.imul(te,ve)|0)+(h>>>13)|0)+(yt>>>26)|0,yt&=67108863,g=Math.imul(pt,O),h=(h=Math.imul(pt,Q))+Math.imul(gt,O)|0,y=Math.imul(gt,Q),g=g+Math.imul(Oe,ue)|0,h=(h=h+Math.imul(Oe,J)|0)+Math.imul(xe,ue)|0,y=y+Math.imul(xe,J)|0,g=g+Math.imul(Y,Pe)|0,h=(h=h+Math.imul(Y,Ee)|0)+Math.imul(de,Pe)|0,y=y+Math.imul(de,Ee)|0,g=g+Math.imul(T,Le)|0,h=(h=h+Math.imul(T,ke)|0)+Math.imul(U,Le)|0,y=y+Math.imul(U,ke)|0,g=g+Math.imul(f,Ne)|0,h=(h=h+Math.imul(f,Ue)|0)+Math.imul(b,Ne)|0,y=y+Math.imul(b,Ue)|0,g=g+Math.imul(ie,Re)|0,h=(h=h+Math.imul(ie,Se)|0)+Math.imul(oe,Re)|0,y=y+Math.imul(oe,Se)|0,g=g+Math.imul(be,qe)|0,h=(h=h+Math.imul(be,Me)|0)+Math.imul(me,qe)|0,y=y+Math.imul(me,Me)|0;var mt=(V+(g=g+Math.imul(ce,pe)|0)|0)+((8191&(h=(h=h+Math.imul(ce,ve)|0)+Math.imul(we,pe)|0))<<13)|0;V=((y=y+Math.imul(we,ve)|0)+(h>>>13)|0)+(mt>>>26)|0,mt&=67108863,g=Math.imul(pt,ue),h=(h=Math.imul(pt,J))+Math.imul(gt,ue)|0,y=Math.imul(gt,J),g=g+Math.imul(Oe,Pe)|0,h=(h=h+Math.imul(Oe,Ee)|0)+Math.imul(xe,Pe)|0,y=y+Math.imul(xe,Ee)|0,g=g+Math.imul(Y,Le)|0,h=(h=h+Math.imul(Y,ke)|0)+Math.imul(de,Le)|0,y=y+Math.imul(de,ke)|0,g=g+Math.imul(T,Ne)|0,h=(h=h+Math.imul(T,Ue)|0)+Math.imul(U,Ne)|0,y=y+Math.imul(U,Ue)|0,g=g+Math.imul(f,Re)|0,h=(h=h+Math.imul(f,Se)|0)+Math.imul(b,Re)|0,y=y+Math.imul(b,Se)|0,g=g+Math.imul(ie,qe)|0,h=(h=h+Math.imul(ie,Me)|0)+Math.imul(oe,qe)|0,y=y+Math.imul(oe,Me)|0;var _t=(V+(g=g+Math.imul(be,pe)|0)|0)+((8191&(h=(h=h+Math.imul(be,ve)|0)+Math.imul(me,pe)|0))<<13)|0;V=((y=y+Math.imul(me,ve)|0)+(h>>>13)|0)+(_t>>>26)|0,_t&=67108863,g=Math.imul(pt,Pe),h=(h=Math.imul(pt,Ee))+Math.imul(gt,Pe)|0,y=Math.imul(gt,Ee),g=g+Math.imul(Oe,Le)|0,h=(h=h+Math.imul(Oe,ke)|0)+Math.imul(xe,Le)|0,y=y+Math.imul(xe,ke)|0,g=g+Math.imul(Y,Ne)|0,h=(h=h+Math.imul(Y,Ue)|0)+Math.imul(de,Ne)|0,y=y+Math.imul(de,Ue)|0,g=g+Math.imul(T,Re)|0,h=(h=h+Math.imul(T,Se)|0)+Math.imul(U,Re)|0,y=y+Math.imul(U,Se)|0,g=g+Math.imul(f,qe)|0,h=(h=h+Math.imul(f,Me)|0)+Math.imul(b,qe)|0,y=y+Math.imul(b,Me)|0;var it=(V+(g=g+Math.imul(ie,pe)|0)|0)+((8191&(h=(h=h+Math.imul(ie,ve)|0)+Math.imul(oe,pe)|0))<<13)|0;V=((y=y+Math.imul(oe,ve)|0)+(h>>>13)|0)+(it>>>26)|0,it&=67108863,g=Math.imul(pt,Le),h=(h=Math.imul(pt,ke))+Math.imul(gt,Le)|0,y=Math.imul(gt,ke),g=g+Math.imul(Oe,Ne)|0,h=(h=h+Math.imul(Oe,Ue)|0)+Math.imul(xe,Ne)|0,y=y+Math.imul(xe,Ue)|0,g=g+Math.imul(Y,Re)|0,h=(h=h+Math.imul(Y,Se)|0)+Math.imul(de,Re)|0,y=y+Math.imul(de,Se)|0,g=g+Math.imul(T,qe)|0,h=(h=h+Math.imul(T,Me)|0)+Math.imul(U,qe)|0,y=y+Math.imul(U,Me)|0;var It=(V+(g=g+Math.imul(f,pe)|0)|0)+((8191&(h=(h=h+Math.imul(f,ve)|0)+Math.imul(b,pe)|0))<<13)|0;V=((y=y+Math.imul(b,ve)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863,g=Math.imul(pt,Ne),h=(h=Math.imul(pt,Ue))+Math.imul(gt,Ne)|0,y=Math.imul(gt,Ue),g=g+Math.imul(Oe,Re)|0,h=(h=h+Math.imul(Oe,Se)|0)+Math.imul(xe,Re)|0,y=y+Math.imul(xe,Se)|0,g=g+Math.imul(Y,qe)|0,h=(h=h+Math.imul(Y,Me)|0)+Math.imul(de,qe)|0,y=y+Math.imul(de,Me)|0;var Lt=(V+(g=g+Math.imul(T,pe)|0)|0)+((8191&(h=(h=h+Math.imul(T,ve)|0)+Math.imul(U,pe)|0))<<13)|0;V=((y=y+Math.imul(U,ve)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,g=Math.imul(pt,Re),h=(h=Math.imul(pt,Se))+Math.imul(gt,Re)|0,y=Math.imul(gt,Se),g=g+Math.imul(Oe,qe)|0,h=(h=h+Math.imul(Oe,Me)|0)+Math.imul(xe,qe)|0,y=y+Math.imul(xe,Me)|0;var or=(V+(g=g+Math.imul(Y,pe)|0)|0)+((8191&(h=(h=h+Math.imul(Y,ve)|0)+Math.imul(de,pe)|0))<<13)|0;V=((y=y+Math.imul(de,ve)|0)+(h>>>13)|0)+(or>>>26)|0,or&=67108863,g=Math.imul(pt,qe),h=(h=Math.imul(pt,Me))+Math.imul(gt,qe)|0,y=Math.imul(gt,Me);var Ft=(V+(g=g+Math.imul(Oe,pe)|0)|0)+((8191&(h=(h=h+Math.imul(Oe,ve)|0)+Math.imul(xe,pe)|0))<<13)|0;V=((y=y+Math.imul(xe,ve)|0)+(h>>>13)|0)+(Ft>>>26)|0,Ft&=67108863;var nr=(V+(g=Math.imul(pt,pe))|0)+((8191&(h=(h=Math.imul(pt,ve))+Math.imul(gt,pe)|0))<<13)|0;return V=((y=Math.imul(gt,ve))+(h>>>13)|0)+(nr>>>26)|0,nr&=67108863,K[0]=Ce,K[1]=Te,K[2]=ze,K[3]=kt,K[4]=St,K[5]=Et,K[6]=Ct,K[7]=Dt,K[8]=zt,K[9]=at,K[10]=yt,K[11]=mt,K[12]=_t,K[13]=it,K[14]=It,K[15]=Lt,K[16]=or,K[17]=Ft,K[18]=nr,V!==0&&(K[19]=V,x.length++),x};function A(c,p,x){x.negative=p.negative^c.negative,x.length=c.length+p.length;for(var g=0,h=0,y=0;y>>26)|0)>>>26,L&=67108863}x.words[y]=F,g=L,L=h}return g!==0?x.words[y]=g:x.length--,x._strip()}function I(c,p,x){return A(c,p,x)}Math.imul||(v=w),i.prototype.mulTo=function(c,p){var x=this.length+c.length;return this.length===10&&c.length===10?v(this,c,p):x<63?w(this,c,p):x<1024?A(this,c,p):I(this,c,p)},i.prototype.mul=function(c){var p=new i(null);return p.words=new Array(this.length+c.length),this.mulTo(c,p)},i.prototype.mulf=function(c){var p=new i(null);return p.words=new Array(this.length+c.length),I(this,c,p)},i.prototype.imul=function(c){return this.clone().mulTo(c,this)},i.prototype.imuln=function(c){var p=c<0;p&&(c=-c),t(typeof c=="number"),t(c<67108864);for(var x=0,g=0;g>=26,x+=h/67108864|0,x+=y>>>26,this.words[g]=67108863&y}return x!==0&&(this.words[g]=x,this.length++),p?this.ineg():this},i.prototype.muln=function(c){return this.clone().imuln(c)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(c){var p=function(y){for(var L=new Array(y.bitLength()),F=0;F>>V&1}return L}(c);if(p.length===0)return new i(1);for(var x=this,g=0;g=0);var p,x=c%26,g=(c-x)/26,h=67108863>>>26-x<<26-x;if(x!==0){var y=0;for(p=0;p>>26-x}y&&(this.words[p]=y,this.length++)}if(g!==0){for(p=this.length-1;p>=0;p--)this.words[p+g]=this.words[p];for(p=0;p=0),g=p?(p-p%26)/26:0;var h=c%26,y=Math.min((c-h)/26,this.length),L=67108863^67108863>>>h<y)for(this.length-=y,K=0;K=0&&(V!==0||K>=g);K--){var W=0|this.words[K];this.words[K]=V<<26-h|W>>>h,V=W&L}return F&&V!==0&&(F.words[F.length++]=V),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(c,p,x){return t(this.negative===0),this.iushrn(c,p,x)},i.prototype.shln=function(c){return this.clone().ishln(c)},i.prototype.ushln=function(c){return this.clone().iushln(c)},i.prototype.shrn=function(c){return this.clone().ishrn(c)},i.prototype.ushrn=function(c){return this.clone().iushrn(c)},i.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var p=c%26,x=(c-p)/26,g=1<=0);var p=c%26,x=(c-p)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(p!==0&&x++,this.length=Math.min(x,this.length),p!==0){var g=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},i.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p>26)-(F/67108864|0),this.words[g+x]=67108863&h}for(;g>26,this.words[g+x]=67108863&h;if(L===0)return this._strip();for(t(L===-1),L=0,g=0;g>26,this.words[g]=67108863&h;return this.negative=1,this._strip()},i.prototype._wordDiv=function(c,p){var x=(this.length,c.length),g=this.clone(),h=c,y=0|h.words[h.length-1];(x=26-this._countBits(y))!=0&&(h=h.ushln(x),g.iushln(x),y=0|h.words[h.length-1]);var L,F=g.length-h.length;if(p!=="mod"){(L=new i(null)).length=F+1,L.words=new Array(L.length);for(var K=0;K=0;W--){var Z=67108864*(0|g.words[h.length+W])+(0|g.words[h.length+W-1]);for(Z=Math.min(Z/y|0,67108863),g._ishlnsubmul(h,Z,W);g.negative!==0;)Z--,g.negative=0,g._ishlnsubmul(h,1,W),g.isZero()||(g.negative^=1);L&&(L.words[W]=Z)}return L&&L._strip(),g._strip(),p!=="div"&&x!==0&&g.iushrn(x),{div:L||null,mod:g}},i.prototype.divmod=function(c,p,x){return t(!c.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&c.negative===0?(y=this.neg().divmod(c,p),p!=="mod"&&(g=y.div.neg()),p!=="div"&&(h=y.mod.neg(),x&&h.negative!==0&&h.iadd(c)),{div:g,mod:h}):this.negative===0&&c.negative!==0?(y=this.divmod(c.neg(),p),p!=="mod"&&(g=y.div.neg()),{div:g,mod:y.mod}):this.negative&c.negative?(y=this.neg().divmod(c.neg(),p),p!=="div"&&(h=y.mod.neg(),x&&h.negative!==0&&h.isub(c)),{div:y.div,mod:h}):c.length>this.length||this.cmp(c)<0?{div:new i(0),mod:this}:c.length===1?p==="div"?{div:this.divn(c.words[0]),mod:null}:p==="mod"?{div:null,mod:new i(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new i(this.modrn(c.words[0]))}:this._wordDiv(c,p);var g,h,y},i.prototype.div=function(c){return this.divmod(c,"div",!1).div},i.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},i.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},i.prototype.divRound=function(c){var p=this.divmod(c);if(p.mod.isZero())return p.div;var x=p.div.negative!==0?p.mod.isub(c):p.mod,g=c.ushrn(1),h=c.andln(1),y=x.cmp(g);return y<0||h===1&&y===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},i.prototype.modrn=function(c){var p=c<0;p&&(c=-c),t(c<=67108863);for(var x=(1<<26)%c,g=0,h=this.length-1;h>=0;h--)g=(x*g+(0|this.words[h]))%c;return p?-g:g},i.prototype.modn=function(c){return this.modrn(c)},i.prototype.idivn=function(c){var p=c<0;p&&(c=-c),t(c<=67108863);for(var x=0,g=this.length-1;g>=0;g--){var h=(0|this.words[g])+67108864*x;this.words[g]=h/c|0,x=h%c}return this._strip(),p?this.ineg():this},i.prototype.divn=function(c){return this.clone().idivn(c)},i.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var p=this,x=c.clone();p=p.negative!==0?p.umod(c):p.clone();for(var g=new i(1),h=new i(0),y=new i(0),L=new i(1),F=0;p.isEven()&&x.isEven();)p.iushrn(1),x.iushrn(1),++F;for(var K=x.clone(),V=p.clone();!p.isZero();){for(var W=0,Z=1;!(p.words[0]&Z)&&W<26;++W,Z<<=1);if(W>0)for(p.iushrn(W);W-- >0;)(g.isOdd()||h.isOdd())&&(g.iadd(K),h.isub(V)),g.iushrn(1),h.iushrn(1);for(var G=0,ne=1;!(x.words[0]&ne)&&G<26;++G,ne<<=1);if(G>0)for(x.iushrn(G);G-- >0;)(y.isOdd()||L.isOdd())&&(y.iadd(K),L.isub(V)),y.iushrn(1),L.iushrn(1);p.cmp(x)>=0?(p.isub(x),g.isub(y),h.isub(L)):(x.isub(p),y.isub(g),L.isub(h))}return{a:y,b:L,gcd:x.iushln(F)}},i.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var p=this,x=c.clone();p=p.negative!==0?p.umod(c):p.clone();for(var g,h=new i(1),y=new i(0),L=x.clone();p.cmpn(1)>0&&x.cmpn(1)>0;){for(var F=0,K=1;!(p.words[0]&K)&&F<26;++F,K<<=1);if(F>0)for(p.iushrn(F);F-- >0;)h.isOdd()&&h.iadd(L),h.iushrn(1);for(var V=0,W=1;!(x.words[0]&W)&&V<26;++V,W<<=1);if(V>0)for(x.iushrn(V);V-- >0;)y.isOdd()&&y.iadd(L),y.iushrn(1);p.cmp(x)>=0?(p.isub(x),h.isub(y)):(x.isub(p),y.isub(h))}return(g=p.cmpn(1)===0?h:y).cmpn(0)<0&&g.iadd(c),g},i.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var p=this.clone(),x=c.clone();p.negative=0,x.negative=0;for(var g=0;p.isEven()&&x.isEven();g++)p.iushrn(1),x.iushrn(1);for(;;){for(;p.isEven();)p.iushrn(1);for(;x.isEven();)x.iushrn(1);var h=p.cmp(x);if(h<0){var y=p;p=x,x=y}else if(h===0||x.cmpn(1)===0)break;p.isub(x)}return x.iushln(g)},i.prototype.invm=function(c){return this.egcd(c).a.umod(c)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(c){return this.words[0]&c},i.prototype.bincn=function(c){t(typeof c=="number");var p=c%26,x=(c-p)/26,g=1<>>26,L&=67108863,this.words[y]=L}return h!==0&&(this.words[y]=h,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(c){var p,x=c<0;if(this.negative!==0&&!x)return-1;if(this.negative===0&&x)return 1;if(this._strip(),this.length>1)p=1;else{x&&(c=-c),t(c<=67108863,"Number is too big");var g=0|this.words[0];p=g===c?0:gc.length)return 1;if(this.length=0;x--){var g=0|this.words[x],h=0|c.words[x];if(g!==h){gh&&(p=1);break}}return p},i.prototype.gtn=function(c){return this.cmpn(c)===1},i.prototype.gt=function(c){return this.cmp(c)===1},i.prototype.gten=function(c){return this.cmpn(c)>=0},i.prototype.gte=function(c){return this.cmp(c)>=0},i.prototype.ltn=function(c){return this.cmpn(c)===-1},i.prototype.lt=function(c){return this.cmp(c)===-1},i.prototype.lten=function(c){return this.cmpn(c)<=0},i.prototype.lte=function(c){return this.cmp(c)<=0},i.prototype.eqn=function(c){return this.cmpn(c)===0},i.prototype.eq=function(c){return this.cmp(c)===0},i.red=function(c){return new H(c)},i.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},i.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(c){return this.red=c,this},i.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},i.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},i.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},i.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},i.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},i.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},i.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},i.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},i.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var B={k256:null,p224:null,p192:null,p25519:null};function S(c,p){this.name=c,this.p=new i(p,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function P(){S.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function C(){S.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function R(){S.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function j(){S.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function H(c){if(typeof c=="string"){var p=i._prime(c);this.m=p.p,this.prime=p}else t(c.gtn(1),"modulus must be greater than 1"),this.m=c,this.prime=null}function N(c){H.call(this,c),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}S.prototype._tmp=function(){var c=new i(null);return c.words=new Array(Math.ceil(this.n/13)),c},S.prototype.ireduce=function(c){var p,x=c;do this.split(x,this.tmp),p=(x=(x=this.imulK(x)).iadd(this.tmp)).bitLength();while(p>this.n);var g=p0?x.isub(this.p):x.strip!==void 0?x.strip():x._strip(),x},S.prototype.split=function(c,p){c.iushrn(this.n,0,p)},S.prototype.imulK=function(c){return c.imul(this.k)},n(P,S),P.prototype.split=function(c,p){for(var x=4194303,g=Math.min(c.length,9),h=0;h>>22,y=L}y>>>=22,c.words[h-10]=y,y===0&&c.length>10?c.length-=10:c.length-=9},P.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var p=0,x=0;x>>=26,c.words[x]=h,p=g}return p!==0&&(c.words[c.length++]=p),c},i._prime=function(c){if(B[c])return B[c];var p;if(c==="k256")p=new P;else if(c==="p224")p=new C;else if(c==="p192")p=new R;else{if(c!=="p25519")throw new Error("Unknown prime "+c);p=new j}return B[c]=p,p},H.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},H.prototype._verify2=function(c,p){t((c.negative|p.negative)==0,"red works only with positives"),t(c.red&&c.red===p.red,"red works only with red numbers")},H.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(l(c,c.umod(this.m)._forceRed(this)),c)},H.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},H.prototype.add=function(c,p){this._verify2(c,p);var x=c.add(p);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},H.prototype.iadd=function(c,p){this._verify2(c,p);var x=c.iadd(p);return x.cmp(this.m)>=0&&x.isub(this.m),x},H.prototype.sub=function(c,p){this._verify2(c,p);var x=c.sub(p);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},H.prototype.isub=function(c,p){this._verify2(c,p);var x=c.isub(p);return x.cmpn(0)<0&&x.iadd(this.m),x},H.prototype.shl=function(c,p){return this._verify1(c),this.imod(c.ushln(p))},H.prototype.imul=function(c,p){return this._verify2(c,p),this.imod(c.imul(p))},H.prototype.mul=function(c,p){return this._verify2(c,p),this.imod(c.mul(p))},H.prototype.isqr=function(c){return this.imul(c,c.clone())},H.prototype.sqr=function(c){return this.mul(c,c)},H.prototype.sqrt=function(c){if(c.isZero())return c.clone();var p=this.m.andln(3);if(t(p%2==1),p===3){var x=this.m.add(new i(1)).iushrn(2);return this.pow(c,x)}for(var g=this.m.subn(1),h=0;!g.isZero()&&g.andln(1)===0;)h++,g.iushrn(1);t(!g.isZero());var y=new i(1).toRed(this),L=y.redNeg(),F=this.m.subn(1).iushrn(1),K=this.m.bitLength();for(K=new i(2*K*K).toRed(this);this.pow(K,F).cmp(L)!==0;)K.redIAdd(L);for(var V=this.pow(K,g),W=this.pow(c,g.addn(1).iushrn(1)),Z=this.pow(c,g),G=h;Z.cmp(y)!==0;){for(var ne=Z,X=0;ne.cmp(y)!==0;X++)ne=ne.redSqr();t(X=0;g--){for(var K=p.words[g],V=F-1;V>=0;V--){var W=K>>V&1;h!==x[0]&&(h=this.sqr(h)),W!==0||y!==0?(y<<=1,y|=W,(++L==4||g===0&&V===0)&&(h=this.mul(h,x[y]),L=0,y=0)):L=0}F=26}return h},H.prototype.convertTo=function(c){var p=c.umod(this.m);return p===c?p.clone():p},H.prototype.convertFrom=function(c){var p=c.clone();return p.red=null,p},i.mont=function(c){return new N(c)},n(N,H),N.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},N.prototype.convertFrom=function(c){var p=this.imod(c.mul(this.rinv));return p.red=null,p},N.prototype.imul=function(c,p){if(c.isZero()||p.isZero())return c.words[0]=0,c.length=1,c;var x=c.imul(p),g=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=x.isub(g).iushrn(this.shift),y=h;return h.cmp(this.m)>=0?y=h.isub(this.m):h.cmpn(0)<0&&(y=h.iadd(this.m)),y._forceRed(this)},N.prototype.mul=function(c,p){if(c.isZero()||p.isZero())return new i(0)._forceRed(this);var x=c.mul(p),g=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=x.isub(g).iushrn(this.shift),y=h;return h.cmp(this.m)>=0?y=h.isub(this.m):h.cmpn(0)<0&&(y=h.iadd(this.m)),y._forceRed(this)},N.prototype.invm=function(c){return this.imod(c._invmp(this.m).mul(this.r2))._forceRed(this)}})(0,bi);var z8=Tp.exports,V2=I8(z8),Op={exports:{}};(function(r,e){var t=_r,n=t.Buffer;function i(s,a){for(var u in s)a[u]=s[u]}function o(s,a,u){return n(s,a,u)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(s,a,u){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,a,u)},o.alloc=function(s,a,u){if(typeof s!="number")throw new TypeError("Argument must be a number");var l=n(s);return a!==void 0?typeof u=="string"?l.fill(a,u):l.fill(a):l.fill(0),l},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(s)}})(Op,Op.exports);var Tl=Op.exports.Buffer,j8=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t>>0,A=new Uint8Array(v);_[E];){var I=e[_.charCodeAt(E)];if(I===255)return;for(var B=0,S=v-1;(I!==0||B>>0,A[S]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");w=B,E++}for(var P=v-w;P!==v&&A[P]===0;)P++;var C=Tl.allocUnsafe(m+(v-P));C.fill(0,0,m);for(var R=m;P!==v;)C[R++]=A[P++];return C}return{encode:function(_){if((Array.isArray(_)||_ instanceof Uint8Array)&&(_=Tl.from(_)),!Tl.isBuffer(_))throw new TypeError("Expected Buffer");if(_.length===0)return"";for(var E=0,m=0,w=0,v=_.length;w!==v&&_[w]===0;)w++,E++;for(var A=(v-w)*l+1>>>0,I=new Uint8Array(A);w!==v;){for(var B=_[w],S=0,P=A-1;(B!==0||S>>0,I[P]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");m=S,w++}for(var C=A-m;C!==A&&I[C]===0;)C++;for(var R=a.repeat(E);Cr&e^r&t^e&t,hP=new Uint32Array([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]),To=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oo=new Uint32Array(64);class fP extends T8{constructor(){super(64,32,8,!1),this.A=0|To[0],this.B=0|To[1],this.C=0|To[2],this.D=0|To[3],this.E=0|To[4],this.F=0|To[5],this.G=0|To[6],this.H=0|To[7]}get(){const{A:e,B:t,C:n,D:i,E:o,F:s,G:a,H:u}=this;return[e,t,n,i,o,s,a,u]}set(e,t,n,i,o,s,a,u){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|i,this.E=0|o,this.F=0|s,this.G=0|a,this.H=0|u}process(e,t){for(let E=0;E<16;E++,t+=4)Oo[E]=e.getUint32(t,!1);for(let E=16;E<64;E++){const m=Oo[E-15],w=Oo[E-2],v=Bi(m,7)^Bi(m,18)^m>>>3,A=Bi(w,17)^Bi(w,19)^w>>>10;Oo[E]=A+Oo[E-7]+v+Oo[E-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:u,G:l,H:d}=this;for(let E=0;E<64;E++){const m=d+(Bi(a,6)^Bi(a,11)^Bi(a,25))+((_=a)&u^~_&l)+hP[E]+Oo[E]|0,w=(Bi(n,2)^Bi(n,13)^Bi(n,22))+lP(n,i,o)|0;d=l,l=u,u=a,a=s+m|0,s=o,o=i,i=n,n=m+w|0}var _;n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+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,o,s,a,u,l,d)}roundClean(){Oo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Rp=L8(()=>new fP);var nn={};function bo(r,e,t){return e<=r&&r<=t}function Ah(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function Up(r){this.tokens=[].slice.call(r)}Up.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var e=r;e.length;)this.tokens.push(e.shift());else this.tokens.push(r)}};var ba=-1;function Yd(r,e){if(r)throw TypeError("Decoder error");return e||65533}var kh="utf-8";function Sh(r,e){if(!(this instanceof Sh))return new Sh(r,e);if((r=r!==void 0?String(r).toLowerCase():kh)!==kh)throw new Error("Encoding not supported. Only utf-8 is supported");e=Ah(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Ih(r,e){if(!(this instanceof Ih))return new Ih(r,e);if((r=r!==void 0?String(r).toLowerCase():kh)!==kh)throw new Error("Encoding not supported. Only utf-8 is supported");e=Ah(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function dP(r){var e=r.fatal,t=0,n=0,i=0,o=128,s=191;this.handler=function(a,u){if(u===-1&&i!==0)return i=0,Yd(e);if(u===-1)return ba;if(i===0){if(bo(u,0,127))return u;if(bo(u,194,223))i=1,t=u-192;else if(bo(u,224,239))u===224&&(o=160),u===237&&(s=159),i=2,t=u-224;else{if(!bo(u,240,244))return Yd(e);u===240&&(o=144),u===244&&(s=143),i=3,t=u-240}return t<<=6*i,null}if(!bo(u,o,s))return t=i=n=0,o=128,s=191,a.prepend(u),Yd(e);if(o=128,s=191,t+=u-128<<6*(i-(n+=1)),n!==i)return null;var l=t;return t=i=n=0,l}}function pP(r){r.fatal,this.handler=function(e,t){if(t===-1)return ba;if(bo(t,0,127))return t;var n,i;bo(t,128,2047)?(n=1,i=192):bo(t,2048,65535)?(n=2,i=224):bo(t,65536,1114111)&&(n=3,i=240);for(var o=[(t>>6*n)+i];n>0;){var s=t>>6*(n-1);o.push(128|63&s),n-=1}return o}}Sh.prototype={decode:function(r,e){var t;t=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),e=Ah(e),this._streaming||(this._decoder=new dP({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var n,i=new Up(t),o=[];!i.endOfStream()&&(n=this._decoder.handler(i,i.read()))!==ba;)n!==null&&(Array.isArray(n)?o.push.apply(o,n):o.push(n));if(!this._streaming){do{if((n=this._decoder.handler(i,i.read()))===ba)break;n!==null&&(Array.isArray(n)?o.push.apply(o,n):o.push(n))}while(!i.endOfStream());this._decoder=null}return o.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(o[0]===65279?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(s){for(var a="",u=0;u>10),56320+(1023&l)))}return a}(o)}},Ih.prototype={encode:function(r,e){r=r?String(r):"",e=Ah(e),this._streaming||(this._encoder=new pP(this._options)),this._streaming=!!e.stream;for(var t,n=[],i=new Up(function(o){for(var s=String(o),a=s.length,u=0,l=[];u57343)l.push(d);else if(56320<=d&&d<=57343)l.push(65533);else if(55296<=d&&d<=56319)if(u===a-1)l.push(65533);else{var _=o.charCodeAt(u+1);if(56320<=_&&_<=57343){var E=1023&d,m=1023&_;l.push(65536+(E<<10)+m),u+=1}else l.push(65533)}u+=1}return l}(r));!i.endOfStream()&&(t=this._encoder.handler(i,i.read()))!==ba;)Array.isArray(t)?n.push.apply(n,t):n.push(t);if(!this._streaming){for(;(t=this._encoder.handler(i,i.read()))!==ba;)Array.isArray(t)?n.push.apply(n,t):n.push(t);this._encoder=null}return new Uint8Array(n)}};var gP=mg(Object.freeze({__proto__:null,TextEncoder:Ih,TextDecoder:Sh})),yP=bi&&bi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),mP=bi&&bi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Mi=bi&&bi.__decorate||function(r,e,t,n){var i,o=arguments.length,s=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(i=r[a])&&(s=(o<3?i(s):o>3?i(e,t,s):i(e,t))||s);return o>3&&s&&Object.defineProperty(e,t,s),s},wP=bi&&bi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.hasOwnProperty.call(r,t)&&yP(e,r,t);return mP(e,r),e},F8=bi&&bi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(nn,"__esModule",{value:!0});var $8=nn.deserializeUnchecked=W8=nn.deserialize=H8=nn.serialize=nn.BinaryReader=nn.BinaryWriter=nn.BorshError=nn.baseDecode=nn.baseEncode=void 0;const zo=F8(z8),H2=F8(j8),bP=wP(gP),vP=new(typeof TextDecoder!="function"?bP.TextDecoder:TextDecoder)("utf-8",{fatal:!0});nn.baseEncode=function(r){return typeof r=="string"&&(r=Ae.Buffer.from(r,"utf8")),H2.default.encode(Ae.Buffer.from(r))},nn.baseDecode=function(r){return Ae.Buffer.from(H2.default.decode(r))};const Jd=1024;class bn extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}nn.BorshError=bn;class K8{constructor(){this.buf=Ae.Buffer.alloc(Jd),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Ae.Buffer.concat([this.buf,Ae.Buffer.alloc(Jd)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new zo.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new zo.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new zo.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Ae.Buffer.from(new zo.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Ae.Buffer.concat([Ae.Buffer.from(this.buf.subarray(0,this.length)),e,Ae.Buffer.alloc(Jd)]),this.length+=e.length}writeString(e){this.maybeResize();const t=Ae.Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Ae.Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function Pi(r,e,t){const n=t.value;t.value=function(...i){try{return n.apply(this,i)}catch(o){if(o instanceof RangeError){const s=o.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(s)>=0)throw new bn("Reached the end of buffer when deserializing")}throw o}}}nn.BinaryWriter=K8;class Nn{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new zo.default(e,"le")}readU128(){const e=this.readBuffer(16);return new zo.default(e,"le")}readU256(){const e=this.readBuffer(32);return new zo.default(e,"le")}readU512(){const e=this.readBuffer(64);return new zo.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new bn(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return vP.decode(t)}catch(n){throw new bn(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let i=0;i{ms(r,e,o,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":t==null?i.writeU8(0):(i.writeU8(1),ms(r,e,t,n.type,i));break;case"map":i.writeU32(t.size),t.forEach((o,s)=>{ms(r,e,s,n.key,i),ms(r,e,o,n.value,i)});break;default:throw new bn(`FieldType ${n} unrecognized`)}else q8(r,t,i)}catch(o){throw o instanceof bn&&o.addToFieldPath(e),o}}function q8(r,e,t){if(typeof e.borshSerialize=="function")return void e.borshSerialize(t);const n=r.get(e.constructor);if(!n)throw new bn(`Class ${e.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,o])=>{ms(r,i,e[i],o,t)});else{if(n.kind!=="enum")throw new bn(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`);{const i=e[n.field];for(let o=0;ows(r,e,t[0],n))}if(t.kind==="option")return n.readU8()?ws(r,e,t.type,n):void 0;if(t.kind==="map"){let i=new Map;const o=n.readU32();for(let s=0;s=n.values.length)throw new bn(`Enum index: ${i} is out of range`);const[o,s]=n.values[i];return new e({[o]:ws(r,o,s,t)})}throw new bn(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}var W8=nn.deserialize=function(r,e,t,n=Nn){const i=new n(t),o=_g(r,e,i);if(i.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function xg(r,e){return e.property?r+"["+e.property+"]":r}fe.Layout=ur,fe.nameWithProperty=xg,fe.bindConstructorLayout=function(r,e){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ur))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=e,e.boundConstructor_=r,e.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(t,n)=>e.decode(t,n),writable:!0})};class An extends ur{isCount(){throw new Error("ExternalLayout is abstract")}}fe.ExternalLayout=An;class Z8 extends An{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){cu(e);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}fe.GreedyCount=Z8;class Ag extends An{constructor(e,t=0,n){if(!(e instanceof ur))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof ii||this.layout instanceof mi}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,n=0){return this.layout.encode(e,t,n+this.offset)}}fe.OffsetLayout=Ag;class ii extends ur{constructor(e,t){if(super(e,t),6s+i.encode(a,t,n+s),0);return this.count instanceof An&&this.count.encode(e.length,t,n),o}}fe.Sequence=n4;class i4 extends ur{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce((o,s)=>o&&s instanceof ur,!0))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&n===void 0&&(n=t,t=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,t);return t+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,t=0){cu(e);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n=0){const i=n;let o=0,s=0;for(const a of this.fields){let u=a.span;if(s=0u&&(u=a.getSpan(t,n)))}o=n,n+=u}return o+s-i}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?t=-1:0<=t&&(t+=n.span)}}}fe.Structure=i4;class kg{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,n){throw new Error("UnionDiscriminator is abstract")}}fe.UnionDiscriminator=kg;class Bh extends kg{constructor(e,t){if(!(e instanceof An&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}fe.UnionLayoutDiscriminator=Bh;class Sg extends ur{constructor(e,t,n){let i;if(e instanceof ii||e instanceof mi)i=new Bh(new Ag(e));else if(e instanceof An&&e.isCount())i=new Bh(e);else{if(!(e instanceof kg))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");i=e}if(t===void 0&&(t=null),!(t===null||t instanceof ur))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&(e instanceof ii||e instanceof mi)&&(o+=i.layout.span)),super(o,n),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof ii||e instanceof mi,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e,t=0){let n;const i=this.discriminator,o=i.decode(e,t),s=this.registry[o];if(s===void 0){const a=this.defaultLayout;let u=0;this.usesPrefixDiscriminator&&(u=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[a.property]=a.decode(e,t+u)}else n=s.decode(e,t);return n}encode(e,t,n=0){const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(e[o.property],t,n),a+s.encode(e[s.property],t,n+a)}return i.encode(e,t,n)}addVariant(e,t,n){const i=new o4(this,e,t,n);return this.registry[e]=i,i}getVariant(e,t=0){let n;return n=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[n]}}fe.Union=Sg;class o4 extends ur{constructor(e,t,n,i){if(!(e instanceof Sg))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof ur))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,t+n)),n+i}decode(e,t=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],t,n+i),o+=this.layout.getSpan(t,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function ya(r){return 0>r&&(r+=4294967296),r}fe.VariantLayout=o4;class Ig extends ur{constructor(e,t,n){if(!(e instanceof ii||e instanceof mi))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&n===void 0&&(n=t,t=!1),4=t)throw new TypeError("bits must be positive integer");const i=8*e.span,o=e.fields.reduce((s,a)=>s+a.bits,0);if(t+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==ya(e&this.valueMask))throw new TypeError(xg("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=ya(e<n&&(n=this.length.decode(e,t)),n}decode(e,t=0){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),Xt(e).slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof An&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw new TypeError(xg("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>t.length)throw new RangeError("encoding overruns Uint8Array");const o=Xt(e);return Xt(t).write(o.toString("hex"),n,i,"hex"),this.length instanceof An&&this.length.encode(i,t,n),i}}fe.Blob=a4;class u4 extends ur{constructor(e){super(-1,e)}getSpan(e,t=0){cu(e);let n=t;for(;nt.length)throw new RangeError("encoding overruns Buffer");const s=Xt(t);return i.copy(s,n),s[n+o]=0,o+1}}fe.CString=u4;class c4 extends ur{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return cu(e),e.length-t}decode(e,t=0){const n=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpant.length)throw new RangeError("encoding overruns Buffer");return i.copy(Xt(t),n),o}}fe.UTF8=c4;class l4 extends ur{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,n){return 0}}fe.Constant=l4,fe.greedy=(r,e)=>new Z8(r,e);var Ns=fe.offset=(r,e,t)=>new Ag(r,e,t),Or=fe.u8=r=>new ii(1,r),Gn=fe.u16=r=>new ii(2,r);fe.u24=r=>new ii(3,r);var bt=fe.u32=r=>new ii(4,r);fe.u40=r=>new ii(5,r),fe.u48=r=>new ii(6,r);var Qr=fe.nu64=r=>new G8(r);fe.u16be=r=>new mi(2,r),fe.u24be=r=>new mi(3,r),fe.u32be=r=>new mi(4,r),fe.u40be=r=>new mi(5,r),fe.u48be=r=>new mi(6,r),fe.nu64be=r=>new Y8(r),fe.s8=r=>new ds(1,r),fe.s16=r=>new ds(2,r),fe.s24=r=>new ds(3,r),fe.s32=r=>new ds(4,r),fe.s40=r=>new ds(5,r),fe.s48=r=>new ds(6,r);var $n=fe.ns64=r=>new J8(r);fe.s16be=r=>new ga(2,r),fe.s24be=r=>new ga(3,r),fe.s32be=r=>new ga(4,r),fe.s40be=r=>new ga(5,r),fe.s48be=r=>new ga(6,r),fe.ns64be=r=>new X8(r),fe.f32=r=>new Q8(r),fe.f32be=r=>new e4(r),fe.f64=r=>new t4(r),fe.f64be=r=>new r4(r);var wt=fe.struct=(r,e,t)=>new i4(r,e,t);fe.bits=(r,e,t)=>new Ig(r,e,t);var ks=fe.seq=(r,e,t)=>new n4(r,e,t);fe.union=(r,e,t)=>new Sg(r,e,t),fe.unionLayoutDiscriminator=(r,e)=>new Bh(r,e);var Ja=fe.blob=(r,e)=>new a4(r,e);fe.cstr=r=>new u4(r),fe.utf8=(r,e)=>new c4(r,e),fe.constant=(r,e)=>new l4(r,e);var Jc={};Object.defineProperty(Jc,"__esModule",{value:!0});var _P=Jc.toBigIntLE=function(r){{const e=Ae.Buffer.from(r);e.reverse();const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};Jc.toBigIntBE=function(r){{const e=r.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};var Xd,EP=Jc.toBufferLE=function(r,e){{const t=r.toString(16),n=Ae.Buffer.from(t.padStart(2*e,"0").slice(0,2*e),"hex");return n.reverse(),n}};Jc.toBufferBE=function(r,e){{const t=r.toString(16);return Ae.Buffer.from(t.padStart(2*e,"0").slice(0,2*e),"hex")}};class xP extends TypeError{constructor(e,t){let n;const{message:i,...o}=e,{path:s}=e;super(s.length===0?i:"At path: "+s.join(".")+" -- "+i),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var a;return(a=n)!=null?a:n=[e,...t()]}}}function Ho(r){return typeof r=="object"&&r!=null}function vi(r){return typeof r=="string"?JSON.stringify(r):""+r}function AP(r,e,t,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:o}=e,{type:s}=t,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+vi(n)+"`"}=r;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...r,message:u}}function*W2(r,e,t,n){var i;Ho(i=r)&&typeof i[Symbol.iterator]=="function"||(r=[r]);for(const o of r){const s=AP(o,e,t,n);s&&(yield s)}}function*Mg(r,e,t={}){const{path:n=[],branch:i=[r],coerce:o=!1,mask:s=!1}=t,a={path:n,branch:i};if(o&&(r=e.coercer(r,a),s&&e.type!=="type"&&Ho(e.schema)&&Ho(r)&&!Array.isArray(r)))for(const l in r)e.schema[l]===void 0&&delete r[l];let u=!0;for(const l of e.validator(r,a))u=!1,yield[l,void 0];for(let[l,d,_]of e.entries(r,a)){const E=Mg(d,_,{path:l===void 0?n:[...n,l],branch:l===void 0?i:[...i,d],coerce:o,mask:s});for(const m of E)m[0]?(u=!1,yield[m[0],void 0]):o&&(d=m[1],l===void 0?r=d:r instanceof Map?r.set(l,d):r instanceof Set?r.add(d):Ho(r)&&(r[l]=d))}if(u)for(const l of e.refiner(r,a))u=!1,yield[l,void 0];u&&(yield[void 0,r])}class Yi{constructor(e){const{type:t,schema:n,validator:i,refiner:o,coercer:s=u=>u,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=s,this.validator=i?(u,l)=>W2(i(u,l),l,this,u):()=>[],this.refiner=o?(u,l)=>W2(o(u,l),l,this,u):()=>[]}assert(e){return function(t,n){const i=Qu(t,n);if(i[0])throw i[0]}(e,this)}create(e){return Sf(e,this)}is(e){return h4(e,this)}mask(e){return function(t,n){const i=Qu(t,n,{coerce:!0,mask:!0});if(i[0])throw i[0];return i[1]}(e,this)}validate(e,t={}){return Qu(e,this,t)}}function Sf(r,e){const t=Qu(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function h4(r,e){return!Qu(r,e)[0]}function Qu(r,e,t={}){const n=Mg(r,e,t),i=function(o){const{done:s,value:a}=o.next();return s?void 0:a}(n);return i[0]?[new xP(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function Xs(r,e){return new Yi({type:r,schema:null,validator:e})}function tt(r){return new Yi({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,r]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+vi(e)})}function Zi(){return Xs("boolean",r=>typeof r=="boolean")}function Pg(r){return Xs("instance",e=>e instanceof r||"Expected a `"+r.name+"` instance, but received: "+vi(e))}function Ar(r){const e=vi(r),t=typeof r;return new Yi({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+e+"`, but received: "+vi(n)})}function et(r){return new Yi({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function le(){return Xs("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+vi(r))}function xt(r){return new Yi({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function f4(r,e){return new Yi({type:"record",schema:null,*entries(t){if(Ho(t))for(const n in t){const i=t[n];yield[n,n,r],yield[n,i,e]}},validator:t=>Ho(t)||"Expected an object, but received: "+vi(t)})}function He(){return Xs("string",r=>typeof r=="string"||"Expected a string, but received: "+vi(r))}function Lg(r){const e=Xs("never",()=>!1);return new Yi({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const n=Math.max(r.length,t.length);for(let i=0;iArray.isArray(t)||"Expected an array, but received: "+vi(t)})}function Ie(r){const e=Object.keys(r);return new Yi({type:"type",schema:r,*entries(t){if(Ho(t))for(const n of e)yield[n,t[n],r[n]]},validator:t=>Ho(t)||"Expected an object, but received: "+vi(t)})}function Cn(r){const e=r.map(t=>t.type).join(" | ");return new Yi({type:"union",schema:null,validator(t,n){const i=[];for(const o of r){const[...s]=Mg(t,o,n),[a]=s;if(!a[0])return[];for(const[u]of s)u&&i.push(u)}return["Expected the value to satisfy a union of `"+e+"`, but received: "+vi(t),...i]}})}function Xc(){return Xs("unknown",()=>!0)}function Qc(r,e,t){return new Yi({...r,coercer:(n,i)=>h4(n,e)?r.coercer(t(n,i),i):r.coercer(n,i)})}var kP=new Uint8Array(16);function Z2(){if(!Xd&&!(Xd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xd(kP)}var SP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Mh(r){return typeof r=="string"&&SP.test(r)}for(var G2,Qd,Jr=[],e0=0;e0<256;++e0)Jr.push((e0+256).toString(16).substr(1));function eh(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(Jr[r[e+0]]+Jr[r[e+1]]+Jr[r[e+2]]+Jr[r[e+3]]+"-"+Jr[r[e+4]]+Jr[r[e+5]]+"-"+Jr[r[e+6]]+Jr[r[e+7]]+"-"+Jr[r[e+8]]+Jr[r[e+9]]+"-"+Jr[r[e+10]]+Jr[r[e+11]]+Jr[r[e+12]]+Jr[r[e+13]]+Jr[r[e+14]]+Jr[r[e+15]]).toLowerCase();if(!Mh(t))throw TypeError("Stringified UUID is invalid");return t}var t0=0,r0=0;function d4(r){if(!Mh(r))throw TypeError("Invalid UUID");var e,t=new Uint8Array(16);return t[0]=(e=parseInt(r.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=255&e,t[4]=(e=parseInt(r.slice(9,13),16))>>>8,t[5]=255&e,t[6]=(e=parseInt(r.slice(14,18),16))>>>8,t[7]=255&e,t[8]=(e=parseInt(r.slice(19,23),16))>>>8,t[9]=255&e,t[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=255&e,t}function p4(r,e,t){function n(i,o,s,a){if(typeof i=="string"&&(i=function(d){d=unescape(encodeURIComponent(d));for(var _=[],E=0;E>>9<<4)+1}function jo(r,e){var t=(65535&r)+(65535&e);return(r>>16)+(e>>16)+(t>>16)<<16|65535&t}function If(r,e,t,n,i,o){return jo((s=jo(jo(e,r),jo(n,o)))<<(a=i)|s>>>32-a,t);var s,a}function pn(r,e,t,n,i,o,s){return If(e&t|~e&n,r,e,i,o,s)}function gn(r,e,t,n,i,o,s){return If(e&n|t&~n,r,e,i,o,s)}function yn(r,e,t,n,i,o,s){return If(e^t^n,r,e,i,o,s)}function mn(r,e,t,n,i,o,s){return If(t^(e|~n),r,e,i,o,s)}var IP=p4("v3",48,function(r){if(typeof r=="string"){var e=unescape(encodeURIComponent(r));r=new Uint8Array(e.length);for(var t=0;t>5]>>>a%32&255,l=parseInt(s.charAt(u>>>4&15)+s.charAt(15&u),16);i.push(l)}return i}(function(n,i){n[i>>5]|=128<>5]|=(255&n[s/8])<>>32-e}var PP=p4("v5",80,function(r){var e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var i=0;i>>0;S=B,B=I,I=n0(A,30)>>>0,A=v,v=R}t[0]=t[0]+v>>>0,t[1]=t[1]+A>>>0,t[2]=t[2]+I>>>0,t[3]=t[3]+B>>>0,t[4]=t[4]+S>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}),LP=PP,CP=Object.freeze({__proto__:null,v1:function(r,e,t){var n=e&&t||0,i=e||new Array(16),o=(r=r||{}).node||G2,s=r.clockseq!==void 0?r.clockseq:Qd;if(o==null||s==null){var a=r.random||(r.rng||Z2)();o==null&&(o=G2=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),s==null&&(s=Qd=16383&(a[6]<<8|a[7]))}var u=r.msecs!==void 0?r.msecs:Date.now(),l=r.nsecs!==void 0?r.nsecs:r0+1,d=u-t0+(l-r0)/1e4;if(d<0&&r.clockseq===void 0&&(s=s+1&16383),(d<0||u>t0)&&r.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");t0=u,r0=l,Qd=s;var _=(1e4*(268435455&(u+=122192928e5))+l)%4294967296;i[n++]=_>>>24&255,i[n++]=_>>>16&255,i[n++]=_>>>8&255,i[n++]=255&_;var E=u/4294967296*1e4&268435455;i[n++]=E>>>8&255,i[n++]=255&E,i[n++]=E>>>24&15|16,i[n++]=E>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var m=0;m<6;++m)i[n+m]=o[m];return e||eh(i)},v3:BP,v4:function(r,e,t){var n=(r=r||{}).random||(r.rng||Z2)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){t=t||0;for(var i=0;i<16;++i)e[t+i]=n[i];return e}return eh(n)},v5:LP,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!Mh(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:Mh,stringify:eh,parse:d4}),J2=mg(CP);J2.v4,J2.v4;var Ol,g4={exports:{}};(Ol=g4).exports=function(r){return r&&r.__esModule?r:{default:r}},Ol.exports.__esModule=!0,Ol.exports.default=Ol.exports;var X2,Q2,i0,eb,tb=g4.exports,rb={exports:{}},nb={exports:{}};function xc(){return X2||(X2=1,function(r){function e(t){return r.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,e(t)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports}(nb)),nb.exports}var ib,ob,sb={exports:{}},ab={exports:{}};function ub(){return ob||(ob=1,function(r){r.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(ab)),ab.exports}var cb,lb,hb,fb={exports:{}},db={exports:{}},pb={exports:{}};function TP(){return lb||(lb=1,function(r){var e=xc().default,t=(cb||(cb=1,function(n){var i=xc().default;n.exports=function(o,s){if(i(o)!=="object"||o===null)return o;var a=o[Symbol.toPrimitive];if(a!==void 0){var u=a.call(o,s||"default");if(i(u)!=="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(o)},n.exports.__esModule=!0,n.exports.default=n.exports}(pb)),pb.exports);r.exports=function(n){var i=t(n,"string");return e(i)==="symbol"?i:String(i)},r.exports.__esModule=!0,r.exports.default=r.exports}(db)),db.exports}function gb(){return hb||(hb=1,function(r){var e=TP();function t(n,i){for(var o=0;o=0;--Fe){var f=this.tryEntries[Fe],b=f.completion;if(f.tryLoc==="root")return oe("end");if(f.tryLoc<=this.prev){var k=S.call(f,"catchLoc"),T=S.call(f,"finallyLoc");if(k&&T){if(this.prev=0;--oe){var Fe=this.tryEntries[oe];if(Fe.tryLoc<=this.prev&&S.call(Fe,"finallyLoc")&&this.prev=0;--ie){var oe=this.tryEntries[ie];if(oe.finallyLoc===se)return this.complete(oe.completion,oe.afterLoc),$e(oe),L}},catch:function(se){for(var ie=this.tryEntries.length-1;ie>=0;--ie){var oe=this.tryEntries[ie];if(oe.tryLoc===se){var Fe=oe.completion;if(Fe.type==="throw"){var f=Fe.arg;$e(oe)}return f}}throw new Error("illegal catch attempt")},delegateYield:function(se,ie,oe){return this.delegate={iterator:me(se),resultName:ie,nextLoc:oe},this.method==="next"&&(this.arg=A),L}},I}m.exports=v,m.exports.__esModule=!0,m.exports.default=m.exports}(rb)),rb.exports)();i0=E;try{regeneratorRuntime=E}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=E:Function("r","regeneratorRuntime = r")(E)}return i0}()),n=e((ib||(ib=1,function(E){function m(w,v,A,I,B,S,P){try{var C=w[S](P),R=C.value}catch(j){return void A(j)}C.done?v(R):Promise.resolve(R).then(I,B)}E.exports=function(w){return function(){var v=this,A=arguments;return new Promise(function(I,B){var S=w.apply(v,A);function P(R){m(S,I,B,P,C,"next",R)}function C(R){m(S,I,B,P,C,"throw",R)}P(void 0)})}},E.exports.__esModule=!0,E.exports.default=E.exports}(sb)),sb.exports)),i=e(xc()),o=e(ub()),s=e(gb()),a=e(vb()),u=e(kb()),l=e(Bb());function d(E){var m=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var w,v=(0,l.default)(E);if(m){var A=(0,l.default)(this).constructor;w=Reflect.construct(v,arguments,A)}else w=v.apply(this,arguments);return(0,u.default)(this,w)}}var _=function(E){(0,a.default)(B,E);var m,w,v,A,I=d(B);function B(S){var P,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},j=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,B);var H=R.autoconnect,N=H===void 0||H,c=R.reconnect,p=c===void 0||c,x=R.reconnect_interval,g=x===void 0?1e3:x,h=R.max_reconnects,y=h===void 0?5:h,L=function(F,K){var V={};for(var W in F)Object.prototype.hasOwnProperty.call(F,W)&&K.indexOf(W)<0&&(V[W]=F[W]);if(F!=null&&typeof Object.getOwnPropertySymbols=="function"){var Z=0;for(W=Object.getOwnPropertySymbols(F);ZC.current_reconnects||C.max_reconnects===0)&&(C.reconnect_timer_id=setTimeout(function(){return C._connect(S,P)},C.reconnect_interval)))})}}]),B}(Lb().EventEmitter);r.default=_})({}),function(r){var e=tb;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(l,d){return new u(l,d)};var t=e(ub()),n=e(gb()),i=e(vb()),o=e(kb()),s=e(Bb());function a(l){var d=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,E=(0,s.default)(l);if(d){var m=(0,s.default)(this).constructor;_=Reflect.construct(E,arguments,m)}else _=E.apply(this,arguments);return(0,o.default)(this,_)}}var u=function(l){(0,i.default)(_,l);var d=a(_);function _(E,m,w){var v;return(0,t.default)(this,_),(v=d.call(this)).socket=new window.WebSocket(E,w),v.socket.onopen=function(){return v.emit("open")},v.socket.onmessage=function(A){return v.emit("message",A.data)},v.socket.onerror=function(A){return v.emit("error",A)},v.socket.onclose=function(A){v.emit("close",A.code,A.reason)},v}return(0,n.default)(_,[{key:"send",value:function(E,m,w){var v=w||m;try{this.socket.send(E),v()}catch(A){v(A)}}},{key:"close",value:function(E,m){this.socket.close(E,m)}},{key:"addEventListener",value:function(E,m,w){this.socket.addEventListener(E,m,w)}}]),_}(Lb().EventEmitter)}({});const{bytesToNumberBE:OP,hexToBytes:RP}=GM,Ss={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:e}=Ss;if(r.length<2||r[0]!==2)throw new e("Invalid signature integer tag");const t=r[1],n=r.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(128&n[0])throw new e("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:OP(n),l:r.subarray(t+2)}},toSig(r){const{Err:e}=Ss,t=typeof r=="string"?RP(r):r;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=Ss._parseInt(t.subarray(2)),{d:s,l:a}=Ss._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(r){const e=l=>8&Number.parseInt(l[0],16)?"00"+l:l,t=l=>{const d=l.toString(16);return 1&d.length?`0${d}`:d},n=e(t(r.s)),i=e(t(r.r)),o=n.length/2,s=i.length/2,a=t(o),u=t(s);return`30${t(s+o+4)}02${u}${i}02${a}${n}`}},to=BigInt(0),Zn=BigInt(1);BigInt(2);const Cb=BigInt(3);function UP(r){const e=function(N){const c=Pp(N);return Ya(c,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...c})}(r),{Fp:t,n}=e,i=t.BYTES+1,o=2*t.BYTES+1;function s(N){return br(N,n)}function a(N){return Mp(N,n)}const{ProjectivePoint:u,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:_}=function(N){const c=function(ne){const X=Pp(ne);Ya(X,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:te,Fp:ge,a:ce}=X;if(te){if(!ge.eql(ce,ge.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof te!="object"||typeof te.beta!="bigint"||typeof te.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...X})}(N),{Fp:p}=c,x=c.toBytes||((ne,X,te)=>{const ge=X.toAffine();return Us(Uint8Array.from([4]),p.toBytes(ge.x),p.toBytes(ge.y))}),g=c.fromBytes||(ne=>{const X=ne.subarray(1);return{x:p.fromBytes(X.subarray(0,p.BYTES)),y:p.fromBytes(X.subarray(p.BYTES,2*p.BYTES))}});function h(ne){const{a:X,b:te}=c,ge=p.sqr(ne),ce=p.mul(ge,ne);return p.add(p.add(ce,p.mul(ne,X)),te)}if(!p.eql(p.sqr(c.Gy),h(c.Gx)))throw new Error("bad generator point: equation left != right");function y(ne){return typeof ne=="bigint"&&top.eql(we,p.ZERO);return ce(te)&&ce(ge)?W.ZERO:new W(te,ge,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(X){const te=p.invertBatch(X.map(ge=>ge.pz));return X.map((ge,ce)=>ge.toAffine(te[ce])).map(W.fromAffine)}static fromHex(X){const te=W.fromAffine(g(Dr("pointHex",X)));return te.assertValidity(),te}static fromPrivateKey(X){return W.BASE.multiply(F(X))}_setWindowSize(X){this._WINDOW_SIZE=X,K.delete(this)}assertValidity(){if(this.is0()){if(c.allowInfinityPoint&&!p.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:X,y:te}=this.toAffine();if(!p.isValid(X)||!p.isValid(te))throw new Error("bad point: x or y not FE");const ge=p.sqr(te),ce=h(X);if(!p.eql(ge,ce))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:X}=this.toAffine();if(p.isOdd)return!p.isOdd(X);throw new Error("Field doesn't support isOdd")}equals(X){V(X);const{px:te,py:ge,pz:ce}=this,{px:we,py:$e,pz:be}=X,me=p.eql(p.mul(te,be),p.mul(we,ce)),se=p.eql(p.mul(ge,be),p.mul($e,ce));return me&&se}negate(){return new W(this.px,p.neg(this.py),this.pz)}double(){const{a:X,b:te}=c,ge=p.mul(te,Cb),{px:ce,py:we,pz:$e}=this;let be=p.ZERO,me=p.ZERO,se=p.ZERO,ie=p.mul(ce,ce),oe=p.mul(we,we),Fe=p.mul($e,$e),f=p.mul(ce,we);return f=p.add(f,f),se=p.mul(ce,$e),se=p.add(se,se),be=p.mul(X,se),me=p.mul(ge,Fe),me=p.add(be,me),be=p.sub(oe,me),me=p.add(oe,me),me=p.mul(be,me),be=p.mul(f,be),se=p.mul(ge,se),Fe=p.mul(X,Fe),f=p.sub(ie,Fe),f=p.mul(X,f),f=p.add(f,se),se=p.add(ie,ie),ie=p.add(se,ie),ie=p.add(ie,Fe),ie=p.mul(ie,f),me=p.add(me,ie),Fe=p.mul(we,$e),Fe=p.add(Fe,Fe),ie=p.mul(Fe,f),be=p.sub(be,ie),se=p.mul(Fe,oe),se=p.add(se,se),se=p.add(se,se),new W(be,me,se)}add(X){V(X);const{px:te,py:ge,pz:ce}=this,{px:we,py:$e,pz:be}=X;let me=p.ZERO,se=p.ZERO,ie=p.ZERO;const oe=c.a,Fe=p.mul(c.b,Cb);let f=p.mul(te,we),b=p.mul(ge,$e),k=p.mul(ce,be),T=p.add(te,ge),U=p.add(we,$e);T=p.mul(T,U),U=p.add(f,b),T=p.sub(T,U),U=p.add(te,ce);let $=p.add(we,be);return U=p.mul(U,$),$=p.add(f,k),U=p.sub(U,$),$=p.add(ge,ce),me=p.add($e,be),$=p.mul($,me),me=p.add(b,k),$=p.sub($,me),ie=p.mul(oe,U),me=p.mul(Fe,k),ie=p.add(me,ie),me=p.sub(b,ie),ie=p.add(b,ie),se=p.mul(me,ie),b=p.add(f,f),b=p.add(b,f),k=p.mul(oe,k),U=p.mul(Fe,U),b=p.add(b,k),k=p.sub(f,k),k=p.mul(oe,k),U=p.add(U,k),f=p.mul(b,U),se=p.add(se,f),f=p.mul($,U),me=p.mul(T,me),me=p.sub(me,f),f=p.mul(T,b),ie=p.mul($,ie),ie=p.add(ie,f),new W(me,se,ie)}subtract(X){return this.add(X.negate())}is0(){return this.equals(W.ZERO)}wNAF(X){return G.wNAFCached(this,K,X,te=>{const ge=p.invertBatch(te.map(ce=>ce.pz));return te.map((ce,we)=>ce.toAffine(ge[we])).map(W.fromAffine)})}multiplyUnsafe(X){const te=W.ZERO;if(X===to)return te;if(L(X),X===Zn)return this;const{endo:ge}=c;if(!ge)return G.unsafeLadder(this,X);let{k1neg:ce,k1:we,k2neg:$e,k2:be}=ge.splitScalar(X),me=te,se=te,ie=this;for(;we>to||be>to;)we&Zn&&(me=me.add(ie)),be&Zn&&(se=se.add(ie)),ie=ie.double(),we>>=Zn,be>>=Zn;return ce&&(me=me.negate()),$e&&(se=se.negate()),se=new W(p.mul(se.px,ge.beta),se.py,se.pz),me.add(se)}multiply(X){L(X);let te,ge,ce=X;const{endo:we}=c;if(we){const{k1neg:$e,k1:be,k2neg:me,k2:se}=we.splitScalar(ce);let{p:ie,f:oe}=this.wNAF(be),{p:Fe,f}=this.wNAF(se);ie=G.constTimeNegate($e,ie),Fe=G.constTimeNegate(me,Fe),Fe=new W(p.mul(Fe.px,we.beta),Fe.py,Fe.pz),te=ie.add(Fe),ge=oe.add(f)}else{const{p:$e,f:be}=this.wNAF(ce);te=$e,ge=be}return W.normalizeZ([te,ge])[0]}multiplyAndAddUnsafe(X,te,ge){const ce=W.BASE,we=(be,me)=>me!==to&&me!==Zn&&be.equals(ce)?be.multiply(me):be.multiplyUnsafe(me),$e=we(this,te).add(we(X,ge));return $e.is0()?void 0:$e}toAffine(X){const{px:te,py:ge,pz:ce}=this,we=this.is0();X==null&&(X=we?p.ONE:p.inv(ce));const $e=p.mul(te,X),be=p.mul(ge,X),me=p.mul(ce,X);if(we)return{x:p.ZERO,y:p.ZERO};if(!p.eql(me,p.ONE))throw new Error("invZ was invalid");return{x:$e,y:be}}isTorsionFree(){const{h:X,isTorsionFree:te}=c;if(X===Zn)return!0;if(te)return te(W,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:X,clearCofactor:te}=c;return X===Zn?this:te?te(W,this):this.multiplyUnsafe(c.h)}toRawBytes(X=!0){return this.assertValidity(),x(W,this,X)}toHex(X=!0){return Rs(this.toRawBytes(X))}}W.BASE=new W(c.Gx,c.Gy,p.ONE),W.ZERO=new W(p.ZERO,p.ONE,p.ZERO);const Z=c.nBitLength,G=D8(W,c.endo?Math.ceil(Z/2):Z);return{CURVE:c,ProjectivePoint:W,normPrivateKeyToScalar:F,weierstrassEquation:h,isWithinCurveOrder:y}}({...e,toBytes(N,c,p){const x=c.toAffine(),g=t.toBytes(x.x),h=Us;return p?h(Uint8Array.from([c.hasEvenY()?2:3]),g):h(Uint8Array.from([4]),g,t.toBytes(x.y))},fromBytes(N){const c=N.length,p=N[0],x=N.subarray(1);if(c!==i||p!==2&&p!==3){if(c===o&&p===4)return{x:t.fromBytes(x.subarray(0,t.BYTES)),y:t.fromBytes(x.subarray(t.BYTES,2*t.BYTES))};throw new Error(`Point of length ${c} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const h=ys(x);if(!(to<(g=h)&&gRs(Oa(N,e.nByteLength));function m(N){return N>n>>Zn}const w=(N,c,p)=>ys(N.slice(c,p));class v{constructor(c,p,x){this.r=c,this.s=p,this.recovery=x,this.assertValidity()}static fromCompact(c){const p=e.nByteLength;return c=Dr("compactSignature",c,2*p),new v(w(c,0,p),w(c,p,2*p))}static fromDER(c){const{r:p,s:x}=Ss.toSig(Dr("DER",c));return new v(p,x)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(c){return new v(this.r,this.s,c)}recoverPublicKey(c){const{r:p,s:x,recovery:g}=this,h=S(Dr("msgHash",c));if(g==null||![0,1,2,3].includes(g))throw new Error("recovery id invalid");const y=g===2||g===3?p+e.n:p;if(y>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const L=1&g?"03":"02",F=u.fromHex(L+E(y)),K=a(y),V=s(-h*K),W=s(x*K),Z=u.BASE.multiplyAndAddUnsafe(F,V,W);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return Ga(this.toDERHex())}toDERHex(){return Ss.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ga(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const A={isValidPrivateKey(N){try{return l(N),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const N=j2(e.n);return function(c,p,x=!1){const g=c.length,h=N8(p),y=j2(p);if(g<16||g1024)throw new Error(`expected ${y}-1024 bytes of input, got ${g}`);const L=br(x?ys(c):Ta(c),p-vr)+vr;return x?Ec(L,h):Oa(L,h)}(e.randomBytes(N),e.n)},precompute:(N=8,c=u.BASE)=>(c._setWindowSize(N),c.multiply(BigInt(3)),c)};function I(N){const c=N instanceof Uint8Array,p=typeof N=="string",x=(c||p)&&N.length;return c?x===i||x===o:p?x===2*i||x===2*o:N instanceof u}const B=e.bits2int||function(N){const c=ys(N),p=8*N.length-e.nBitLength;return p>0?c>>BigInt(p):c},S=e.bits2int_modN||function(N){return s(B(N))},P=vg(e.nBitLength);function C(N){if(typeof N!="bigint")throw new Error("bigint expected");if(!(to<=N&&NG in p))throw new Error("sign() legacy options not supported");const{hash:x,randomBytes:g}=e;let{lowS:h,prehash:y,extraEntropy:L}=p;h==null&&(h=!0),N=Dr("msgHash",N),y&&(N=Dr("prehashed msgHash",x(N)));const F=S(N),K=l(c),V=[C(K),C(F)];if(L!=null){const G=L===!0?g(t.BYTES):L;V.push(Dr("extraEntropy",G))}const W=Us(...V),Z=F;return{seed:W,k2sig:function(G){const ne=B(G);if(!_(ne))return;const X=a(ne),te=u.BASE.multiply(ne).toAffine(),ge=s(te.x);if(ge===to)return;const ce=s(X*s(Z+ge*K));if(ce===to)return;let we=(te.x===ge?0:2)|Number(te.y&Zn),$e=ce;return h&&m(ce)&&($e=function(be){return m(be)?s(-be):be}(ce),we^=1),new v(ge,$e,we)}}}const j={lowS:e.lowS,prehash:!1},H={lowS:e.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(N,c=!0){return u.fromPrivateKey(N).toRawBytes(c)},getSharedSecret:function(N,c,p=!0){if(I(N))throw new Error("first arg must be private key");if(!I(c))throw new Error("second arg must be public key");return u.fromHex(c).multiply(l(N)).toRawBytes(p)},sign:function(N,c,p=j){const{seed:x,k2sig:g}=R(N,c,p),h=e;return O8(h.hash.outputLen,h.nByteLength,h.hmac)(x,g)},verify:function(N,c,p,x=H){var te;const g=N;if(c=Dr("msgHash",c),p=Dr("publicKey",p),"strict"in x)throw new Error("options.strict was renamed to lowS");const{lowS:h,prehash:y}=x;let L,F;try{if(typeof g=="string"||g instanceof Uint8Array)try{L=v.fromDER(g)}catch(ge){if(!(ge instanceof Ss.Err))throw ge;L=v.fromCompact(g)}else{if(typeof g!="object"||typeof g.r!="bigint"||typeof g.s!="bigint")throw new Error("PARSE");{const{r:ge,s:ce}=g;L=new v(ge,ce)}}F=u.fromHex(p)}catch(ge){if(ge.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(h&&L.hasHighS())return!1;y&&(c=e.hash(c));const{r:K,s:V}=L,W=S(c),Z=a(V),G=s(W*Z),ne=s(K*Z),X=(te=u.BASE.multiplyAndAddUnsafe(F,G,ne))==null?void 0:te.toAffine();return!!X&&s(X.x)===K},ProjectivePoint:u,Signature:v,utils:A}}BigInt(4);class y4 extends P8{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(s){if(typeof s!="function"||typeof s.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");T2(s.outputLen),T2(s.blockLen)}(e);const n=wg(t);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,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;snew y4(r,e).update(t).digest();function NP(r){return{hash:r,hmac:(e,...t)=>m4(r,e,function(...n){const i=new Uint8Array(n.reduce((s,a)=>s+a.length,0));let o=0;return n.forEach(s=>{if(!M8(s))throw new Error("Uint8Array expected");i.set(s,o),o+=s.length}),i}(...t)),randomBytes:C8}}m4.create=(r,e)=>new y4(r,e);const Tb=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ob=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),DP=BigInt(1),Dp=BigInt(2),Rb=(r,e)=>(r+e/Dp)/e,zp=U8(Tb,void 0,void 0,{sqrt:function(r){const e=Tb,t=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),l=r*r*r%e,d=l*l*r%e,_=Br(d,t,e)*d%e,E=Br(_,t,e)*d%e,m=Br(E,Dp,e)*l%e,w=Br(m,i,e)*m%e,v=Br(w,o,e)*w%e,A=Br(v,a,e)*v%e,I=Br(A,u,e)*A%e,B=Br(I,a,e)*v%e,S=Br(B,t,e)*d%e,P=Br(S,s,e)*w%e,C=Br(P,n,e)*l%e,R=Br(C,Dp,e);if(!zp.eql(zp.sqr(R),r))throw new Error("Cannot find square root");return R}}),jp=function(r,e){const t=n=>UP({...r,...NP(n)});return Object.freeze({...t(e),create:t})}({a:BigInt(0),b:BigInt(7),Fp:zp,n:Ob,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const e=Ob,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-DP*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=t,s=BigInt("0x100000000000000000000000000000000"),a=Rb(o*r,e),u=Rb(-n*r,e);let l=br(r-a*t-u*i,e),d=br(-a*n-u*o,e);const _=l>s,E=d>s;if(_&&(l=e-l),E&&(d=e-d),l>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:_,k1:l,k2neg:E,k2:d}}}},Rp);function Ub(r){try{return aP.ExtendedPoint.fromHex(r),!0}catch{return!1}}BigInt(0),jp.ProjectivePoint;const zP=r=>_r.Buffer.isBuffer(r)?r:r instanceof Uint8Array?_r.Buffer.from(r.buffer,r.byteOffset,r.byteLength):_r.Buffer.from(r);class jP{constructor(e){Object.assign(this,e)}encode(){return _r.Buffer.from(H8(th,this))}static decode(e){return W8(th,this,e)}static decodeUnchecked(e){return $8(th,this,e)}}const th=new Map;var Nb;let w4;const o0=32;let Db=1;w4=Symbol.toStringTag;class Wt extends jP{constructor(e){if(super({}),this._bn=void 0,function(t){return t._bn!==void 0}(e))this._bn=e._bn;else{if(typeof e=="string"){const t=q2.decode(e);if(t.length!=o0)throw new Error("Invalid public key input");this._bn=new V2(t)}else this._bn=new V2(e);if(this._bn.byteLength()>o0)throw new Error("Invalid public key input")}}static unique(){const e=new Wt(Db);return Db+=1,new Wt(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return q2.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(_r.Buffer);if(e.length===o0)return e;const t=_r.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[w4](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,n){const i=_r.Buffer.concat([e.toBuffer(),_r.Buffer.from(t),n.toBuffer()]),o=Rp(i);return new Wt(o)}static createProgramAddressSync(e,t){let n=_r.Buffer.alloc(0);e.forEach(function(o){if(o.length>32)throw new TypeError("Max seed length exceeded");n=_r.Buffer.concat([n,zP(o)])}),n=_r.Buffer.concat([n,t.toBuffer(),_r.Buffer.from("ProgramDerivedAddress")]);const i=Rp(n);if(Ub(i))throw new Error("Invalid seeds, address must fall off the curve");return new Wt(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let n,i=255;for(;i!=0;){try{const o=e.concat(_r.Buffer.from([i]));n=this.createProgramAddressSync(o,t)}catch(o){if(o instanceof TypeError)throw o;i--;continue}return[n,i]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return Ub(new Wt(e).toBytes())}}Nb=Wt,Wt.default=new Nb("11111111111111111111111111111111"),th.set(Wt,{kind:"struct",fields:[["_bn","u256"]]}),new Wt("BPFLoader1111111111111111111111111111111111");const tr=(r="publicKey")=>Ja(32,r),va=(r="string")=>{const e=wt([bt("length"),bt("lengthPadding"),Ja(Ns(bt(),-8),"chars")],r),t=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(o,s)=>t(o,s).chars.toString(),i.encode=(o,s,a)=>{const u={chars:_r.Buffer.from(o,"utf8")};return n(u,s,a)},i.alloc=o=>bt().span+bt().span+_r.Buffer.from(o,"utf8").length,i};_r.Buffer.alloc(64).fill(0);new Wt("SysvarC1ock11111111111111111111111111111111"),new Wt("SysvarEpochSchedu1e111111111111111111111111"),new Wt("Sysvar1nstructions1111111111111111111111111");new Wt("SysvarRecentB1ockHashes11111111111111111111");new Wt("SysvarRent111111111111111111111111111111111");new Wt("SysvarRewards111111111111111111111111111111"),new Wt("SysvarS1otHashes111111111111111111111111111"),new Wt("SysvarS1otHistory11111111111111111111111111"),new Wt("SysvarStakeHistory1111111111111111111111111");const FP=Qr("lamportsPerSignature");wt([bt("version"),bt("state"),tr("authorizedPubkey"),tr("nonce"),wt([FP],"feeCalculator")]).span;const Ra=r=>{const e=Ja(8,r),{encode:t,decode:n}=(o=>({decode:o.decode.bind(o),encode:o.encode.bind(o)}))(e),i=e;return i.decode=(o,s)=>{const a=n(o,s);return _P(_r.Buffer.from(a))},i.encode=(o,s,a)=>{const u=EP(o,8);return t(u,s,a)},i};Object.freeze({Create:{index:0,layout:wt([bt("instruction"),$n("lamports"),$n("space"),tr("programId")])},Assign:{index:1,layout:wt([bt("instruction"),tr("programId")])},Transfer:{index:2,layout:wt([bt("instruction"),Ra("lamports")])},CreateWithSeed:{index:3,layout:wt([bt("instruction"),tr("base"),va("seed"),$n("lamports"),$n("space"),tr("programId")])},AdvanceNonceAccount:{index:4,layout:wt([bt("instruction")])},WithdrawNonceAccount:{index:5,layout:wt([bt("instruction"),$n("lamports")])},InitializeNonceAccount:{index:6,layout:wt([bt("instruction"),tr("authorized")])},AuthorizeNonceAccount:{index:7,layout:wt([bt("instruction"),tr("authorized")])},Allocate:{index:8,layout:wt([bt("instruction"),$n("space")])},AllocateWithSeed:{index:9,layout:wt([bt("instruction"),tr("base"),va("seed"),$n("space"),tr("programId")])},AssignWithSeed:{index:10,layout:wt([bt("instruction"),tr("base"),va("seed"),tr("programId")])},TransferWithSeed:{index:11,layout:wt([bt("instruction"),Ra("lamports"),va("seed"),tr("programId")])},UpgradeNonceAccount:{index:12,layout:wt([bt("instruction")])}});new Wt("11111111111111111111111111111111"),new Wt("BPFLoader2111111111111111111111111111111111"),wt([bt("typeIndex"),Ra("deactivationSlot"),Qr("lastExtendedSlot"),Or("lastExtendedStartIndex"),Or(),ks(tr(),Ns(Or(),-1),"authority")]);const Fr=Qc(Pg(Wt),He(),r=>new Wt(r)),b4=Lg([He(),Ar("base64")]),Cg=Qc(Pg(_r.Buffer),b4,r=>_r.Buffer.from(r[0],"base64"));function v4(r){return Cn([Ie({jsonrpc:Ar("2.0"),id:He(),result:r}),Ie({jsonrpc:Ar("2.0"),id:He(),error:Ie({code:Xc(),message:He(),data:xt(Xs("any",()=>!0))})})])}const $P=v4(Xc());function fr(r){return Qc(v4(r),$P,e=>"error"in e?e:{...e,result:Sf(e.result,r)})}function ri(r){return fr(Ie({context:Ie({slot:le()}),value:r}))}function Bf(r){return Ie({context:Ie({slot:le()}),value:r})}const KP=Ie({foundation:le(),foundationTerm:le(),initial:le(),taper:le(),terminal:le()});fr(tt(et(Ie({epoch:le(),effectiveSlot:le(),amount:le(),postBalance:le(),commission:xt(et(le()))}))));const VP=tt(Ie({slot:le(),prioritizationFee:le()})),qP=Ie({total:le(),validator:le(),foundation:le(),epoch:le()}),HP=Ie({epoch:le(),slotIndex:le(),slotsInEpoch:le(),absoluteSlot:le(),blockHeight:xt(le()),transactionCount:xt(le())}),WP=Ie({slotsPerEpoch:le(),leaderScheduleSlotOffset:le(),warmup:Zi(),firstNormalEpoch:le(),firstNormalSlot:le()}),ZP=f4(He(),tt(le())),Vs=et(Cn([Ie({}),He()])),GP=Ie({err:Vs}),YP=Ar("receivedSignature");Ie({"solana-core":He(),"feature-set":xt(le())}),ri(Ie({err:et(Cn([Ie({}),He()])),logs:et(tt(He())),accounts:xt(et(tt(et(Ie({executable:Zi(),owner:He(),lamports:le(),data:tt(He()),rentEpoch:xt(le())}))))),unitsConsumed:xt(le()),returnData:xt(et(Ie({programId:He(),data:Lg([He(),Ar("base64")])})))})),ri(Ie({byIdentity:f4(He(),tt(le())),range:Ie({firstSlot:le(),lastSlot:le()})})),fr(KP),fr(qP),fr(VP),fr(HP),fr(WP),fr(ZP),fr(le()),ri(Ie({total:le(),circulating:le(),nonCirculating:le(),nonCirculatingAccounts:tt(Fr)}));const JP=Ie({amount:He(),uiAmount:et(le()),decimals:le(),uiAmountString:xt(He())});ri(tt(Ie({address:Fr,amount:He(),uiAmount:et(le()),decimals:le(),uiAmountString:xt(He())}))),ri(tt(Ie({pubkey:Fr,account:Ie({executable:Zi(),owner:Fr,lamports:le(),data:Cg,rentEpoch:le()})})));const Fp=Ie({program:He(),parsed:Xc(),space:le()});ri(tt(Ie({pubkey:Fr,account:Ie({executable:Zi(),owner:Fr,lamports:le(),data:Fp,rentEpoch:le()})}))),ri(tt(Ie({lamports:le(),address:Fr})));const Tg=Ie({executable:Zi(),owner:Fr,lamports:le(),data:Cg,rentEpoch:le()});Ie({pubkey:Fr,account:Tg});const XP=Qc(Cn([Pg(_r.Buffer),Fp]),Cn([b4,Fp]),r=>Array.isArray(r)?Sf(r,Cg):r),QP=Ie({executable:Zi(),owner:Fr,lamports:le(),data:XP,rentEpoch:le()});Ie({pubkey:Fr,account:QP}),Ie({state:Cn([Ar("active"),Ar("inactive"),Ar("activating"),Ar("deactivating")]),active:le(),inactive:le()}),fr(tt(Ie({signature:He(),slot:le(),err:Vs,memo:et(He()),blockTime:xt(et(le()))}))),fr(tt(Ie({signature:He(),slot:le(),err:Vs,memo:et(He()),blockTime:xt(et(le()))}))),Ie({subscription:le(),result:Bf(Tg)});const eL=Ie({pubkey:Fr,account:Tg});Ie({subscription:le(),result:Bf(eL)});const tL=Ie({parent:le(),slot:le(),root:le()});Ie({subscription:le(),result:tL});const rL=Cn([Ie({type:Cn([Ar("firstShredReceived"),Ar("completed"),Ar("optimisticConfirmation"),Ar("root")]),slot:le(),timestamp:le()}),Ie({type:Ar("createdBank"),parent:le(),slot:le(),timestamp:le()}),Ie({type:Ar("frozen"),slot:le(),timestamp:le(),stats:Ie({numTransactionEntries:le(),numSuccessfulTransactions:le(),numFailedTransactions:le(),maxTransactionsPerEntry:le()})}),Ie({type:Ar("dead"),slot:le(),timestamp:le(),err:He()})]);Ie({subscription:le(),result:rL}),Ie({subscription:le(),result:Bf(Cn([GP,YP]))}),Ie({subscription:le(),result:le()}),Ie({pubkey:He(),gossip:et(He()),tpu:et(He()),rpc:et(He()),version:et(He())});const zb=Ie({votePubkey:He(),nodePubkey:He(),activatedStake:le(),epochVoteAccount:Zi(),epochCredits:tt(Lg([le(),le(),le()])),commission:le(),lastVote:le(),rootSlot:et(le())});fr(Ie({current:tt(zb),delinquent:tt(zb)}));const nL=Cn([Ar("processed"),Ar("confirmed"),Ar("finalized")]),iL=Ie({slot:le(),confirmations:et(le()),err:Vs,confirmationStatus:xt(nL)});ri(tt(et(iL))),fr(le());const _4=Ie({accountKey:Fr,writableIndexes:tt(le()),readonlyIndexes:tt(le())}),s0=Ie({signatures:tt(He()),message:Ie({accountKeys:tt(He()),header:Ie({numRequiredSignatures:le(),numReadonlySignedAccounts:le(),numReadonlyUnsignedAccounts:le()}),instructions:tt(Ie({accounts:tt(le()),data:He(),programIdIndex:le()})),recentBlockhash:He(),addressTableLookups:xt(tt(_4))})}),E4=Ie({pubkey:Fr,signer:Zi(),writable:Zi(),source:xt(Cn([Ar("transaction"),Ar("lookupTable")]))}),jb=Ie({accountKeys:tt(E4),signatures:tt(He())}),Fb=Ie({parsed:Xc(),program:He(),programId:Fr}),$b=Ie({accounts:tt(Fr),data:He(),programId:Fr}),x4=Qc(Cn([$b,Fb]),Cn([Ie({parsed:Xc(),program:He(),programId:He()}),Ie({accounts:tt(He()),data:He(),programId:He()})]),r=>Sf(r,"accounts"in r?$b:Fb)),Kb=Ie({signatures:tt(He()),message:Ie({accountKeys:tt(E4),instructions:tt(x4),recentBlockhash:He(),addressTableLookups:xt(et(tt(_4)))})}),Ph=Ie({accountIndex:le(),mint:He(),owner:xt(He()),uiTokenAmount:JP}),A4=Ie({writable:tt(Fr),readonly:tt(Fr)}),Rl=Ie({err:Vs,fee:le(),innerInstructions:xt(et(tt(Ie({index:le(),instructions:tt(Ie({accounts:tt(le()),data:He(),programIdIndex:le()}))})))),preBalances:tt(le()),postBalances:tt(le()),logMessages:xt(et(tt(He()))),preTokenBalances:xt(et(tt(Ph))),postTokenBalances:xt(et(tt(Ph))),loadedAddresses:xt(A4),computeUnitsConsumed:xt(le())}),a0=Ie({err:Vs,fee:le(),innerInstructions:xt(et(tt(Ie({index:le(),instructions:tt(x4)})))),preBalances:tt(le()),postBalances:tt(le()),logMessages:xt(et(tt(He()))),preTokenBalances:xt(et(tt(Ph))),postTokenBalances:xt(et(tt(Ph))),loadedAddresses:xt(A4),computeUnitsConsumed:xt(le())}),sa=Cn([Ar(0),Ar("legacy")]),cs=Ie({pubkey:He(),lamports:le(),postBalance:et(le()),rewardType:et(He()),commission:xt(et(le()))});fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),transactions:tt(Ie({transaction:s0,meta:et(Rl),version:xt(sa)})),rewards:xt(tt(cs)),blockTime:et(le()),blockHeight:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),rewards:xt(tt(cs)),blockTime:et(le()),blockHeight:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),transactions:tt(Ie({transaction:jb,meta:et(Rl),version:xt(sa)})),rewards:xt(tt(cs)),blockTime:et(le()),blockHeight:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),transactions:tt(Ie({transaction:Kb,meta:et(a0),version:xt(sa)})),rewards:xt(tt(cs)),blockTime:et(le()),blockHeight:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),transactions:tt(Ie({transaction:jb,meta:et(a0),version:xt(sa)})),rewards:xt(tt(cs)),blockTime:et(le()),blockHeight:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),rewards:xt(tt(cs)),blockTime:et(le()),blockHeight:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),transactions:tt(Ie({transaction:s0,meta:et(Rl)})),rewards:xt(tt(cs)),blockTime:et(le())}))),fr(et(Ie({blockhash:He(),previousBlockhash:He(),parentSlot:le(),signatures:tt(He()),blockTime:et(le())}))),fr(et(Ie({slot:le(),meta:Rl,blockTime:xt(et(le())),transaction:s0,version:xt(sa)}))),fr(et(Ie({slot:le(),transaction:Kb,meta:et(a0),blockTime:xt(et(le())),version:xt(sa)}))),ri(Ie({blockhash:He(),feeCalculator:Ie({lamportsPerSignature:le()})})),ri(Ie({blockhash:He(),lastValidBlockHeight:le()})),ri(Zi()),fr(tt(Ie({slot:le(),numTransactions:le(),numSlots:le(),samplePeriodSecs:le()}))),ri(et(Ie({feeCalculator:Ie({lamportsPerSignature:le()})}))),fr(He()),fr(He());const oL=Ie({err:Vs,logs:tt(He()),signature:He()});var Vb;Ie({result:Bf(oL),subscription:le()}),Object.freeze({CreateLookupTable:{index:0,layout:wt([bt("instruction"),Ra("recentSlot"),Or("bumpSeed")])},FreezeLookupTable:{index:1,layout:wt([bt("instruction")])},ExtendLookupTable:{index:2,layout:wt([bt("instruction"),Ra(),ks(tr(),Ns(bt(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:wt([bt("instruction")])},CloseLookupTable:{index:4,layout:wt([bt("instruction")])}}),new Wt("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:wt([Or("instruction"),bt("units"),bt("additionalFee")])},RequestHeapFrame:{index:1,layout:wt([Or("instruction"),bt("bytes")])},SetComputeUnitLimit:{index:2,layout:wt([Or("instruction"),bt("units")])},SetComputeUnitPrice:{index:3,layout:wt([Or("instruction"),Ra("microLamports")])}}),new Wt("ComputeBudget111111111111111111111111111111"),wt([Or("numSignatures"),Or("padding"),Gn("signatureOffset"),Gn("signatureInstructionIndex"),Gn("publicKeyOffset"),Gn("publicKeyInstructionIndex"),Gn("messageDataOffset"),Gn("messageDataSize"),Gn("messageInstructionIndex")]),new Wt("Ed25519SigVerify111111111111111111111111111"),jp.utils.isValidPrivateKey,jp.getPublicKey,wt([Or("numSignatures"),Gn("signatureOffset"),Or("signatureInstructionIndex"),Gn("ethAddressOffset"),Or("ethAddressInstructionIndex"),Gn("messageDataOffset"),Gn("messageDataSize"),Or("messageInstructionIndex"),Ja(20,"ethAddress"),Ja(64,"signature"),Or("recoveryId")]),new Wt("KeccakSecp256k11111111111111111111111111111"),new Wt("StakeConfig11111111111111111111111111111111");class qb{constructor(e,t,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=n}}Vb=qb,qb.default=new Vb(0,0,Wt.default),Object.freeze({Initialize:{index:0,layout:wt([bt("instruction"),((r="authorized")=>wt([tr("staker"),tr("withdrawer")],r))(),((r="lockup")=>wt([$n("unixTimestamp"),$n("epoch"),tr("custodian")],r))()])},Authorize:{index:1,layout:wt([bt("instruction"),tr("newAuthorized"),bt("stakeAuthorizationType")])},Delegate:{index:2,layout:wt([bt("instruction")])},Split:{index:3,layout:wt([bt("instruction"),$n("lamports")])},Withdraw:{index:4,layout:wt([bt("instruction"),$n("lamports")])},Deactivate:{index:5,layout:wt([bt("instruction")])},Merge:{index:7,layout:wt([bt("instruction")])},AuthorizeWithSeed:{index:8,layout:wt([bt("instruction"),tr("newAuthorized"),bt("stakeAuthorizationType"),va("authoritySeed"),tr("authorityOwner")])}}),new Wt("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:wt([bt("instruction"),((r="voteInit")=>wt([tr("nodePubkey"),tr("authorizedVoter"),tr("authorizedWithdrawer"),Or("commission")],r))()])},Authorize:{index:1,layout:wt([bt("instruction"),tr("newAuthorized"),bt("voteAuthorizationType")])},Withdraw:{index:3,layout:wt([bt("instruction"),$n("lamports")])},AuthorizeWithSeed:{index:10,layout:wt([bt("instruction"),((r="voteAuthorizeWithSeedArgs")=>wt([bt("voteAuthorizationType"),tr("currentAuthorityDerivedKeyOwnerPubkey"),va("currentAuthorityDerivedKeySeed"),tr("newAuthorized")],r))()])}}),new Wt("Vote111111111111111111111111111111111111111"),new Wt("Va1idator1nfo111111111111111111111111111111"),Ie({name:He(),website:xt(He()),details:xt(He()),keybaseUsername:xt(He())}),new Wt("Vote111111111111111111111111111111111111111"),wt([tr("nodePubkey"),tr("authorizedWithdrawer"),Or("commission"),Qr(),ks(wt([Qr("slot"),bt("confirmationCount")]),Ns(bt(),-8),"votes"),Or("rootSlotValid"),Qr("rootSlot"),Qr(),ks(wt([Qr("epoch"),tr("authorizedVoter")]),Ns(bt(),-8),"authorizedVoters"),wt([ks(wt([tr("authorizedPubkey"),Qr("epochOfLastAuthorizedSwitch"),Qr("targetEpoch")]),32,"buf"),Qr("idx"),Or("isEmpty")],"priorVoters"),Qr(),ks(wt([Qr("epoch"),Qr("credits"),Qr("prevCredits")]),Ns(bt(),-8),"epochCredits"),wt([Qr("slot"),Qr("timestamp")],"lastTimestamp")]);var Ul,sL=(Ul=function(r,e){return Ul=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ul(r,e)},function(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=r}Ul(r,e),r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)});(function(r){function e(t,n){var i="Invalid schema: ".concat(JSON.stringify(t)," expected ").concat(n);return r.call(this,i)||this}return sL(e,r),e})(Error);const Hb=new Wt("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ"),[aL]=Wt.findProgramAddressSync([Hb.toBuffer()],Hb);var Wb;(function(r){r[r.None=0]="None",r[r.Solana=1]="Solana",r[r.Ethereum=2]="Ethereum",r[r.UnverifiedSolana=3]="UnverifiedSolana"})(Wb||(Wb={}));var qt;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(qt||(qt={}));qt.SOL,qt.ETH,qt.BSC,qt.Injective,qt.A,qt.AAAA,qt.Background;var $p;(function(r){r[r.V1=1]="V1",r[r.V2=2]="V2"})($p||($p={}));const Kp=r=>{const e=U9+r,t=R9(Ze.Buffer.from(e,"utf8")).slice(2);return Ze.Buffer.from(t,"hex")},Vp=(r,e,t)=>{const n=[r];e?n.push(e.toBuffer()):n.push(Ze.Buffer.alloc(32)),t?n.push(t.toBuffer()):n.push(Ze.Buffer.alloc(32));const[i]=ye.findProgramAddressSync(n,U3);return i},aa=(r,e=wh,t)=>{let n=Kp(r);return{pubkey:Vp(n,t,e),hashed:n}},qp=(r,e)=>{r.endsWith(".sol")&&(r=r.slice(0,-4));const t=r.split(".");if(t.length===2){const n=Ze.Buffer.from([e||0]).toString().concat(t[0]),{pubkey:i}=aa(t[1]);return{...aa(n,i,e===$p.V2?aL:void 0),isSub:!0,parent:i}}if(t.length===3&&e){const{pubkey:n}=aa(t[2]),{pubkey:i}=aa("\0".concat(t[1]),n),o=Ze.Buffer.from([1]).toString();return{...aa(o.concat(t[0]),i),isSub:!0,parent:n,isSubRecord:!0}}if(t.length>=3)throw new gc(pc.InvalidInput);return{...aa(r,wh),isSub:!1,parent:void 0}};var _o={},_a={};function Zb(r,e,t,n,i){var o=(1<=n;)a-=n,t[u]=s>>a&o,u+=1}),i)a>0&&(t[u]=s<=e)throw new Error("Excessive padding: ".concat(a," (max ").concat(e-1," allowed)"));if(s%(1<8||e<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return Zb(r,e,t,8,!1),t},_a.toBits=function(r,e,t){if(e>8||e<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return Zb(r,8,t,e,!0),t};var fi={};Object.defineProperty(fi,"__esModule",{value:!0}),fi.CHECKSUM_LENGTH=void 0,fi.createChecksum=function(r,e){var t;switch(e){case"bech32":t=1;break;case"bech32m":t=Gb;break;default:throw Error("Invalid encoding value: ".concat(e,"; expected bech32 or bech32m"))}for(var n=Xb(r)^t,i=0;i>o&31}},fi.decode=ev,fi.decodeWithPrefix=function(r,e){var t=e.length+2*r.length+1,n=(0,k4.createBitArray)(t);return Qb(r,n.subarray(0,2*r.length+1)),ev(e,n.subarray(2*r.length+1)),n},fi.detectCase=function(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"message",t=!1,n=!1,i=0;iJb)throw new TypeError("Invalid char in ".concat(e,": ").concat(o,"; ")+"should be in ASCII range ".concat(Yb,"-").concat(Jb));n=n||o>=65&&o<=90,t=t||o>=97&&o<=122}if(t&&n)throw new TypeError("Mixed-case ".concat(e));return n?"upper":t?"lower":null},fi.encode=function(r){return r.reduce(function(e,t){return e+Hp[t]},"")},fi.expandPrefix=Qb,fi.verifyChecksum=function(r){switch(Xb(r)){case 1:return"bech32";case Gb:return"bech32m";default:return}};var k4=_a,Hp="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Gb=734539939,Yb=33,Jb=126,Wp=6;fi.CHECKSUM_LENGTH=Wp;var uL=function(){for(var r=new Map,e=0;e>25,i=(33554431&e)<<5^t;return cL.reduce(function(o,s,a){return n>>a&1?o^s:o},i)},1)}function Qb(r,e){for(var t=0;t>5,e[t+r.length+1]=31&n}e[r.length]=0}function ev(r,e){for(var t=e||(0,k4.createBitArray)(r.length),n=0;n2&&arguments[2]!==void 0?arguments[2]:"bech32";return Ug(r,Og(e),t)};_o.encode5BitArray=Ug,_o.from5BitArray=Rg,_o.to5BitArray=Og;var Ac=_a,ei=fi;function tv(r,e){for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:"bech32",i=2*r.length+1+e.length+ei.CHECKSUM_LENGTH;if(i-r.length>Lh)throw new Error("Message to be produced is too long (max ".concat(Lh," supported)"));var o=(t=(0,ei.detectCase)(r,"prefix"))!==null&&t!==void 0?t:"lower",s=(0,Ac.createBitArray)(i);(0,ei.expandPrefix)(r.toLowerCase(),s.subarray(0,2*r.length+1)),s.subarray(2*r.length+1,s.length-ei.CHECKSUM_LENGTH).set(e),(0,ei.createChecksum)(s,n);var a=(0,ei.encode)(s.subarray(2*r.length+1));return o==="upper"&&(a=a.toUpperCase()),"".concat(r,"1").concat(a)}function Ng(r){if(r.length>Lh)throw new TypeError("Message too long; max ".concat(Lh," expected"));(0,ei.detectCase)(r);var e=r.toLowerCase(),t=e.lastIndexOf("1");if(t<0)throw new Error('No separator char ("1") found');if(t>r.length-ei.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(ei.CHECKSUM_LENGTH," chars expected)"));var n=e.substring(0,t),i=(0,ei.decodeWithPrefix)(n,e.substring(t+1)),o=(0,ei.verifyChecksum)(i);if(o===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:o,data:i.subarray(2*n.length+1,i.length-ei.CHECKSUM_LENGTH)}}var lL=function(){function r(i,o,s){if(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}(this,r),i!=="bc"&&i!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(o<0||o>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(s.length<2||s.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(o===0&&s.length!==20&&s.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=i,this.scriptVersion=o,this.data=s}var e,t,n;return e=r,t=[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var i=Math.ceil(8*this.data.length/5),o=(0,Ac.createBitArray)(i+1);o[0]=this.scriptVersion,Og(this.data,o.subarray(1));var s=this.scriptVersion===0?"bech32":"bech32m";return Ug(this.prefix,o,s)}}],n=[{key:"decode",value:function(i){var o=Ng(i),s=o.prefix,a=o.data,u=o.encoding;if(s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var l=a[0];if(l===0&&u!=="bech32")throw Error("Unexpected encoding ".concat(u," used for version 0 script"));if(l>0&&u!=="bech32m")throw Error("Unexpected encoding ".concat(u," used for version ").concat(l," script"));return new this(s,l,Rg(a.subarray(1)))}}],t&&tv(e.prototype,t),n&&tv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),r}();_o.BitcoinAddress=lL;var S4={exports:{}};(function(r){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function l(w,v){if(w.indexOf("::")!==w.lastIndexOf("::"))return null;let A,I,B=0,S=-1,P=(w.match(u.zoneIndex)||[])[0];for(P&&(P=P.substring(1),w=w.replace(/%.+$/,""));(S=w.indexOf(":",S+1))>=0;)B++;if(w.substr(0,2)==="::"&&B--,w.substr(-2,2)==="::"&&B--,B>v)return null;for(I=v-B,A=":";I--;)A+="0:";return(w=w.replace("::",A))[0]===":"&&(w=w.slice(1)),w[w.length-1]===":"&&(w=w.slice(0,-1)),v=function(){const C=w.split(":"),R=[];for(let j=0;j0;){if(B=A-I,B<0&&(B=0),w[S]>>B!=v[S]>>B)return!1;I-=A,S+=1}return!0}function _(w){if(o.test(w))return parseInt(w,16);if(w[0]==="0"&&!isNaN(parseInt(w[1],10))){if(i.test(w))return parseInt(w,8);throw new Error(`ipaddr: cannot parse ${w} as octal`)}return parseInt(w,10)}function E(w,v){for(;w.length=0;B-=1){if(S=this.octets[B],!(S in I)||(P=I[S],A&&P!==0))return null;P!==8&&(A=!0),v+=P}return 32-v},w.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},w.prototype.toByteArray=function(){return this.octets.slice(0)},w.prototype.toIPv4MappedAddress=function(){return m.IPv6.parse(`::ffff:${this.toString()}`)},w.prototype.toNormalizedString=function(){return this.toString()},w.prototype.toString=function(){return this.octets.join(".")},w}(),m.IPv4.broadcastAddressFromCIDR=function(w){try{const v=this.parseCIDR(w),A=v[0].toByteArray(),I=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),B=[];let S=0;for(;S<4;)B.push(parseInt(A[S],10)|255^parseInt(I[S],10)),S++;return new this(B)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.isIPv4=function(w){return this.parser(w)!==null},m.IPv4.isValid=function(w){try{return new this(this.parser(w)),!0}catch{return!1}},m.IPv4.isValidFourPartDecimal=function(w){return!(!m.IPv4.isValid(w)||!w.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},m.IPv4.networkAddressFromCIDR=function(w){let v,A,I,B,S;try{for(v=this.parseCIDR(w),I=v[0].toByteArray(),S=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),B=[],A=0;A<4;)B.push(parseInt(I[A],10)&parseInt(S[A],10)),A++;return new this(B)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.parse=function(w){const v=this.parser(w);if(v===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(v)},m.IPv4.parseCIDR=function(w){let v;if(v=w.match(/^(.+)\/(\d+)$/)){const A=parseInt(v[2]);if(A>=0&&A<=32){const I=[this.parse(v[1]),A];return Object.defineProperty(I,"toString",{value:function(){return this.join("/")}}),I}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},m.IPv4.parser=function(w){let v,A,I;if(v=w.match(n.fourOctet))return function(){const B=v.slice(1,6),S=[];for(let P=0;P4294967295||I<0)throw new Error("ipaddr: address outside defined range");return function(){const B=[];let S;for(S=0;S<=24;S+=8)B.push(I>>S&255);return B}().reverse()}return(v=w.match(n.twoOctet))?function(){const B=v.slice(1,4),S=[];if(I=_(B[1]),I>16777215||I<0)throw new Error("ipaddr: address outside defined range");return S.push(_(B[0])),S.push(I>>16&255),S.push(I>>8&255),S.push(255&I),S}():(v=w.match(n.threeOctet))?function(){const B=v.slice(1,5),S=[];if(I=_(B[2]),I>65535||I<0)throw new Error("ipaddr: address outside defined range");return S.push(_(B[0])),S.push(_(B[1])),S.push(I>>8&255),S.push(255&I),S}():null},m.IPv4.subnetMaskFromPrefixLength=function(w){if((w=parseInt(w))<0||w>32)throw new Error("ipaddr: invalid IPv4 prefix length");const v=[0,0,0,0];let A=0;const I=Math.floor(w/8);for(;A=0;P-=1){if(B=this.parts[P],!(B in I)||(S=I[B],A&&S!==0))return null;S!==16&&(A=!0),v+=S}return 128-v},w.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},w.prototype.toByteArray=function(){let v;const A=[],I=this.parts;for(let B=0;B>8),A.push(255&v);return A},w.prototype.toFixedLengthString=function(){const v=(function(){const I=[];for(let B=0;B>8,255&A,I>>8,255&I])},w.prototype.toNormalizedString=function(){const v=(function(){const I=[];for(let B=0;BS&&(B=I.index,S=I[0].length);return S<0?A:`${A.substring(0,B)}::${A.substring(B+S)}`},w.prototype.toString=function(){return this.toRFC5952String()},w}(),m.IPv6.broadcastAddressFromCIDR=function(w){try{const v=this.parseCIDR(w),A=v[0].toByteArray(),I=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),B=[];let S=0;for(;S<16;)B.push(parseInt(A[S],10)|255^parseInt(I[S],10)),S++;return new this(B)}catch(v){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${v})`)}},m.IPv6.isIPv6=function(w){return this.parser(w)!==null},m.IPv6.isValid=function(w){if(typeof w=="string"&&w.indexOf(":")===-1)return!1;try{const v=this.parser(w);return new this(v.parts,v.zoneId),!0}catch{return!1}},m.IPv6.networkAddressFromCIDR=function(w){let v,A,I,B,S;try{for(v=this.parseCIDR(w),I=v[0].toByteArray(),S=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),B=[],A=0;A<16;)B.push(parseInt(I[A],10)&parseInt(S[A],10)),A++;return new this(B)}catch(P){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${P})`)}},m.IPv6.parse=function(w){const v=this.parser(w);if(v.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(v.parts,v.zoneId)},m.IPv6.parseCIDR=function(w){let v,A,I;if((A=w.match(/^(.+)\/(\d+)$/))&&(v=parseInt(A[2]),v>=0&&v<=128))return I=[this.parse(A[1]),v],Object.defineProperty(I,"toString",{value:function(){return this.join("/")}}),I;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},m.IPv6.parser=function(w){let v,A,I,B,S,P;if(I=w.match(u.deprecatedTransitional))return this.parser(`::ffff:${I[1]}`);if(u.native.test(w))return l(w,8);if((I=w.match(u.transitional))&&(P=I[6]||"",v=l(I[1].slice(0,-1)+P,6),v.parts)){for(S=[parseInt(I[2]),parseInt(I[3]),parseInt(I[4]),parseInt(I[5])],A=0;A128)throw new Error("ipaddr: invalid IPv6 prefix length");const v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let A=0;const I=Math.floor(w/8);for(;A>24&255,z[D+1]=q>>16&255,z[D+2]=q>>8&255,z[D+3]=255&q,z[D+4]=M>>24&255,z[D+5]=M>>16&255,z[D+6]=M>>8&255,z[D+7]=255&M}function w(z,D,q,M,O){var Q,re=0;for(Q=0;Q>>8)-1}function v(z,D,q,M){return w(z,D,q,M,16)}function A(z,D,q,M){return w(z,D,q,M,32)}function I(z,D,q,M){(function(O,Q,re,ue){for(var J,De=255&ue[0]|(255&ue[1])<<8|(255&ue[2])<<16|(255&ue[3])<<24,Pe=255&re[0]|(255&re[1])<<8|(255&re[2])<<16|(255&re[3])<<24,Ee=255&re[4]|(255&re[5])<<8|(255&re[6])<<16|(255&re[7])<<24,st=255&re[8]|(255&re[9])<<8|(255&re[10])<<16|(255&re[11])<<24,Le=255&re[12]|(255&re[13])<<8|(255&re[14])<<16|(255&re[15])<<24,ke=255&ue[4]|(255&ue[5])<<8|(255&ue[6])<<16|(255&ue[7])<<24,ut=255&Q[0]|(255&Q[1])<<8|(255&Q[2])<<16|(255&Q[3])<<24,Ne=255&Q[4]|(255&Q[5])<<8|(255&Q[6])<<16|(255&Q[7])<<24,Ue=255&Q[8]|(255&Q[9])<<8|(255&Q[10])<<16|(255&Q[11])<<24,ht=255&Q[12]|(255&Q[13])<<8|(255&Q[14])<<16|(255&Q[15])<<24,Re=255&ue[8]|(255&ue[9])<<8|(255&ue[10])<<16|(255&ue[11])<<24,Se=255&re[16]|(255&re[17])<<8|(255&re[18])<<16|(255&re[19])<<24,ct=255&re[20]|(255&re[21])<<8|(255&re[22])<<16|(255&re[23])<<24,qe=255&re[24]|(255&re[25])<<8|(255&re[26])<<16|(255&re[27])<<24,Me=255&re[28]|(255&re[29])<<8|(255&re[30])<<16|(255&re[31])<<24,_e=255&ue[12]|(255&ue[13])<<8|(255&ue[14])<<16|(255&ue[15])<<24,pe=De,ve=Pe,Ce=Ee,Te=st,ze=Le,kt=ke,St=ut,Et=Ne,Ct=Ue,Dt=ht,zt=Re,at=Se,yt=ct,mt=qe,_t=Me,it=_e,It=0;It<20;It+=2)pe^=(J=(yt^=(J=(Ct^=(J=(ze^=(J=pe+yt|0)<<7|J>>>25)+pe|0)<<9|J>>>23)+ze|0)<<13|J>>>19)+Ct|0)<<18|J>>>14,kt^=(J=(ve^=(J=(mt^=(J=(Dt^=(J=kt+ve|0)<<7|J>>>25)+kt|0)<<9|J>>>23)+Dt|0)<<13|J>>>19)+mt|0)<<18|J>>>14,zt^=(J=(St^=(J=(Ce^=(J=(_t^=(J=zt+St|0)<<7|J>>>25)+zt|0)<<9|J>>>23)+_t|0)<<13|J>>>19)+Ce|0)<<18|J>>>14,it^=(J=(at^=(J=(Et^=(J=(Te^=(J=it+at|0)<<7|J>>>25)+it|0)<<9|J>>>23)+Te|0)<<13|J>>>19)+Et|0)<<18|J>>>14,pe^=(J=(Te^=(J=(Ce^=(J=(ve^=(J=pe+Te|0)<<7|J>>>25)+pe|0)<<9|J>>>23)+ve|0)<<13|J>>>19)+Ce|0)<<18|J>>>14,kt^=(J=(ze^=(J=(Et^=(J=(St^=(J=kt+ze|0)<<7|J>>>25)+kt|0)<<9|J>>>23)+St|0)<<13|J>>>19)+Et|0)<<18|J>>>14,zt^=(J=(Dt^=(J=(Ct^=(J=(at^=(J=zt+Dt|0)<<7|J>>>25)+zt|0)<<9|J>>>23)+at|0)<<13|J>>>19)+Ct|0)<<18|J>>>14,it^=(J=(_t^=(J=(mt^=(J=(yt^=(J=it+_t|0)<<7|J>>>25)+it|0)<<9|J>>>23)+yt|0)<<13|J>>>19)+mt|0)<<18|J>>>14;pe=pe+De|0,ve=ve+Pe|0,Ce=Ce+Ee|0,Te=Te+st|0,ze=ze+Le|0,kt=kt+ke|0,St=St+ut|0,Et=Et+Ne|0,Ct=Ct+Ue|0,Dt=Dt+ht|0,zt=zt+Re|0,at=at+Se|0,yt=yt+ct|0,mt=mt+qe|0,_t=_t+Me|0,it=it+_e|0,O[0]=pe>>>0&255,O[1]=pe>>>8&255,O[2]=pe>>>16&255,O[3]=pe>>>24&255,O[4]=ve>>>0&255,O[5]=ve>>>8&255,O[6]=ve>>>16&255,O[7]=ve>>>24&255,O[8]=Ce>>>0&255,O[9]=Ce>>>8&255,O[10]=Ce>>>16&255,O[11]=Ce>>>24&255,O[12]=Te>>>0&255,O[13]=Te>>>8&255,O[14]=Te>>>16&255,O[15]=Te>>>24&255,O[16]=ze>>>0&255,O[17]=ze>>>8&255,O[18]=ze>>>16&255,O[19]=ze>>>24&255,O[20]=kt>>>0&255,O[21]=kt>>>8&255,O[22]=kt>>>16&255,O[23]=kt>>>24&255,O[24]=St>>>0&255,O[25]=St>>>8&255,O[26]=St>>>16&255,O[27]=St>>>24&255,O[28]=Et>>>0&255,O[29]=Et>>>8&255,O[30]=Et>>>16&255,O[31]=Et>>>24&255,O[32]=Ct>>>0&255,O[33]=Ct>>>8&255,O[34]=Ct>>>16&255,O[35]=Ct>>>24&255,O[36]=Dt>>>0&255,O[37]=Dt>>>8&255,O[38]=Dt>>>16&255,O[39]=Dt>>>24&255,O[40]=zt>>>0&255,O[41]=zt>>>8&255,O[42]=zt>>>16&255,O[43]=zt>>>24&255,O[44]=at>>>0&255,O[45]=at>>>8&255,O[46]=at>>>16&255,O[47]=at>>>24&255,O[48]=yt>>>0&255,O[49]=yt>>>8&255,O[50]=yt>>>16&255,O[51]=yt>>>24&255,O[52]=mt>>>0&255,O[53]=mt>>>8&255,O[54]=mt>>>16&255,O[55]=mt>>>24&255,O[56]=_t>>>0&255,O[57]=_t>>>8&255,O[58]=_t>>>16&255,O[59]=_t>>>24&255,O[60]=it>>>0&255,O[61]=it>>>8&255,O[62]=it>>>16&255,O[63]=it>>>24&255})(z,D,q,M)}function B(z,D,q,M){(function(O,Q,re,ue){for(var J,De=255&ue[0]|(255&ue[1])<<8|(255&ue[2])<<16|(255&ue[3])<<24,Pe=255&re[0]|(255&re[1])<<8|(255&re[2])<<16|(255&re[3])<<24,Ee=255&re[4]|(255&re[5])<<8|(255&re[6])<<16|(255&re[7])<<24,st=255&re[8]|(255&re[9])<<8|(255&re[10])<<16|(255&re[11])<<24,Le=255&re[12]|(255&re[13])<<8|(255&re[14])<<16|(255&re[15])<<24,ke=255&ue[4]|(255&ue[5])<<8|(255&ue[6])<<16|(255&ue[7])<<24,ut=255&Q[0]|(255&Q[1])<<8|(255&Q[2])<<16|(255&Q[3])<<24,Ne=255&Q[4]|(255&Q[5])<<8|(255&Q[6])<<16|(255&Q[7])<<24,Ue=255&Q[8]|(255&Q[9])<<8|(255&Q[10])<<16|(255&Q[11])<<24,ht=255&Q[12]|(255&Q[13])<<8|(255&Q[14])<<16|(255&Q[15])<<24,Re=255&ue[8]|(255&ue[9])<<8|(255&ue[10])<<16|(255&ue[11])<<24,Se=255&re[16]|(255&re[17])<<8|(255&re[18])<<16|(255&re[19])<<24,ct=255&re[20]|(255&re[21])<<8|(255&re[22])<<16|(255&re[23])<<24,qe=255&re[24]|(255&re[25])<<8|(255&re[26])<<16|(255&re[27])<<24,Me=255&re[28]|(255&re[29])<<8|(255&re[30])<<16|(255&re[31])<<24,_e=255&ue[12]|(255&ue[13])<<8|(255&ue[14])<<16|(255&ue[15])<<24,pe=0;pe<20;pe+=2)De^=(J=(ct^=(J=(Ue^=(J=(Le^=(J=De+ct|0)<<7|J>>>25)+De|0)<<9|J>>>23)+Le|0)<<13|J>>>19)+Ue|0)<<18|J>>>14,ke^=(J=(Pe^=(J=(qe^=(J=(ht^=(J=ke+Pe|0)<<7|J>>>25)+ke|0)<<9|J>>>23)+ht|0)<<13|J>>>19)+qe|0)<<18|J>>>14,Re^=(J=(ut^=(J=(Ee^=(J=(Me^=(J=Re+ut|0)<<7|J>>>25)+Re|0)<<9|J>>>23)+Me|0)<<13|J>>>19)+Ee|0)<<18|J>>>14,_e^=(J=(Se^=(J=(Ne^=(J=(st^=(J=_e+Se|0)<<7|J>>>25)+_e|0)<<9|J>>>23)+st|0)<<13|J>>>19)+Ne|0)<<18|J>>>14,De^=(J=(st^=(J=(Ee^=(J=(Pe^=(J=De+st|0)<<7|J>>>25)+De|0)<<9|J>>>23)+Pe|0)<<13|J>>>19)+Ee|0)<<18|J>>>14,ke^=(J=(Le^=(J=(Ne^=(J=(ut^=(J=ke+Le|0)<<7|J>>>25)+ke|0)<<9|J>>>23)+ut|0)<<13|J>>>19)+Ne|0)<<18|J>>>14,Re^=(J=(ht^=(J=(Ue^=(J=(Se^=(J=Re+ht|0)<<7|J>>>25)+Re|0)<<9|J>>>23)+Se|0)<<13|J>>>19)+Ue|0)<<18|J>>>14,_e^=(J=(Me^=(J=(qe^=(J=(ct^=(J=_e+Me|0)<<7|J>>>25)+_e|0)<<9|J>>>23)+ct|0)<<13|J>>>19)+qe|0)<<18|J>>>14;O[0]=De>>>0&255,O[1]=De>>>8&255,O[2]=De>>>16&255,O[3]=De>>>24&255,O[4]=ke>>>0&255,O[5]=ke>>>8&255,O[6]=ke>>>16&255,O[7]=ke>>>24&255,O[8]=Re>>>0&255,O[9]=Re>>>8&255,O[10]=Re>>>16&255,O[11]=Re>>>24&255,O[12]=_e>>>0&255,O[13]=_e>>>8&255,O[14]=_e>>>16&255,O[15]=_e>>>24&255,O[16]=ut>>>0&255,O[17]=ut>>>8&255,O[18]=ut>>>16&255,O[19]=ut>>>24&255,O[20]=Ne>>>0&255,O[21]=Ne>>>8&255,O[22]=Ne>>>16&255,O[23]=Ne>>>24&255,O[24]=Ue>>>0&255,O[25]=Ue>>>8&255,O[26]=Ue>>>16&255,O[27]=Ue>>>24&255,O[28]=ht>>>0&255,O[29]=ht>>>8&255,O[30]=ht>>>16&255,O[31]=ht>>>24&255})(z,D,q,M)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function P(z,D,q,M,O,Q,re){var ue,J,De=new Uint8Array(16),Pe=new Uint8Array(64);for(J=0;J<16;J++)De[J]=0;for(J=0;J<8;J++)De[J]=Q[J];for(;O>=64;){for(I(Pe,De,re,S),J=0;J<64;J++)z[D+J]=q[M+J]^Pe[J];for(ue=1,J=8;J<16;J++)ue=ue+(255&De[J])|0,De[J]=255&ue,ue>>>=8;O-=64,D+=64,M+=64}if(O>0)for(I(Pe,De,re,S),J=0;J=64;){for(I(J,ue,O,S),re=0;re<64;re++)z[D+re]=J[re];for(Q=1,re=8;re<16;re++)Q=Q+(255&ue[re])|0,ue[re]=255&Q,Q>>>=8;q-=64,D+=64}if(q>0)for(I(J,ue,O,S),re=0;re>>13|q<<3),M=255&z[4]|(255&z[5])<<8,this.r[2]=7939&(q>>>10|M<<6),O=255&z[6]|(255&z[7])<<8,this.r[3]=8191&(M>>>7|O<<9),Q=255&z[8]|(255&z[9])<<8,this.r[4]=255&(O>>>4|Q<<12),this.r[5]=Q>>>1&8190,re=255&z[10]|(255&z[11])<<8,this.r[6]=8191&(Q>>>14|re<<2),ue=255&z[12]|(255&z[13])<<8,this.r[7]=8065&(re>>>11|ue<<5),J=255&z[14]|(255&z[15])<<8,this.r[8]=8191&(ue>>>8|J<<8),this.r[9]=J>>>5&127,this.pad[0]=255&z[16]|(255&z[17])<<8,this.pad[1]=255&z[18]|(255&z[19])<<8,this.pad[2]=255&z[20]|(255&z[21])<<8,this.pad[3]=255&z[22]|(255&z[23])<<8,this.pad[4]=255&z[24]|(255&z[25])<<8,this.pad[5]=255&z[26]|(255&z[27])<<8,this.pad[6]=255&z[28]|(255&z[29])<<8,this.pad[7]=255&z[30]|(255&z[31])<<8};function N(z,D,q,M,O,Q){var re=new H(Q);return re.update(q,M,O),re.finish(z,D),0}function c(z,D,q,M,O,Q){var re=new Uint8Array(16);return N(re,0,q,M,O,Q),v(z,D,re,0)}function p(z,D,q,M,O){var Q;if(q<32)return-1;for(j(z,0,D,0,q,M,O),N(z,16,z,32,q-32,z),Q=0;Q<16;Q++)z[Q]=0;return 0}function x(z,D,q,M,O){var Q,re=new Uint8Array(32);if(q<32||(R(re,0,32,M,O),c(D,16,D,32,q-32,re)!==0))return-1;for(j(z,0,D,0,q,M,O),Q=0;Q<32;Q++)z[Q]=0;return 0}function g(z,D){var q;for(q=0;q<16;q++)z[q]=0|D[q]}function h(z){var D,q,M=1;for(D=0;D<16;D++)q=z[D]+M+65535,M=Math.floor(q/65536),z[D]=q-65536*M;z[0]+=M-1+37*(M-1)}function y(z,D,q){for(var M,O=~(q-1),Q=0;Q<16;Q++)M=O&(z[Q]^D[Q]),z[Q]^=M,D[Q]^=M}function L(z,D){var q,M,O,Q=e(),re=e();for(q=0;q<16;q++)re[q]=D[q];for(h(re),h(re),h(re),M=0;M<2;M++){for(Q[0]=re[0]-65517,q=1;q<15;q++)Q[q]=re[q]-65535-(Q[q-1]>>16&1),Q[q-1]&=65535;Q[15]=re[15]-32767-(Q[14]>>16&1),O=Q[15]>>16&1,Q[14]&=65535,y(re,Q,1-O)}for(q=0;q<16;q++)z[2*q]=255&re[q],z[2*q+1]=re[q]>>8}function F(z,D){var q=new Uint8Array(32),M=new Uint8Array(32);return L(q,z),L(M,D),A(q,0,M,0)}function K(z){var D=new Uint8Array(32);return L(D,z),1&D[0]}function V(z,D){var q;for(q=0;q<16;q++)z[q]=D[2*q]+(D[2*q+1]<<8);z[15]&=32767}function W(z,D,q){for(var M=0;M<16;M++)z[M]=D[M]+q[M]}function Z(z,D,q){for(var M=0;M<16;M++)z[M]=D[M]-q[M]}function G(z,D,q){var M,O,Q=0,re=0,ue=0,J=0,De=0,Pe=0,Ee=0,st=0,Le=0,ke=0,ut=0,Ne=0,Ue=0,ht=0,Re=0,Se=0,ct=0,qe=0,Me=0,_e=0,pe=0,ve=0,Ce=0,Te=0,ze=0,kt=0,St=0,Et=0,Ct=0,Dt=0,zt=0,at=q[0],yt=q[1],mt=q[2],_t=q[3],it=q[4],It=q[5],Lt=q[6],or=q[7],Ft=q[8],nr=q[9],kr=q[10],Pr=q[11],Ur=q[12],an=q[13],un=q[14],cn=q[15];Q+=(M=D[0])*at,re+=M*yt,ue+=M*mt,J+=M*_t,De+=M*it,Pe+=M*It,Ee+=M*Lt,st+=M*or,Le+=M*Ft,ke+=M*nr,ut+=M*kr,Ne+=M*Pr,Ue+=M*Ur,ht+=M*an,Re+=M*un,Se+=M*cn,re+=(M=D[1])*at,ue+=M*yt,J+=M*mt,De+=M*_t,Pe+=M*it,Ee+=M*It,st+=M*Lt,Le+=M*or,ke+=M*Ft,ut+=M*nr,Ne+=M*kr,Ue+=M*Pr,ht+=M*Ur,Re+=M*an,Se+=M*un,ct+=M*cn,ue+=(M=D[2])*at,J+=M*yt,De+=M*mt,Pe+=M*_t,Ee+=M*it,st+=M*It,Le+=M*Lt,ke+=M*or,ut+=M*Ft,Ne+=M*nr,Ue+=M*kr,ht+=M*Pr,Re+=M*Ur,Se+=M*an,ct+=M*un,qe+=M*cn,J+=(M=D[3])*at,De+=M*yt,Pe+=M*mt,Ee+=M*_t,st+=M*it,Le+=M*It,ke+=M*Lt,ut+=M*or,Ne+=M*Ft,Ue+=M*nr,ht+=M*kr,Re+=M*Pr,Se+=M*Ur,ct+=M*an,qe+=M*un,Me+=M*cn,De+=(M=D[4])*at,Pe+=M*yt,Ee+=M*mt,st+=M*_t,Le+=M*it,ke+=M*It,ut+=M*Lt,Ne+=M*or,Ue+=M*Ft,ht+=M*nr,Re+=M*kr,Se+=M*Pr,ct+=M*Ur,qe+=M*an,Me+=M*un,_e+=M*cn,Pe+=(M=D[5])*at,Ee+=M*yt,st+=M*mt,Le+=M*_t,ke+=M*it,ut+=M*It,Ne+=M*Lt,Ue+=M*or,ht+=M*Ft,Re+=M*nr,Se+=M*kr,ct+=M*Pr,qe+=M*Ur,Me+=M*an,_e+=M*un,pe+=M*cn,Ee+=(M=D[6])*at,st+=M*yt,Le+=M*mt,ke+=M*_t,ut+=M*it,Ne+=M*It,Ue+=M*Lt,ht+=M*or,Re+=M*Ft,Se+=M*nr,ct+=M*kr,qe+=M*Pr,Me+=M*Ur,_e+=M*an,pe+=M*un,ve+=M*cn,st+=(M=D[7])*at,Le+=M*yt,ke+=M*mt,ut+=M*_t,Ne+=M*it,Ue+=M*It,ht+=M*Lt,Re+=M*or,Se+=M*Ft,ct+=M*nr,qe+=M*kr,Me+=M*Pr,_e+=M*Ur,pe+=M*an,ve+=M*un,Ce+=M*cn,Le+=(M=D[8])*at,ke+=M*yt,ut+=M*mt,Ne+=M*_t,Ue+=M*it,ht+=M*It,Re+=M*Lt,Se+=M*or,ct+=M*Ft,qe+=M*nr,Me+=M*kr,_e+=M*Pr,pe+=M*Ur,ve+=M*an,Ce+=M*un,Te+=M*cn,ke+=(M=D[9])*at,ut+=M*yt,Ne+=M*mt,Ue+=M*_t,ht+=M*it,Re+=M*It,Se+=M*Lt,ct+=M*or,qe+=M*Ft,Me+=M*nr,_e+=M*kr,pe+=M*Pr,ve+=M*Ur,Ce+=M*an,Te+=M*un,ze+=M*cn,ut+=(M=D[10])*at,Ne+=M*yt,Ue+=M*mt,ht+=M*_t,Re+=M*it,Se+=M*It,ct+=M*Lt,qe+=M*or,Me+=M*Ft,_e+=M*nr,pe+=M*kr,ve+=M*Pr,Ce+=M*Ur,Te+=M*an,ze+=M*un,kt+=M*cn,Ne+=(M=D[11])*at,Ue+=M*yt,ht+=M*mt,Re+=M*_t,Se+=M*it,ct+=M*It,qe+=M*Lt,Me+=M*or,_e+=M*Ft,pe+=M*nr,ve+=M*kr,Ce+=M*Pr,Te+=M*Ur,ze+=M*an,kt+=M*un,St+=M*cn,Ue+=(M=D[12])*at,ht+=M*yt,Re+=M*mt,Se+=M*_t,ct+=M*it,qe+=M*It,Me+=M*Lt,_e+=M*or,pe+=M*Ft,ve+=M*nr,Ce+=M*kr,Te+=M*Pr,ze+=M*Ur,kt+=M*an,St+=M*un,Et+=M*cn,ht+=(M=D[13])*at,Re+=M*yt,Se+=M*mt,ct+=M*_t,qe+=M*it,Me+=M*It,_e+=M*Lt,pe+=M*or,ve+=M*Ft,Ce+=M*nr,Te+=M*kr,ze+=M*Pr,kt+=M*Ur,St+=M*an,Et+=M*un,Ct+=M*cn,Re+=(M=D[14])*at,Se+=M*yt,ct+=M*mt,qe+=M*_t,Me+=M*it,_e+=M*It,pe+=M*Lt,ve+=M*or,Ce+=M*Ft,Te+=M*nr,ze+=M*kr,kt+=M*Pr,St+=M*Ur,Et+=M*an,Ct+=M*un,Dt+=M*cn,Se+=(M=D[15])*at,re+=38*(qe+=M*mt),ue+=38*(Me+=M*_t),J+=38*(_e+=M*it),De+=38*(pe+=M*It),Pe+=38*(ve+=M*Lt),Ee+=38*(Ce+=M*or),st+=38*(Te+=M*Ft),Le+=38*(ze+=M*nr),ke+=38*(kt+=M*kr),ut+=38*(St+=M*Pr),Ne+=38*(Et+=M*Ur),Ue+=38*(Ct+=M*an),ht+=38*(Dt+=M*un),Re+=38*(zt+=M*cn),Q=(M=(Q+=38*(ct+=M*yt))+(O=1)+65535)-65536*(O=Math.floor(M/65536)),re=(M=re+O+65535)-65536*(O=Math.floor(M/65536)),ue=(M=ue+O+65535)-65536*(O=Math.floor(M/65536)),J=(M=J+O+65535)-65536*(O=Math.floor(M/65536)),De=(M=De+O+65535)-65536*(O=Math.floor(M/65536)),Pe=(M=Pe+O+65535)-65536*(O=Math.floor(M/65536)),Ee=(M=Ee+O+65535)-65536*(O=Math.floor(M/65536)),st=(M=st+O+65535)-65536*(O=Math.floor(M/65536)),Le=(M=Le+O+65535)-65536*(O=Math.floor(M/65536)),ke=(M=ke+O+65535)-65536*(O=Math.floor(M/65536)),ut=(M=ut+O+65535)-65536*(O=Math.floor(M/65536)),Ne=(M=Ne+O+65535)-65536*(O=Math.floor(M/65536)),Ue=(M=Ue+O+65535)-65536*(O=Math.floor(M/65536)),ht=(M=ht+O+65535)-65536*(O=Math.floor(M/65536)),Re=(M=Re+O+65535)-65536*(O=Math.floor(M/65536)),Se=(M=Se+O+65535)-65536*(O=Math.floor(M/65536)),Q=(M=(Q+=O-1+37*(O-1))+(O=1)+65535)-65536*(O=Math.floor(M/65536)),re=(M=re+O+65535)-65536*(O=Math.floor(M/65536)),ue=(M=ue+O+65535)-65536*(O=Math.floor(M/65536)),J=(M=J+O+65535)-65536*(O=Math.floor(M/65536)),De=(M=De+O+65535)-65536*(O=Math.floor(M/65536)),Pe=(M=Pe+O+65535)-65536*(O=Math.floor(M/65536)),Ee=(M=Ee+O+65535)-65536*(O=Math.floor(M/65536)),st=(M=st+O+65535)-65536*(O=Math.floor(M/65536)),Le=(M=Le+O+65535)-65536*(O=Math.floor(M/65536)),ke=(M=ke+O+65535)-65536*(O=Math.floor(M/65536)),ut=(M=ut+O+65535)-65536*(O=Math.floor(M/65536)),Ne=(M=Ne+O+65535)-65536*(O=Math.floor(M/65536)),Ue=(M=Ue+O+65535)-65536*(O=Math.floor(M/65536)),ht=(M=ht+O+65535)-65536*(O=Math.floor(M/65536)),Re=(M=Re+O+65535)-65536*(O=Math.floor(M/65536)),Se=(M=Se+O+65535)-65536*(O=Math.floor(M/65536)),Q+=O-1+37*(O-1),z[0]=Q,z[1]=re,z[2]=ue,z[3]=J,z[4]=De,z[5]=Pe,z[6]=Ee,z[7]=st,z[8]=Le,z[9]=ke,z[10]=ut,z[11]=Ne,z[12]=Ue,z[13]=ht,z[14]=Re,z[15]=Se}function ne(z,D){G(z,D,D)}function X(z,D){var q,M=e();for(q=0;q<16;q++)M[q]=D[q];for(q=253;q>=0;q--)ne(M,M),q!==2&&q!==4&&G(M,M,D);for(q=0;q<16;q++)z[q]=M[q]}function te(z,D){var q,M=e();for(q=0;q<16;q++)M[q]=D[q];for(q=250;q>=0;q--)ne(M,M),q!==1&&G(M,M,D);for(q=0;q<16;q++)z[q]=M[q]}function ge(z,D,q){var M,O,Q=new Uint8Array(32),re=new Float64Array(80),ue=e(),J=e(),De=e(),Pe=e(),Ee=e(),st=e();for(O=0;O<31;O++)Q[O]=D[O];for(Q[31]=127&D[31]|64,Q[0]&=248,V(re,q),O=0;O<16;O++)J[O]=re[O],Pe[O]=ue[O]=De[O]=0;for(ue[0]=Pe[0]=1,O=254;O>=0;--O)y(ue,J,M=Q[O>>>3]>>>(7&O)&1),y(De,Pe,M),W(Ee,ue,De),Z(ue,ue,De),W(De,J,Pe),Z(J,J,Pe),ne(Pe,Ee),ne(st,ue),G(ue,De,ue),G(De,J,Ee),W(Ee,ue,De),Z(ue,ue,De),ne(J,ue),Z(De,Pe,st),G(ue,De,a),W(ue,ue,Pe),G(De,De,ue),G(ue,Pe,st),G(Pe,J,re),ne(J,Ee),y(ue,J,M),y(De,Pe,M);for(O=0;O<16;O++)re[O+16]=ue[O],re[O+32]=De[O],re[O+48]=J[O],re[O+64]=Pe[O];var Le=re.subarray(32),ke=re.subarray(16);return X(Le,Le),G(ke,ke,Le),L(z,ke),0}function ce(z,D){return ge(z,D,i)}function we(z,D){return t(D,32),ce(z,D)}function $e(z,D,q){var M=new Uint8Array(32);return ge(M,q,D),B(z,n,M,S)}H.prototype.blocks=function(z,D,q){for(var M,O,Q,re,ue,J,De,Pe,Ee,st,Le,ke,ut,Ne,Ue,ht,Re,Se,ct,qe=this.fin?0:2048,Me=this.h[0],_e=this.h[1],pe=this.h[2],ve=this.h[3],Ce=this.h[4],Te=this.h[5],ze=this.h[6],kt=this.h[7],St=this.h[8],Et=this.h[9],Ct=this.r[0],Dt=this.r[1],zt=this.r[2],at=this.r[3],yt=this.r[4],mt=this.r[5],_t=this.r[6],it=this.r[7],It=this.r[8],Lt=this.r[9];q>=16;)st=Ee=0,st+=(Me+=8191&(M=255&z[D+0]|(255&z[D+1])<<8))*Ct,st+=(_e+=8191&(M>>>13|(O=255&z[D+2]|(255&z[D+3])<<8)<<3))*(5*Lt),st+=(pe+=8191&(O>>>10|(Q=255&z[D+4]|(255&z[D+5])<<8)<<6))*(5*It),st+=(ve+=8191&(Q>>>7|(re=255&z[D+6]|(255&z[D+7])<<8)<<9))*(5*it),Ee=(st+=(Ce+=8191&(re>>>4|(ue=255&z[D+8]|(255&z[D+9])<<8)<<12))*(5*_t))>>>13,st&=8191,st+=(Te+=ue>>>1&8191)*(5*mt),st+=(ze+=8191&(ue>>>14|(J=255&z[D+10]|(255&z[D+11])<<8)<<2))*(5*yt),st+=(kt+=8191&(J>>>11|(De=255&z[D+12]|(255&z[D+13])<<8)<<5))*(5*at),st+=(St+=8191&(De>>>8|(Pe=255&z[D+14]|(255&z[D+15])<<8)<<8))*(5*zt),Le=Ee+=(st+=(Et+=Pe>>>5|qe)*(5*Dt))>>>13,Le+=Me*Dt,Le+=_e*Ct,Le+=pe*(5*Lt),Le+=ve*(5*It),Ee=(Le+=Ce*(5*it))>>>13,Le&=8191,Le+=Te*(5*_t),Le+=ze*(5*mt),Le+=kt*(5*yt),Le+=St*(5*at),Ee+=(Le+=Et*(5*zt))>>>13,Le&=8191,ke=Ee,ke+=Me*zt,ke+=_e*Dt,ke+=pe*Ct,ke+=ve*(5*Lt),Ee=(ke+=Ce*(5*It))>>>13,ke&=8191,ke+=Te*(5*it),ke+=ze*(5*_t),ke+=kt*(5*mt),ke+=St*(5*yt),ut=Ee+=(ke+=Et*(5*at))>>>13,ut+=Me*at,ut+=_e*zt,ut+=pe*Dt,ut+=ve*Ct,Ee=(ut+=Ce*(5*Lt))>>>13,ut&=8191,ut+=Te*(5*It),ut+=ze*(5*it),ut+=kt*(5*_t),ut+=St*(5*mt),Ne=Ee+=(ut+=Et*(5*yt))>>>13,Ne+=Me*yt,Ne+=_e*at,Ne+=pe*zt,Ne+=ve*Dt,Ee=(Ne+=Ce*Ct)>>>13,Ne&=8191,Ne+=Te*(5*Lt),Ne+=ze*(5*It),Ne+=kt*(5*it),Ne+=St*(5*_t),Ue=Ee+=(Ne+=Et*(5*mt))>>>13,Ue+=Me*mt,Ue+=_e*yt,Ue+=pe*at,Ue+=ve*zt,Ee=(Ue+=Ce*Dt)>>>13,Ue&=8191,Ue+=Te*Ct,Ue+=ze*(5*Lt),Ue+=kt*(5*It),Ue+=St*(5*it),ht=Ee+=(Ue+=Et*(5*_t))>>>13,ht+=Me*_t,ht+=_e*mt,ht+=pe*yt,ht+=ve*at,Ee=(ht+=Ce*zt)>>>13,ht&=8191,ht+=Te*Dt,ht+=ze*Ct,ht+=kt*(5*Lt),ht+=St*(5*It),Re=Ee+=(ht+=Et*(5*it))>>>13,Re+=Me*it,Re+=_e*_t,Re+=pe*mt,Re+=ve*yt,Ee=(Re+=Ce*at)>>>13,Re&=8191,Re+=Te*zt,Re+=ze*Dt,Re+=kt*Ct,Re+=St*(5*Lt),Se=Ee+=(Re+=Et*(5*It))>>>13,Se+=Me*It,Se+=_e*it,Se+=pe*_t,Se+=ve*mt,Ee=(Se+=Ce*yt)>>>13,Se&=8191,Se+=Te*at,Se+=ze*zt,Se+=kt*Dt,Se+=St*Ct,ct=Ee+=(Se+=Et*(5*Lt))>>>13,ct+=Me*Lt,ct+=_e*It,ct+=pe*it,ct+=ve*_t,Ee=(ct+=Ce*mt)>>>13,ct&=8191,ct+=Te*yt,ct+=ze*at,ct+=kt*zt,ct+=St*Dt,Me=st=8191&(Ee=(Ee=((Ee+=(ct+=Et*Ct)>>>13)<<2)+Ee|0)+(st&=8191)|0),_e=Le+=Ee>>>=13,pe=ke&=8191,ve=ut&=8191,Ce=Ne&=8191,Te=Ue&=8191,ze=ht&=8191,kt=Re&=8191,St=Se&=8191,Et=ct&=8191,D+=16,q-=16;this.h[0]=Me,this.h[1]=_e,this.h[2]=pe,this.h[3]=ve,this.h[4]=Ce,this.h[5]=Te,this.h[6]=ze,this.h[7]=kt,this.h[8]=St,this.h[9]=Et},H.prototype.finish=function(z,D){var q,M,O,Q,re=new Uint16Array(10);if(this.leftover){for(Q=this.leftover,this.buffer[Q++]=1;Q<16;Q++)this.buffer[Q]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(q=this.h[1]>>>13,this.h[1]&=8191,Q=2;Q<10;Q++)this.h[Q]+=q,q=this.h[Q]>>>13,this.h[Q]&=8191;for(this.h[0]+=5*q,q=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=q,q=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=q,re[0]=this.h[0]+5,q=re[0]>>>13,re[0]&=8191,Q=1;Q<10;Q++)re[Q]=this.h[Q]+q,q=re[Q]>>>13,re[Q]&=8191;for(re[9]-=8192,M=(1^q)-1,Q=0;Q<10;Q++)re[Q]&=M;for(M=~M,Q=0;Q<10;Q++)this.h[Q]=this.h[Q]&M|re[Q];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),O=this.h[0]+this.pad[0],this.h[0]=65535&O,Q=1;Q<8;Q++)O=(this.h[Q]+this.pad[Q]|0)+(O>>>16)|0,this.h[Q]=65535&O;z[D+0]=this.h[0]>>>0&255,z[D+1]=this.h[0]>>>8&255,z[D+2]=this.h[1]>>>0&255,z[D+3]=this.h[1]>>>8&255,z[D+4]=this.h[2]>>>0&255,z[D+5]=this.h[2]>>>8&255,z[D+6]=this.h[3]>>>0&255,z[D+7]=this.h[3]>>>8&255,z[D+8]=this.h[4]>>>0&255,z[D+9]=this.h[4]>>>8&255,z[D+10]=this.h[5]>>>0&255,z[D+11]=this.h[5]>>>8&255,z[D+12]=this.h[6]>>>0&255,z[D+13]=this.h[6]>>>8&255,z[D+14]=this.h[7]>>>0&255,z[D+15]=this.h[7]>>>8&255},H.prototype.update=function(z,D,q){var M,O;if(this.leftover){for((O=16-this.leftover)>q&&(O=q),M=0;M=16&&(O=q-q%16,this.blocks(z,D,O),D+=O,q-=O),q){for(M=0;M=128;){for(qe=0;qe<16;qe++)Me=8*qe+Ur,kt[qe]=q[Me+0]<<24|q[Me+1]<<16|q[Me+2]<<8|q[Me+3],St[qe]=q[Me+4]<<24|q[Me+5]<<16|q[Me+6]<<8|q[Me+7];for(qe=0;qe<80;qe++)if(O=Et,Q=Ct,re=Dt,ue=zt,J=at,De=yt,Pe=mt,st=it,Le=It,ke=Lt,ut=or,Ne=Ft,Ue=nr,ht=kr,ve=65535&(pe=Pr),Ce=pe>>>16,Te=65535&(_e=_t),ze=_e>>>16,ve+=65535&(pe=(Ft>>>14|at<<18)^(Ft>>>18|at<<14)^(at>>>9|Ft<<23)),Ce+=pe>>>16,Te+=65535&(_e=(at>>>14|Ft<<18)^(at>>>18|Ft<<14)^(Ft>>>9|at<<23)),ze+=_e>>>16,ve+=65535&(pe=Ft&nr^~Ft&kr),Ce+=pe>>>16,Te+=65535&(_e=at&yt^~at&mt),ze+=_e>>>16,_e=se[2*qe],ve+=65535&(pe=se[2*qe+1]),Ce+=pe>>>16,Te+=65535&_e,ze+=_e>>>16,_e=kt[qe%16],Ce+=(pe=St[qe%16])>>>16,Te+=65535&_e,ze+=_e>>>16,Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16,ve=65535&(pe=ct=65535&ve|Ce<<16),Ce=pe>>>16,Te=65535&(_e=Se=65535&Te|(ze+=Te>>>16)<<16),ze=_e>>>16,ve+=65535&(pe=(it>>>28|Et<<4)^(Et>>>2|it<<30)^(Et>>>7|it<<25)),Ce+=pe>>>16,Te+=65535&(_e=(Et>>>28|it<<4)^(it>>>2|Et<<30)^(it>>>7|Et<<25)),ze+=_e>>>16,Ce+=(pe=it&It^it&Lt^It&Lt)>>>16,Te+=65535&(_e=Et&Ct^Et&Dt^Ct&Dt),ze+=_e>>>16,Ee=65535&(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)|(ze+=Te>>>16)<<16,Re=65535&ve|Ce<<16,ve=65535&(pe=ut),Ce=pe>>>16,Te=65535&(_e=ue),ze=_e>>>16,Ce+=(pe=ct)>>>16,Te+=65535&(_e=Se),ze+=_e>>>16,Ct=O,Dt=Q,zt=re,at=ue=65535&(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)|(ze+=Te>>>16)<<16,yt=J,mt=De,_t=Pe,Et=Ee,It=st,Lt=Le,or=ke,Ft=ut=65535&ve|Ce<<16,nr=Ne,kr=Ue,Pr=ht,it=Re,qe%16==15)for(Me=0;Me<16;Me++)_e=kt[Me],ve=65535&(pe=St[Me]),Ce=pe>>>16,Te=65535&_e,ze=_e>>>16,_e=kt[(Me+9)%16],ve+=65535&(pe=St[(Me+9)%16]),Ce+=pe>>>16,Te+=65535&_e,ze+=_e>>>16,Se=kt[(Me+1)%16],ve+=65535&(pe=((ct=St[(Me+1)%16])>>>1|Se<<31)^(ct>>>8|Se<<24)^(ct>>>7|Se<<25)),Ce+=pe>>>16,Te+=65535&(_e=(Se>>>1|ct<<31)^(Se>>>8|ct<<24)^Se>>>7),ze+=_e>>>16,Se=kt[(Me+14)%16],Ce+=(pe=((ct=St[(Me+14)%16])>>>19|Se<<13)^(Se>>>29|ct<<3)^(ct>>>6|Se<<26))>>>16,Te+=65535&(_e=(Se>>>19|ct<<13)^(ct>>>29|Se<<3)^Se>>>6),ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,kt[Me]=65535&Te|ze<<16,St[Me]=65535&ve|Ce<<16;ve=65535&(pe=it),Ce=pe>>>16,Te=65535&(_e=Et),ze=_e>>>16,_e=z[0],Ce+=(pe=D[0])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[0]=Et=65535&Te|ze<<16,D[0]=it=65535&ve|Ce<<16,ve=65535&(pe=It),Ce=pe>>>16,Te=65535&(_e=Ct),ze=_e>>>16,_e=z[1],Ce+=(pe=D[1])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[1]=Ct=65535&Te|ze<<16,D[1]=It=65535&ve|Ce<<16,ve=65535&(pe=Lt),Ce=pe>>>16,Te=65535&(_e=Dt),ze=_e>>>16,_e=z[2],Ce+=(pe=D[2])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[2]=Dt=65535&Te|ze<<16,D[2]=Lt=65535&ve|Ce<<16,ve=65535&(pe=or),Ce=pe>>>16,Te=65535&(_e=zt),ze=_e>>>16,_e=z[3],Ce+=(pe=D[3])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[3]=zt=65535&Te|ze<<16,D[3]=or=65535&ve|Ce<<16,ve=65535&(pe=Ft),Ce=pe>>>16,Te=65535&(_e=at),ze=_e>>>16,_e=z[4],Ce+=(pe=D[4])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[4]=at=65535&Te|ze<<16,D[4]=Ft=65535&ve|Ce<<16,ve=65535&(pe=nr),Ce=pe>>>16,Te=65535&(_e=yt),ze=_e>>>16,_e=z[5],Ce+=(pe=D[5])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[5]=yt=65535&Te|ze<<16,D[5]=nr=65535&ve|Ce<<16,ve=65535&(pe=kr),Ce=pe>>>16,Te=65535&(_e=mt),ze=_e>>>16,_e=z[6],Ce+=(pe=D[6])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[6]=mt=65535&Te|ze<<16,D[6]=kr=65535&ve|Ce<<16,ve=65535&(pe=Pr),Ce=pe>>>16,Te=65535&(_e=_t),ze=_e>>>16,_e=z[7],Ce+=(pe=D[7])>>>16,Te+=65535&_e,ze+=_e>>>16,ze+=(Te+=(Ce+=(ve+=65535&pe)>>>16)>>>16)>>>16,z[7]=_t=65535&Te|ze<<16,D[7]=Pr=65535&ve|Ce<<16,Ur+=128,M-=128}return M}function oe(z,D,q){var M,O=new Int32Array(8),Q=new Int32Array(8),re=new Uint8Array(256),ue=q;for(O[0]=1779033703,O[1]=3144134277,O[2]=1013904242,O[3]=2773480762,O[4]=1359893119,O[5]=2600822924,O[6]=528734635,O[7]=1541459225,Q[0]=4089235720,Q[1]=2227873595,Q[2]=4271175723,Q[3]=1595750129,Q[4]=2917565137,Q[5]=725511199,Q[6]=4215389547,Q[7]=327033209,ie(O,Q,D,q),q%=128,M=0;M=0;--O)f(z,D,M=q[O/8|0]>>(7&O)&1),Fe(D,z),Fe(z,z),f(z,D,M)}function T(z,D){var q=[e(),e(),e(),e()];g(q[0],d),g(q[1],_),g(q[2],s),G(q[3],d,_),k(z,q,D)}function U(z,D,q){var M,O=new Uint8Array(64),Q=[e(),e(),e(),e()];for(q||t(D,32),oe(O,D,32),O[0]&=248,O[31]&=127,O[31]|=64,T(Q,O),b(z,Q),M=0;M<32;M++)D[M+32]=z[M];return 0}var $=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(z,D){var q,M,O,Q;for(M=63;M>=32;--M){for(q=0,O=M-32,Q=M-12;O>4)*$[O],q=D[O]>>8,D[O]&=255;for(O=0;O<32;O++)D[O]-=q*$[O];for(M=0;M<32;M++)D[M+1]+=D[M]>>8,z[M]=255&D[M]}function de(z){var D,q=new Float64Array(64);for(D=0;D<64;D++)q[D]=z[D];for(D=0;D<64;D++)z[D]=0;Y(z,q)}function Ke(z,D,q,M){var O,Q,re=new Uint8Array(64),ue=new Uint8Array(64),J=new Uint8Array(64),De=new Float64Array(64),Pe=[e(),e(),e(),e()];oe(re,M,32),re[0]&=248,re[31]&=127,re[31]|=64;var Ee=q+64;for(O=0;O>7&&Z(De[0],o,De[0]),G(De[3],De[0],De[1]),0)}(J,M))return-1;for(O=0;O=0},r.sign.keyPair=function(){var z=new Uint8Array(pt),D=new Uint8Array(gt);return U(z,D),{publicKey:z,secretKey:D}},r.sign.keyPair.fromSecretKey=function(z){if(lt(z),z.length!==gt)throw new Error("bad secret key size");for(var D=new Uint8Array(pt),q=0;q{if(e.includes(".")||e.trim().toLowerCase()!==e)throw new gc(pc.InvalidDomain);const[a]=ye.findProgramAddressSync([vl.toBuffer()],vl),u=Kp(e),l=Vp(u,void 0,wh),d=Kp(l.toBase58()),_=Vp(d,a),[E]=ye.findProgramAddressSync([l.toBuffer()],vl),m=N3.findIndex(j=>s==null?void 0:s.equals(j));let w;const v=[];if(m!==-1&&s){w=dw(o,s,!0);const j=await r.getAccountInfo(w);if(!(j!=null&&j.data)){const H=TI(n,w,s,o);v.push(H)}}const A=new P2.PythHttpClient(r,P2.getPythProgramKeyForCluster("mainnet-beta")),I=await A.getData(),B=D9.get(o.toBase58());if(!B)throw new gc(pc.SymbolNotFound,`No symbol found for mint ${o.toBase58()}`);const S=I.productPrice.get("Crypto."+B+"/USD"),P=I.productFromSymbol.get("Crypto."+B+"/USD"),C=dw(o,j9),R=new yc({name:e,space:t,referrerIdxOpt:m!=-1?m:null}).getInstruction(vl,U3,wh,l,_,Cr.programId,a,n,i,z9,S.productAccountKey,new ye(P.price_account),C,mh,Jo,E,w);return v.push(R),[[],v]};new ye("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var nv;(function(r){r.DegenPoet1="DegenPoet#1"})(nv||(nv={}));new ye("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");const dL=({domain:r,onEdit:e})=>{const{cart:t,removeFromCart:n}=je.useContext(zc),i=t[r];return ee.jsx(X5,{domain:i.domain,available:!0,price:i.price,children:ee.jsxs("div",{className:"flex flex-col items-end gap-2 text-sm",children:[ee.jsxs("div",{className:"flex flex-row gap-2",children:[ee.jsxs("span",{children:["Storage: ",i.storage/1e3,"kB"]}),ee.jsxs("button",{type:"button",className:"flex items-center text-theme-primary dark:text-theme-secondary gap-0.5",tabIndex:0,onClick:e,children:["Edit",ee.jsx(WE,{width:16,height:16})]})]}),ee.jsxs("button",{type:"button",className:"flex items-center gap-2 text-theme-primary dark:text-theme-secondary",tabIndex:0,onClick:()=>n(r),children:["Remove",ee.jsx(S5,{width:20,height:20})]})]})})},iv=({children:r,isVisible:e,toggleVisibility:t})=>{const n=je.useRef(null),i=s=>{s.preventDefault(),s.target===n.current&&t(!e)},o=je.useCallback(s=>{s.code==="Escape"&&t(!1)},[t]);return je.useEffect(()=>{e&&document.addEventListener("keydown",o),e||document.removeEventListener("keydown",o)},[e,o]),e?ee.jsx("div",{className:Lr("animate-modal-fade-in absolute top-0 bottom-0 left-0 right-0","bg-modal-overlay-bg bg-opacity-60 z-[1]","flex items-center justify-center"),ref:n,onClick:i,children:r}):null};function kc(){return kc=Object.assign||function(r){for(var e=1;e{const t=e.map(i=>qp(i).pubkey),n=await(r==null?void 0:r.getMultipleAccountsInfo(t));return n?e.map((i,o)=>{var s;return{domain:i,available:!((s=n[o])!=null&&s.data)}}):[]},SL=r=>{const{connection:e}=jc();return Dg(async()=>{if(!r||!e)return[];const n=r.split(".");if(n.length===2){const s=n[1],a=qp(r).pubkey,u=await(e==null?void 0:e.getAccountInfo(a)),l=J5(s,10),d=await Zp(e,l);if(u!=null&&u.data)return[{domain:r,available:!u.data},...d];{const _=qp(s).pubkey,E=await(e==null?void 0:e.getAccountInfo(_));return[{domain:s,available:!(E!=null&&E.data)},...d]}}return Zp(e,[r])},[!!e,r])},IL="https://sns-api.bonfida.com/v2/suggestion/search",BL=r=>{const{connection:e}=jc();return Dg(async()=>{if(!r||r==="")return;const n=await(await fetch(`${IL}/${r}`,{method:"GET"})).json();if(r.split(".").length===2)return[];if(!n||n.length<5){if(!e)return[];const s=J5(r,10);return Zp(e,s)}return n.map(s=>({domain:s,available:!0}))},[r,!!e])};var u0={},Xa={};Object.defineProperty(Xa,"__esModule",{value:!0});Xa.readBigUInt64LE=Xa.readBigInt64LE=void 0;var ML=function(){return new Error("Attempt to access memory outside buffer bounds")},PL=function(r,e,t){return new Error('The "'+r+'" argument must be of type '+e+". Received "+t)},sv=function(r,e,t){return new Error('The value of "'+r+" is out of range. It must be "+e+". Received "+t)};function zg(r,e){if(typeof r!="number")throw PL(e,"number",r)}function B4(r,e){throw Math.floor(r)!==r?(zg(r,"offset"),sv("offset","an integer",r)):e<0?ML():sv("offset",">= 0 and <= "+e,r)}function LL(r,e){e===void 0&&(e=0),zg(e,"offset");var t=r[e],n=r[e+7];(t===void 0||n===void 0)&&B4(e,r.length-8);var i=r[e+4]+r[e+5]*Math.pow(2,8)+r[e+6]*Math.pow(2,16)+(n<<24);return(BigInt(i)<0&&d[d.length-1])&&(w[0]===6||w[0]===2)){a=0;continue}if(w[0]===3&&(!d||w[1]>d[0]&&w[1]0&&l[l.length-1])&&(m[0]===6||m[0]===2)){s=0;continue}if(m[0]===3&&(!l||m[1]>l[0]&&m[1]=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t>>0,S=new Uint8Array(B);A!==I;){for(var P=m[A],C=0,R=B-1;(P!==0||C>>0,S[R]=P%s>>>0,P=P/s>>>0;if(P!==0)throw new Error("Non-zero carry");v=C,A++}for(var j=B-v;j!==B&&S[j]===0;)j++;for(var H=a.repeat(w);j>>0,B=new Uint8Array(I);m[w];){var S=e[m.charCodeAt(w)];if(S===255)return;for(var P=0,C=I-1;(S!==0||P>>0,B[C]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");A=P,w++}for(var R=I-A;R!==I&&B[R]===0;)R++;var j=Nl.allocUnsafe(v+(I-R));j.fill(0,0,v);for(var H=v;R!==I;)j[H++]=B[R++];return j}function E(m){var w=_(m);if(w)return w;throw new Error("Non-base"+s+" character")}return{encode:d,decodeUnsafe:_,decode:E}}var NL=UL,DL=NL,zL="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",jL=DL(zL);const Ua=A5(jL);var jg={exports:{}};const FL=/[\p{Lu}]/u,$L=/[\p{Ll}]/u,lv=/^[\p{Lu}](?![\p{Lu}])/gu,M4=/([\p{Alpha}\p{N}_]|$)/u,P4=/[_.\- ]+/,KL=new RegExp("^"+P4.source),hv=new RegExp(P4.source+M4.source,"gu"),fv=new RegExp("\\d+"+M4.source,"gu"),VL=(r,e,t)=>{let n=!1,i=!1,o=!1;for(let s=0;s(lv.lastIndex=0,r.replace(lv,t=>e(t))),HL=(r,e)=>(hv.lastIndex=0,fv.lastIndex=0,r.replace(hv,(t,n)=>e(n)).replace(fv,t=>e(t))),L4=(r,e)=>{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(r)?r=r.map(o=>o.trim()).filter(o=>o.length).join("-"):r=r.trim(),r.length===0)return"";const t=e.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(e.locale),n=e.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(e.locale);return r.length===1?e.pascalCase?n(r):t(r):(r!==t(r)&&(r=VL(r,t,n)),r=r.replace(KL,""),e.preserveConsecutiveUppercase?r=qL(r,t):r=t(r),e.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),HL(r,n))};jg.exports=L4;jg.exports.default=L4;var Fg=jg.exports;const pr=A5(Fg);var Mt={},Xe={};let cr=class{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}};Xe.Layout=cr;function $g(r,e){return e.property?r+"["+e.property+"]":r}Xe.nameWithProperty=$g;function WL(r,e){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof cr))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=e,e.boundConstructor_=r,e.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})}Xe.bindConstructorLayout=WL;let kn=class extends cr{isCount(){throw new Error("ExternalLayout is abstract")}};class C4 extends kn{constructor(e,t){if(e===void 0&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){t===void 0&&(t=0);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}let Kg=class extends kn{constructor(e,t,n){if(!(e instanceof cr))throw new TypeError("layout must be a Layout");if(t===void 0)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof Ji||this.layout instanceof Ao}decode(e,t){return t===void 0&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return n===void 0&&(n=0),this.layout.encode(e,t,n+this.offset)}},Ji=class extends cr{constructor(e,t){if(super(e,t),6s+i.encode(a,t,n+s),0);return this.count instanceof kn&&this.count.encode(e.length,t,n),o}}let D4=class extends cr{constructor(e,t,n){if(!(Array.isArray(e)&&e.reduce((o,s)=>o&&s instanceof cr,!0)))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&n===void 0&&(n=t,t=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,t);return t+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,t){t===void 0&&(t=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let u=a.span;if(s=0u&&(u=a.getSpan(t,n)))}o=n,n+=u}return o+s-i}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?t=-1:0<=t&&(t+=n.span)}}},Vg=class{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},Ch=class extends Vg{constructor(e,t){if(!(e instanceof kn&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}},qg=class extends cr{constructor(e,t,n){const i=e instanceof Ji||e instanceof Ao;if(i)e=new Ch(new Kg(e));else if(e instanceof kn&&e.isCount())e=new Ch(e);else if(!(e instanceof Vg))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof cr))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&i&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=i,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){t===void 0&&(t=0);let n;const i=this.discriminator,o=i.decode(e,t);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(e,t+a)}else n=s.decode(e,t);return n}encode(e,t,n){n===void 0&&(n=0);const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(e[o.property],t,n),a+s.encode(e[s.property],t,n+a)}return i.encode(e,t,n)}addVariant(e,t,n){const i=new z4(this,e,t,n);return this.registry[e]=i,i}getVariant(e,t){let n=e;return Ae.Buffer.isBuffer(e)&&(t===void 0&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}},z4=class extends cr{constructor(e,t,n,i){if(!(e instanceof qg))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof cr))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(t===void 0&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],t,n+i),o+=this.layout.getSpan(t,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};function ma(r){return 0>r&&(r+=4294967296),r}class Hg extends cr{constructor(e,t,n){if(!(e instanceof Ji||e instanceof Ao))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&n===void 0&&(n=t,t=void 0),4=t)throw new TypeError("bits must be positive integer");const i=8*e.span,o=e.fields.reduce((s,a)=>s+a.bits,0);if(t+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<>>this.start}encode(e){if(!Number.isInteger(e)||e!==ma(e&this.valueMask))throw new TypeError($g("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=ma(e<n&&(n=this.length.decode(e,t)),n}decode(e,t){t===void 0&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof kn&&(i=e.length),!(Ae.Buffer.isBuffer(e)&&i===e.length))throw new TypeError($g("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,i,"hex"),this.length instanceof kn&&this.length.encode(i,t,n),i}};class $4 extends cr{constructor(e){super(-1,e)}getSpan(e,t){if(!Ae.Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");t===void 0&&(t=0);let n=t;for(;nt.length)throw new RangeError("encoding overruns Buffer");return i.copy(t,n),t[n+o]=0,o+1}}class K4 extends cr{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t){if(!Ae.Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");return t===void 0&&(t=0),e.length-t}decode(e,t,n){t===void 0&&(t=0);let i=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpant.length)throw new RangeError("encoding overruns Buffer");return i.copy(t,n),o}}class V4 extends cr{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}}Xe.ExternalLayout=kn;Xe.GreedyCount=C4;Xe.OffsetLayout=Kg;Xe.UInt=Ji;Xe.UIntBE=Ao;Xe.Int=Qs;Xe.IntBE=lu;Xe.Float=T4;Xe.FloatBE=O4;Xe.Double=R4;Xe.DoubleBE=U4;Xe.Sequence=N4;Xe.Structure=D4;Xe.UnionDiscriminator=Vg;Xe.UnionLayoutDiscriminator=Ch;Xe.Union=qg;Xe.VariantLayout=z4;Xe.BitStructure=Hg;Xe.BitField=ec;Xe.Boolean=j4;Xe.Blob=F4;Xe.CString=$4;Xe.UTF8=K4;Xe.Constant=V4;Xe.greedy=(r,e)=>new C4(r,e);Xe.offset=(r,e,t)=>new Kg(r,e,t);Xe.u8=r=>new Ji(1,r);Xe.u16=r=>new Ji(2,r);Xe.u24=r=>new Ji(3,r);Xe.u32=r=>new Ji(4,r);Xe.u40=r=>new Ji(5,r);Xe.u48=r=>new Ji(6,r);Xe.nu64=r=>new ZL(r);Xe.u16be=r=>new Ao(2,r);Xe.u24be=r=>new Ao(3,r);Xe.u32be=r=>new Ao(4,r);Xe.u40be=r=>new Ao(5,r);Xe.u48be=r=>new Ao(6,r);Xe.nu64be=r=>new GL(r);Xe.s8=r=>new Qs(1,r);Xe.s16=r=>new Qs(2,r);Xe.s24=r=>new Qs(3,r);Xe.s32=r=>new Qs(4,r);Xe.s40=r=>new Qs(5,r);Xe.s48=r=>new Qs(6,r);Xe.ns64=r=>new YL(r);Xe.s16be=r=>new lu(2,r);Xe.s24be=r=>new lu(3,r);Xe.s32be=r=>new lu(4,r);Xe.s40be=r=>new lu(5,r);Xe.s48be=r=>new lu(6,r);Xe.ns64be=r=>new JL(r);Xe.f32=r=>new T4(r);Xe.f32be=r=>new O4(r);Xe.f64=r=>new R4(r);Xe.f64be=r=>new U4(r);Xe.struct=(r,e,t)=>new D4(r,e,t);Xe.bits=(r,e,t)=>new Hg(r,e,t);Xe.seq=(r,e,t)=>new N4(r,e,t);Xe.union=(r,e,t)=>new qg(r,e,t);Xe.unionLayoutDiscriminator=(r,e)=>new Ch(r,e);Xe.blob=(r,e)=>new F4(r,e);Xe.cstr=r=>new $4(r);Xe.utf8=(r,e)=>new K4(r,e);Xe.const=(r,e)=>new V4(r,e);(function(r){var e=Nt&&Nt.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const t=Xe,n=y1,i=e(bE);var o=Xe;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return o.struct}});class s extends t.Layout{constructor(g,h,y){super(g,y),this.blob=(0,t.blob)(g),this.signed=h}decode(g,h=0){const y=new i.default(this.blob.decode(g,h),10,"le");return this.signed?y.fromTwos(this.span*8).clone():y}encode(g,h,y=0){return this.signed&&(g=g.toTwos(this.span*8)),this.blob.encode(g.toArrayLike(Ae.Buffer,"le",this.span),h,y)}}function a(x){return new s(8,!1,x)}r.u64=a;function u(x){return new s(8,!0,x)}r.i64=u;function l(x){return new s(16,!1,x)}r.u128=l;function d(x){return new s(16,!0,x)}r.i128=d;function _(x){return new s(32,!1,x)}r.u256=_;function E(x){return new s(32,!0,x)}r.i256=E;class m extends t.Layout{constructor(g,h,y,L){super(g.span,L),this.layout=g,this.decoder=h,this.encoder=y}decode(g,h){return this.decoder(this.layout.decode(g,h))}encode(g,h,y){return this.layout.encode(this.encoder(g),h,y)}getSpan(g,h){return this.layout.getSpan(g,h)}}function w(x){return new m((0,t.blob)(32),g=>new n.PublicKey(g),g=>g.toBuffer(),x)}r.publicKey=w;class v extends t.Layout{constructor(g,h){super(-1,h),this.layout=g,this.discriminator=(0,t.u8)()}encode(g,h,y=0){return g==null?this.discriminator.encode(0,h,y):(this.discriminator.encode(1,h,y),this.layout.encode(g,h,y+1)+1)}decode(g,h=0){const y=this.discriminator.decode(g,h);if(y===0)return null;if(y===1)return this.layout.decode(g,h+1);throw new Error("Invalid option "+this.property)}getSpan(g,h=0){const y=this.discriminator.decode(g,h);if(y===0)return 1;if(y===1)return this.layout.getSpan(g,h+1)+1;throw new Error("Invalid option "+this.property)}}function A(x,g){return new v(x,g)}r.option=A;function I(x){return new m((0,t.u8)(),B,S,x)}r.bool=I;function B(x){if(x===0)return!1;if(x===1)return!0;throw new Error("Invalid bool: "+x)}function S(x){return x?1:0}function P(x,g){const h=(0,t.u32)("length"),y=(0,t.struct)([h,(0,t.seq)(x,(0,t.offset)(h,-h.span),"values")]);return new m(y,({values:L})=>L,L=>({values:L}),g)}r.vec=P;function C(x,g,h){const y=(0,t.struct)([a("tag"),g.replicate("data")]);function L({tag:F,data:K}){if(!F.eq(x))throw new Error("Invalid tag, expected: "+x.toString("hex")+", got: "+F.toString("hex"));return K}return new m(y,L,F=>({tag:x,data:F}),h)}r.tagged=C;function R(x){const g=(0,t.u32)("length"),h=(0,t.struct)([g,(0,t.blob)((0,t.offset)(g,-g.span),"data")]);return new m(h,({data:y})=>y,y=>({data:y}),x)}r.vecU8=R;function j(x){return new m(R(),g=>g.toString("utf-8"),g=>Ae.Buffer.from(g,"utf-8"),x)}r.str=j;function H(x,g,h){const y=(0,t.union)(h??(0,t.u8)(),g);return x.forEach((L,F)=>y.addVariant(F,L,L.property)),y}r.rustEnum=H;function N(x,g,h){const y=(0,t.struct)([(0,t.seq)(x,g,"values")]);return new m(y,({values:L})=>L,L=>({values:L}),h)}r.array=N;class c extends t.Layout{constructor(g,h,y){super(g.span+h.span,y),this.keyLayout=g,this.valueLayout=h}decode(g,h){h=h||0;const y=this.keyLayout.decode(g,h),L=this.valueLayout.decode(g,h+this.keyLayout.getSpan(g,h));return[y,L]}encode(g,h,y){y=y||0;const L=this.keyLayout.encode(g[0],h,y),F=this.valueLayout.encode(g[1],h,y+L);return L+F}getSpan(g,h){return this.keyLayout.getSpan(g,h)+this.valueLayout.getSpan(g,h)}}function p(x,g,h){const y=(0,t.u32)("length"),L=(0,t.struct)([y,(0,t.seq)(new c(x,g),(0,t.offset)(y,-y.span),"values")]);return new m(L,({values:F})=>new Map(F),F=>({values:Array.from(F.entries())}),h)}r.map=p})(Mt);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const XL=4,dv=0,pv=1,QL=2;function hu(r){let e=r.length;for(;--e>=0;)r[e]=0}const eC=0,q4=1,tC=2,rC=3,nC=258,Wg=29,el=256,Sc=el+1+Wg,Na=30,Zg=19,H4=2*Sc+1,Is=15,h0=16,iC=7,Gg=256,W4=16,Z4=17,G4=18,Yp=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),rh=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),oC=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Y4=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sC=512,co=new Array((Sc+2)*2);hu(co);const tc=new Array(Na*2);hu(tc);const Ic=new Array(sC);hu(Ic);const Bc=new Array(nC-rC+1);hu(Bc);const Yg=new Array(Wg);hu(Yg);const Th=new Array(Na);hu(Th);function f0(r,e,t,n,i){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}let J4,X4,Q4;function d0(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}const e_=r=>r<256?Ic[r]:Ic[256+(r>>>7)],Mc=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},In=(r,e,t)=>{r.bi_valid>h0-t?(r.bi_buf|=e<>h0-r.bi_valid,r.bi_valid+=t-h0):(r.bi_buf|=e<{In(r,t[e*2],t[e*2+1])},t_=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},aC=r=>{r.bi_valid===16?(Mc(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},uC=(r,e)=>{const t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,u=e.stat_desc.max_length;let l,d,_,E,m,w,v=0;for(E=0;E<=Is;E++)r.bl_count[E]=0;for(t[r.heap[r.heap_max]*2+1]=0,l=r.heap_max+1;lu&&(E=u,v++),t[d*2+1]=E,!(d>n)&&(r.bl_count[E]++,m=0,d>=a&&(m=s[d-a]),w=t[d*2],r.opt_len+=w*(E+m),o&&(r.static_len+=w*(i[d*2+1]+m)));if(v!==0){do{for(E=u-1;r.bl_count[E]===0;)E--;r.bl_count[E]--,r.bl_count[E+1]+=2,r.bl_count[u]--,v-=2}while(v>0);for(E=u;E!==0;E--)for(d=r.bl_count[E];d!==0;)_=r.heap[--l],!(_>n)&&(t[_*2+1]!==E&&(r.opt_len+=(E-t[_*2+1])*t[_*2],t[_*2+1]=E),d--)}},r_=(r,e,t)=>{const n=new Array(Is+1);let i=0,o,s;for(o=1;o<=Is;o++)i=i+t[o-1]<<1,n[o]=i;for(s=0;s<=e;s++){let a=r[s*2+1];a!==0&&(r[s*2]=t_(n[a]++,a))}},cC=()=>{let r,e,t,n,i;const o=new Array(Is+1);for(t=0,n=0;n>=7;n{let e;for(e=0;e{r.bi_valid>8?Mc(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},gv=(r,e,t,n)=>{const i=e*2,o=t*2;return r[i]{const n=r.heap[t];let i=t<<1;for(;i<=r.heap_len&&(i{let n,i,o=0,s,a;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+o++]&255,n+=(r.pending_buf[r.sym_buf+o++]&255)<<8,i=r.pending_buf[r.sym_buf+o++],n===0?$i(r,i,e):(s=Bc[i],$i(r,s+el+1,e),a=Yp[s],a!==0&&(i-=Yg[s],In(r,i,a)),n--,s=e_(n),$i(r,s,t),a=rh[s],a!==0&&(n-=Th[s],In(r,n,a)));while(o{const t=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let s,a,u=-1,l;for(r.heap_len=0,r.heap_max=H4,s=0;s>1;s>=1;s--)p0(r,t,s);l=o;do s=r.heap[1],r.heap[1]=r.heap[r.heap_len--],p0(r,t,1),a=r.heap[1],r.heap[--r.heap_max]=s,r.heap[--r.heap_max]=a,t[l*2]=t[s*2]+t[a*2],r.depth[l]=(r.depth[s]>=r.depth[a]?r.depth[s]:r.depth[a])+1,t[s*2+1]=t[a*2+1]=l,r.heap[1]=l++,p0(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],uC(r,e),r_(t,u,r.bl_count)},mv=(r,e,t)=>{let n,i=-1,o,s=e[0*2+1],a=0,u=7,l=4;for(s===0&&(u=138,l=3),e[(t+1)*2+1]=65535,n=0;n<=t;n++)o=s,s=e[(n+1)*2+1],!(++a{let n,i=-1,o,s=e[0*2+1],a=0,u=7,l=4;for(s===0&&(u=138,l=3),n=0;n<=t;n++)if(o=s,s=e[(n+1)*2+1],!(++a{let e;for(mv(r,r.dyn_ltree,r.l_desc.max_code),mv(r,r.dyn_dtree,r.d_desc.max_code),Jp(r,r.bl_desc),e=Zg-1;e>=3&&r.bl_tree[Y4[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},hC=(r,e,t,n)=>{let i;for(In(r,e-257,5),In(r,t-1,5),In(r,n-4,4),i=0;i{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return dv;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return pv;for(t=32;t{bv||(cC(),bv=!0),r.l_desc=new d0(r.dyn_ltree,J4),r.d_desc=new d0(r.dyn_dtree,X4),r.bl_desc=new d0(r.bl_tree,Q4),r.bi_buf=0,r.bi_valid=0,n_(r)},o_=(r,e,t,n)=>{In(r,(eC<<1)+(n?1:0),3),i_(r),Mc(r,t),Mc(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},pC=r=>{In(r,q4<<1,3),$i(r,Gg,co),aC(r)},gC=(r,e,t,n)=>{let i,o,s=0;r.level>0?(r.strm.data_type===QL&&(r.strm.data_type=fC(r)),Jp(r,r.l_desc),Jp(r,r.d_desc),s=lC(r),i=r.opt_len+3+7>>>3,o=r.static_len+3+7>>>3,o<=i&&(i=o)):i=o=t+5,t+4<=i&&e!==-1?o_(r,e,t,n):r.strategy===XL||o===i?(In(r,(q4<<1)+(n?1:0),3),yv(r,co,tc)):(In(r,(tC<<1)+(n?1:0),3),hC(r,r.l_desc.max_code+1,r.d_desc.max_code+1,s+1),yv(r,r.dyn_ltree,r.dyn_dtree)),n_(r),n&&i_(r)},yC=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(Bc[t]+el+1)*2]++,r.dyn_dtree[e_(e)*2]++),r.sym_next===r.sym_end);var mC=dC,wC=o_,bC=gC,vC=yC,_C=pC,EC={_tr_init:mC,_tr_stored_block:wC,_tr_flush_block:bC,_tr_tally:vC,_tr_align:_C};const xC=(r,e,t,n)=>{let i=r&65535|0,o=r>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do i=i+e[n++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};var Pc=xC;const AC=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},kC=new Uint32Array(AC()),SC=(r,e,t,n)=>{const i=kC,o=n+t;r^=-1;for(let s=n;s>>8^i[(r^e[s])&255];return r^-1};var qr=SC,Qa={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},tl={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:IC,_tr_stored_block:Xp,_tr_flush_block:BC,_tr_tally:Wo,_tr_align:MC}=EC,{Z_NO_FLUSH:Zo,Z_PARTIAL_FLUSH:PC,Z_FULL_FLUSH:LC,Z_FINISH:ti,Z_BLOCK:vv,Z_OK:en,Z_STREAM_END:_v,Z_STREAM_ERROR:qi,Z_DATA_ERROR:CC,Z_BUF_ERROR:g0,Z_DEFAULT_COMPRESSION:TC,Z_FILTERED:OC,Z_HUFFMAN_ONLY:Dl,Z_RLE:RC,Z_FIXED:UC,Z_DEFAULT_STRATEGY:NC,Z_UNKNOWN:DC,Z_DEFLATED:Lf}=tl,zC=9,jC=15,FC=8,$C=29,KC=256,Qp=KC+1+$C,VC=30,qC=19,HC=2*Qp+1,WC=15,Ht=3,Fo=258,Hi=Fo+Ht+1,ZC=32,eu=42,Jg=57,e1=69,t1=73,r1=91,n1=103,Bs=113,Vu=666,vn=1,fu=2,qs=3,du=4,GC=3,Ms=(r,e)=>(r.msg=Qa[e],e),Ev=r=>r*2-(r>4?9:0),Uo=r=>{let e=r.length;for(;--e>=0;)r[e]=0},YC=r=>{let e,t,n,i=r.w_size;e=r.hash_size,n=e;do t=r.head[--n],r.head[n]=t>=i?t-i:0;while(--e);e=i,n=e;do t=r.prev[--n],r.prev[n]=t>=i?t-i:0;while(--e)};let JC=(r,e,t)=>(e<{const e=r.state;let t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},qn=(r,e)=>{BC(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Dn(r.strm)},er=(r,e)=>{r.pending_buf[r.pending++]=e},Tu=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},i1=(r,e,t,n)=>{let i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,e.set(r.input.subarray(r.next_in,r.next_in+i),t),r.state.wrap===1?r.adler=Pc(r.adler,e,i,t):r.state.wrap===2&&(r.adler=qr(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},s_=(r,e)=>{let t=r.max_chain_length,n=r.strstart,i,o,s=r.prev_length,a=r.nice_match;const u=r.strstart>r.w_size-Hi?r.strstart-(r.w_size-Hi):0,l=r.window,d=r.w_mask,_=r.prev,E=r.strstart+Fo;let m=l[n+s-1],w=l[n+s];r.prev_length>=r.good_match&&(t>>=2),a>r.lookahead&&(a=r.lookahead);do if(i=e,!(l[i+s]!==w||l[i+s-1]!==m||l[i]!==l[n]||l[++i]!==l[n+1])){n+=2,i++;do;while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&ns){if(r.match_start=e,s=o,o>=a)break;m=l[n+s-1],w=l[n+s]}}while((e=_[e&d])>u&&--t!==0);return s<=r.lookahead?s:r.lookahead},tu=r=>{const e=r.w_size;let t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-Hi)&&(r.window.set(r.window.subarray(e,e+e-n),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),YC(r),n+=e),r.strm.avail_in===0)break;if(t=i1(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=Ht)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=Go(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=Go(r,r.ins_h,r.window[i+Ht-1]),r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,r.insert--,!(r.lookahead+r.insert{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,i,o,s=0,a=r.strm.avail_in;do{if(n=65535,o=r.bi_valid+42>>3,r.strm.avail_outi+r.strm.avail_in&&(n=i+r.strm.avail_in),n>o&&(n=o),n>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,Dn(r.strm),i&&(i>n&&(i=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+i),r.strm.next_out),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i,r.block_start+=i,n-=i),n&&(i1(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}while(s===0);return a-=r.strm.avail_in,a&&(a>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=a&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-a,r.strm.next_in),r.strstart),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.block_start=r.strstart),r.high_watero&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,o+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),o>r.strm.avail_in&&(o=r.strm.avail_in),o&&(i1(r.strm,r.window,r.strstart,o),r.strstart+=o,r.insert+=o>r.w_size-r.insert?r.w_size-r.insert:o),r.high_water>3,o=r.pending_buf_size-o>65535?65535:r.pending_buf_size-o,t=o>r.w_size?r.w_size:o,i=r.strstart-r.block_start,(i>=t||(i||e===ti)&&e!==Zo&&r.strm.avail_in===0&&i<=o)&&(n=i>o?o:i,s=e===ti&&r.strm.avail_in===0&&n===i?1:0,Xp(r,r.block_start,n,s),r.block_start+=n,Dn(r.strm)),s?qs:vn)},y0=(r,e)=>{let t,n;for(;;){if(r.lookahead=Ht&&(r.ins_h=Go(r,r.ins_h,r.window[r.strstart+Ht-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-Hi&&(r.match_length=s_(r,t)),r.match_length>=Ht)if(n=Wo(r,r.strstart-r.match_start,r.match_length-Ht),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=Ht){r.match_length--;do r.strstart++,r.ins_h=Go(r,r.ins_h,r.window[r.strstart+Ht-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=Go(r,r.ins_h,r.window[r.strstart+1]);else n=Wo(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(qn(r,!1),r.strm.avail_out===0))return vn}return r.insert=r.strstart{let t,n,i;for(;;){if(r.lookahead=Ht&&(r.ins_h=Go(r,r.ins_h,r.window[r.strstart+Ht-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=Ht-1,t!==0&&r.prev_length4096)&&(r.match_length=Ht-1)),r.prev_length>=Ht&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-Ht,n=Wo(r,r.strstart-1-r.prev_match,r.prev_length-Ht),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=Go(r,r.ins_h,r.window[r.strstart+Ht-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=Ht-1,r.strstart++,n&&(qn(r,!1),r.strm.avail_out===0))return vn}else if(r.match_available){if(n=Wo(r,0,r.window[r.strstart-1]),n&&qn(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return vn}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Wo(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart{let t,n,i,o;const s=r.window;for(;;){if(r.lookahead<=Fo){if(tu(r),r.lookahead<=Fo&&e===Zo)return vn;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=Ht&&r.strstart>0&&(i=r.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){o=r.strstart+Fo;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&ir.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=Ht?(t=Wo(r,1,r.match_length-Ht),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Wo(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(qn(r,!1),r.strm.avail_out===0))return vn}return r.insert=0,e===ti?(qn(r,!0),r.strm.avail_out===0?qs:du):r.sym_next&&(qn(r,!1),r.strm.avail_out===0)?vn:fu},QC=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(tu(r),r.lookahead===0)){if(e===Zo)return vn;break}if(r.match_length=0,t=Wo(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(qn(r,!1),r.strm.avail_out===0))return vn}return r.insert=0,e===ti?(qn(r,!0),r.strm.avail_out===0?qs:du):r.sym_next&&(qn(r,!1),r.strm.avail_out===0)?vn:fu};function Li(r,e,t,n,i){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=n,this.func=i}const qu=[new Li(0,0,0,0,a_),new Li(4,4,8,4,y0),new Li(4,5,16,8,y0),new Li(4,6,32,32,y0),new Li(4,4,16,16,ua),new Li(8,16,32,32,ua),new Li(8,16,128,128,ua),new Li(8,32,128,256,ua),new Li(32,128,258,1024,ua),new Li(32,258,258,4096,ua)],eT=r=>{r.window_size=2*r.w_size,Uo(r.head),r.max_lazy_match=qu[r.level].max_lazy,r.good_match=qu[r.level].good_length,r.nice_match=qu[r.level].nice_length,r.max_chain_length=qu[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=Ht-1,r.match_available=0,r.ins_h=0};function tT(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Lf,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(HC*2),this.dyn_dtree=new Uint16Array((2*VC+1)*2),this.bl_tree=new Uint16Array((2*qC+1)*2),Uo(this.dyn_ltree),Uo(this.dyn_dtree),Uo(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(WC+1),this.heap=new Uint16Array(2*Qp+1),Uo(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Qp+1),Uo(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const rl=r=>{if(!r)return 1;const e=r.state;return!e||e.strm!==r||e.status!==eu&&e.status!==Jg&&e.status!==e1&&e.status!==t1&&e.status!==r1&&e.status!==n1&&e.status!==Bs&&e.status!==Vu?1:0},u_=r=>{if(rl(r))return Ms(r,qi);r.total_in=r.total_out=0,r.data_type=DC;const e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Jg:e.wrap?eu:Bs,r.adler=e.wrap===2?0:1,e.last_flush=-2,IC(e),en},c_=r=>{const e=u_(r);return e===en&&eT(r.state),e},rT=(r,e)=>rl(r)||r.state.wrap!==2?qi:(r.state.gzhead=e,en),l_=(r,e,t,n,i,o)=>{if(!r)return qi;let s=1;if(e===TC&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>zC||t!==Lf||n<8||n>15||e<0||e>9||o<0||o>UC||n===8&&s!==1)return Ms(r,qi);n===8&&(n=9);const a=new tT;return r.state=a,a.strm=r,a.status=eu,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<l_(r,e,Lf,jC,FC,NC),iT=(r,e)=>{if(rl(r)||e>vv||e<0)return r?Ms(r,qi):qi;const t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Vu&&e!==ti)return Ms(r,r.avail_out===0?g0:qi);const n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Dn(r),r.avail_out===0)return t.last_flush=-1,en}else if(r.avail_in===0&&Ev(e)<=Ev(n)&&e!==ti)return Ms(r,g0);if(t.status===Vu&&r.avail_in!==0)return Ms(r,g0);if(t.status===eu&&t.wrap===0&&(t.status=Bs),t.status===eu){let i=Lf+(t.w_bits-8<<4)<<8,o=-1;if(t.strategy>=Dl||t.level<2?o=0:t.level<6?o=1:t.level===6?o=2:o=3,i|=o<<6,t.strstart!==0&&(i|=ZC),i+=31-i%31,Tu(t,i),t.strstart!==0&&(Tu(t,r.adler>>>16),Tu(t,r.adler&65535)),r.adler=1,t.status=Bs,Dn(r),t.pending!==0)return t.last_flush=-1,en}if(t.status===Jg){if(r.adler=0,er(t,31),er(t,139),er(t,8),t.gzhead)er(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),er(t,t.gzhead.time&255),er(t,t.gzhead.time>>8&255),er(t,t.gzhead.time>>16&255),er(t,t.gzhead.time>>24&255),er(t,t.level===9?2:t.strategy>=Dl||t.level<2?4:0),er(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(er(t,t.gzhead.extra.length&255),er(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=qr(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=e1;else if(er(t,0),er(t,0),er(t,0),er(t,0),er(t,0),er(t,t.level===9?2:t.strategy>=Dl||t.level<2?4:0),er(t,GC),t.status=Bs,Dn(r),t.pending!==0)return t.last_flush=-1,en}if(t.status===e1){if(t.gzhead.extra){let i=t.pending,o=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+o>t.pending_buf_size;){let a=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(r.adler=qr(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=a,Dn(r),t.pending!==0)return t.last_flush=-1,en;i=0,o-=a}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending+=o,t.gzhead.hcrc&&t.pending>i&&(r.adler=qr(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=t1}if(t.status===t1){if(t.gzhead.name){let i=t.pending,o;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=qr(r.adler,t.pending_buf,t.pending-i,i)),Dn(r),t.pending!==0)return t.last_flush=-1,en;i=0}t.gzindexi&&(r.adler=qr(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=r1}if(t.status===r1){if(t.gzhead.comment){let i=t.pending,o;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=qr(r.adler,t.pending_buf,t.pending-i,i)),Dn(r),t.pending!==0)return t.last_flush=-1,en;i=0}t.gzindexi&&(r.adler=qr(r.adler,t.pending_buf,t.pending-i,i))}t.status=n1}if(t.status===n1){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Dn(r),t.pending!==0))return t.last_flush=-1,en;er(t,r.adler&255),er(t,r.adler>>8&255),r.adler=0}if(t.status=Bs,Dn(r),t.pending!==0)return t.last_flush=-1,en}if(r.avail_in!==0||t.lookahead!==0||e!==Zo&&t.status!==Vu){let i=t.level===0?a_(t,e):t.strategy===Dl?QC(t,e):t.strategy===RC?XC(t,e):qu[t.level].func(t,e);if((i===qs||i===du)&&(t.status=Vu),i===vn||i===qs)return r.avail_out===0&&(t.last_flush=-1),en;if(i===fu&&(e===PC?MC(t):e!==vv&&(Xp(t,0,0,!1),e===LC&&(Uo(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Dn(r),r.avail_out===0))return t.last_flush=-1,en}return e!==ti?en:t.wrap<=0?_v:(t.wrap===2?(er(t,r.adler&255),er(t,r.adler>>8&255),er(t,r.adler>>16&255),er(t,r.adler>>24&255),er(t,r.total_in&255),er(t,r.total_in>>8&255),er(t,r.total_in>>16&255),er(t,r.total_in>>24&255)):(Tu(t,r.adler>>>16),Tu(t,r.adler&65535)),Dn(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?en:_v)},oT=r=>{if(rl(r))return qi;const e=r.state.status;return r.state=null,e===Bs?Ms(r,CC):en},sT=(r,e)=>{let t=e.length;if(rl(r))return qi;const n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==eu||n.lookahead)return qi;if(i===1&&(r.adler=Pc(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Uo(n.head),n.strstart=0,n.block_start=0,n.insert=0);let u=new Uint8Array(n.w_size);u.set(e.subarray(t-n.w_size,t),0),e=u,t=n.w_size}const o=r.avail_in,s=r.next_in,a=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,tu(n);n.lookahead>=Ht;){let u=n.strstart,l=n.lookahead-(Ht-1);do n.ins_h=Go(n,n.ins_h,n.window[u+Ht-1]),n.prev[u&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=u,u++;while(--l);n.strstart=u,n.lookahead=Ht-1,tu(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=Ht-1,n.match_available=0,r.next_in=s,r.input=a,r.avail_in=o,n.wrap=i,en};var aT=nT,uT=l_,cT=c_,lT=u_,hT=rT,fT=iT,dT=oT,pT=sT,gT="pako deflate (from Nodeca project)",rc={deflateInit:aT,deflateInit2:uT,deflateReset:cT,deflateResetKeep:lT,deflateSetHeader:hT,deflate:fT,deflateEnd:dT,deflateSetDictionary:pT,deflateInfo:gT};const yT=(r,e)=>Object.prototype.hasOwnProperty.call(r,e);var mT=function(r){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const n in t)yT(t,n)&&(r[n]=t[n])}}return r},wT=r=>{let e=0;for(let n=0,i=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Lc[254]=Lc[254]=1;var bT=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,n,i,o,s=r.length,a=0;for(i=0;i>>6,e[o++]=128|t&63):t<65536?(e[o++]=224|t>>>12,e[o++]=128|t>>>6&63,e[o++]=128|t&63):(e[o++]=240|t>>>18,e[o++]=128|t>>>12&63,e[o++]=128|t>>>6&63,e[o++]=128|t&63);return e};const vT=(r,e)=>{if(e<65534&&r.subarray&&h_)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let n=0;n{const t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let n,i;const o=new Array(t*2);for(i=0,n=0;n4){o[i++]=65533,n+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&n1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return vT(o,i)},ET=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+Lc[r[t]]>e?t:e},Cc={string2buf:bT,buf2string:_T,utf8border:ET};function xT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var f_=xT;const d_=Object.prototype.toString,{Z_NO_FLUSH:AT,Z_SYNC_FLUSH:kT,Z_FULL_FLUSH:ST,Z_FINISH:IT,Z_OK:Oh,Z_STREAM_END:BT,Z_DEFAULT_COMPRESSION:MT,Z_DEFAULT_STRATEGY:PT,Z_DEFLATED:LT}=tl;function Xg(r){this.options=Cf.assign({level:MT,method:LT,chunkSize:16384,windowBits:15,memLevel:8,strategy:PT},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f_,this.strm.avail_out=0;let t=rc.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Oh)throw new Error(Qa[t]);if(e.header&&rc.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=Cc.string2buf(e.dictionary):d_.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=rc.deflateSetDictionary(this.strm,n),t!==Oh)throw new Error(Qa[t]);this._dict_set=!0}}Xg.prototype.push=function(r,e){const t=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?IT:AT,typeof r=="string"?t.input=Cc.string2buf(r):d_.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),(o===kT||o===ST)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=rc.deflate(t,o),i===BT)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=rc.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Oh;if(t.avail_out===0){this.onData(t.output);continue}if(o>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Xg.prototype.onData=function(r){this.chunks.push(r)};Xg.prototype.onEnd=function(r){r===Oh&&(this.result=Cf.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};const zl=16209,CT=16191;var TT=function(e,t){let n,i,o,s,a,u,l,d,_,E,m,w,v,A,I,B,S,P,C,R,j,H,N,c;const p=e.state;n=e.next_in,N=e.input,i=n+(e.avail_in-5),o=e.next_out,c=e.output,s=o-(t-e.avail_out),a=o+(e.avail_out-257),u=p.dmax,l=p.wsize,d=p.whave,_=p.wnext,E=p.window,m=p.hold,w=p.bits,v=p.lencode,A=p.distcode,I=(1<>>24,m>>>=P,w-=P,P=S>>>16&255,P===0)c[o++]=S&65535;else if(P&16){C=S&65535,P&=15,P&&(w>>=P,w-=P),w<15&&(m+=N[n++]<>>24,m>>>=P,w-=P,P=S>>>16&255,P&16){if(R=S&65535,P&=15,wu){e.msg="invalid distance too far back",p.mode=zl;break e}if(m>>>=P,w-=P,P=o-s,R>P){if(P=R-P,P>d&&p.sane){e.msg="invalid distance too far back",p.mode=zl;break e}if(j=0,H=E,_===0){if(j+=l-P,P2;)c[o++]=H[j++],c[o++]=H[j++],c[o++]=H[j++],C-=3;C&&(c[o++]=H[j++],C>1&&(c[o++]=H[j++]))}else{j=o-R;do c[o++]=c[j++],c[o++]=c[j++],c[o++]=c[j++],C-=3;while(C>2);C&&(c[o++]=c[j++],C>1&&(c[o++]=c[j++]))}}else if(P&64){e.msg="invalid distance code",p.mode=zl;break e}else{S=A[(S&65535)+(m&(1<>3,n-=C,w-=C<<3,m&=(1<{const u=a.bits;let l=0,d=0,_=0,E=0,m=0,w=0,v=0,A=0,I=0,B=0,S,P,C,R,j,H=null,N;const c=new Uint16Array(ca+1),p=new Uint16Array(ca+1);let x=null,g,h,y;for(l=0;l<=ca;l++)c[l]=0;for(d=0;d=1&&c[E]===0;E--);if(m>E&&(m=E),E===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,a.bits=1,0;for(_=1;_0&&(r===kv||E!==1))return-1;for(p[1]=0,l=1;lxv||r===Sv&&I>Av)return 1;for(;;){g=l-v,s[d]+1=N?(h=x[s[d]-N],y=H[s[d]-N]):(h=32+64,y=0),S=1<>v)+P]=g<<24|h<<16|y|0;while(P!==0);for(S=1<>=1;if(S!==0?(B&=S-1,B+=S):B=0,d++,--c[l]===0){if(l===E)break;l=e[t+s[d]]}if(l>m&&(B&R)!==C){for(v===0&&(v=m),j+=_,w=l-v,A=1<xv||r===Sv&&I>Av)return 1;C=B&R,i[C]=m<<24|w<<16|j-o|0}}return B!==0&&(i[j+B]=l-v<<24|64<<16|0),a.bits=m,0};var nc=DT;const zT=0,p_=1,g_=2,{Z_FINISH:Iv,Z_BLOCK:jT,Z_TREES:jl,Z_OK:Hs,Z_STREAM_END:FT,Z_NEED_DICT:$T,Z_STREAM_ERROR:si,Z_DATA_ERROR:y_,Z_MEM_ERROR:m_,Z_BUF_ERROR:KT,Z_DEFLATED:Bv}=tl,Tf=16180,Mv=16181,Pv=16182,Lv=16183,Cv=16184,Tv=16185,Ov=16186,Rv=16187,Uv=16188,Nv=16189,Rh=16190,ro=16191,w0=16192,Dv=16193,b0=16194,zv=16195,jv=16196,Fv=16197,$v=16198,Fl=16199,$l=16200,Kv=16201,Vv=16202,qv=16203,Hv=16204,Wv=16205,v0=16206,Zv=16207,Gv=16208,mr=16209,w_=16210,b_=16211,VT=852,qT=592,HT=15,WT=HT,Yv=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function ZT(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ea=r=>{if(!r)return 1;const e=r.state;return!e||e.strm!==r||e.modeb_?1:0},v_=r=>{if(ea(r))return si;const e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Tf,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(VT),e.distcode=e.distdyn=new Int32Array(qT),e.sane=1,e.back=-1,Hs},__=r=>{if(ea(r))return si;const e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,v_(r)},E_=(r,e)=>{let t;if(ea(r))return si;const n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?si:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,__(r))},x_=(r,e)=>{if(!r)return si;const t=new ZT;r.state=t,t.strm=r,t.window=null,t.mode=Tf;const n=E_(r,e);return n!==Hs&&(r.state=null),n},GT=r=>x_(r,WT);let Jv=!0,_0,E0;const YT=r=>{if(Jv){_0=new Int32Array(512),E0=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(nc(p_,r.lens,0,288,_0,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;nc(g_,r.lens,0,32,E0,0,r.work,{bits:5}),Jv=!1}r.lencode=_0,r.lenbits=9,r.distcode=E0,r.distbits=5},A_=(r,e,t,n)=>{let i;const o=r.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(e.subarray(t-o.wsize,t),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(t-n,t-n+i),o.wnext),n-=i,n?(o.window.set(e.subarray(t-n,t),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let t,n,i,o,s,a,u,l,d,_,E,m,w,v,A=0,I,B,S,P,C,R,j,H;const N=new Uint8Array(4);let c,p;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ea(r)||!r.output||!r.input&&r.avail_in!==0)return si;t=r.state,t.mode===ro&&(t.mode=w0),s=r.next_out,i=r.output,u=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,l=t.hold,d=t.bits,_=a,E=u,H=Hs;e:for(;;)switch(t.mode){case Tf:if(t.wrap===0){t.mode=w0;break}for(;d<16;){if(a===0)break e;a--,l+=n[o++]<>>8&255,t.check=qr(t.check,N,2,0),l=0,d=0,t.mode=Mv;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=mr;break}if((l&15)!==Bv){r.msg="unknown compression method",t.mode=mr;break}if(l>>>=4,d-=4,j=(l&15)+8,t.wbits===0&&(t.wbits=j),j>15||j>t.wbits){r.msg="invalid window size",t.mode=mr;break}t.dmax=1<>8&1),t.flags&512&&t.wrap&4&&(N[0]=l&255,N[1]=l>>>8&255,t.check=qr(t.check,N,2,0)),l=0,d=0,t.mode=Pv;case Pv:for(;d<32;){if(a===0)break e;a--,l+=n[o++]<>>8&255,N[2]=l>>>16&255,N[3]=l>>>24&255,t.check=qr(t.check,N,4,0)),l=0,d=0,t.mode=Lv;case Lv:for(;d<16;){if(a===0)break e;a--,l+=n[o++]<>8),t.flags&512&&t.wrap&4&&(N[0]=l&255,N[1]=l>>>8&255,t.check=qr(t.check,N,2,0)),l=0,d=0,t.mode=Cv;case Cv:if(t.flags&1024){for(;d<16;){if(a===0)break e;a--,l+=n[o++]<>>8&255,t.check=qr(t.check,N,2,0)),l=0,d=0}else t.head&&(t.head.extra=null);t.mode=Tv;case Tv:if(t.flags&1024&&(m=t.length,m>a&&(m=a),m&&(t.head&&(j=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(o,o+m),j)),t.flags&512&&t.wrap&4&&(t.check=qr(t.check,n,m,o)),a-=m,o+=m,t.length-=m),t.length))break e;t.length=0,t.mode=Ov;case Ov:if(t.flags&2048){if(a===0)break e;m=0;do j=n[o+m++],t.head&&j&&t.length<65536&&(t.head.name+=String.fromCharCode(j));while(j&&m>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=ro;break;case Nv:for(;d<32;){if(a===0)break e;a--,l+=n[o++]<>>=d&7,d-=d&7,t.mode=v0;break}for(;d<3;){if(a===0)break e;a--,l+=n[o++]<>>=1,d-=1,l&3){case 0:t.mode=Dv;break;case 1:if(YT(t),t.mode=Fl,e===jl){l>>>=2,d-=2;break e}break;case 2:t.mode=jv;break;case 3:r.msg="invalid block type",t.mode=mr}l>>>=2,d-=2;break;case Dv:for(l>>>=d&7,d-=d&7;d<32;){if(a===0)break e;a--,l+=n[o++]<>>16^65535)){r.msg="invalid stored block lengths",t.mode=mr;break}if(t.length=l&65535,l=0,d=0,t.mode=b0,e===jl)break e;case b0:t.mode=zv;case zv:if(m=t.length,m){if(m>a&&(m=a),m>u&&(m=u),m===0)break e;i.set(n.subarray(o,o+m),s),a-=m,o+=m,u-=m,s+=m,t.length-=m;break}t.mode=ro;break;case jv:for(;d<14;){if(a===0)break e;a--,l+=n[o++]<>>=5,d-=5,t.ndist=(l&31)+1,l>>>=5,d-=5,t.ncode=(l&15)+4,l>>>=4,d-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=mr;break}t.have=0,t.mode=Fv;case Fv:for(;t.have>>=3,d-=3}for(;t.have<19;)t.lens[x[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,c={bits:t.lenbits},H=nc(zT,t.lens,0,19,t.lencode,0,t.work,c),t.lenbits=c.bits,H){r.msg="invalid code lengths set",t.mode=mr;break}t.have=0,t.mode=$v;case $v:for(;t.have>>24,B=A>>>16&255,S=A&65535,!(I<=d);){if(a===0)break e;a--,l+=n[o++]<>>=I,d-=I,t.lens[t.have++]=S;else{if(S===16){for(p=I+2;d>>=I,d-=I,t.have===0){r.msg="invalid bit length repeat",t.mode=mr;break}j=t.lens[t.have-1],m=3+(l&3),l>>>=2,d-=2}else if(S===17){for(p=I+3;d>>=I,d-=I,j=0,m=3+(l&7),l>>>=3,d-=3}else{for(p=I+7;d>>=I,d-=I,j=0,m=11+(l&127),l>>>=7,d-=7}if(t.have+m>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=mr;break}for(;m--;)t.lens[t.have++]=j}}if(t.mode===mr)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=mr;break}if(t.lenbits=9,c={bits:t.lenbits},H=nc(p_,t.lens,0,t.nlen,t.lencode,0,t.work,c),t.lenbits=c.bits,H){r.msg="invalid literal/lengths set",t.mode=mr;break}if(t.distbits=6,t.distcode=t.distdyn,c={bits:t.distbits},H=nc(g_,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,c),t.distbits=c.bits,H){r.msg="invalid distances set",t.mode=mr;break}if(t.mode=Fl,e===jl)break e;case Fl:t.mode=$l;case $l:if(a>=6&&u>=258){r.next_out=s,r.avail_out=u,r.next_in=o,r.avail_in=a,t.hold=l,t.bits=d,TT(r,E),s=r.next_out,i=r.output,u=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,l=t.hold,d=t.bits,t.mode===ro&&(t.back=-1);break}for(t.back=0;A=t.lencode[l&(1<>>24,B=A>>>16&255,S=A&65535,!(I<=d);){if(a===0)break e;a--,l+=n[o++]<>P)],I=A>>>24,B=A>>>16&255,S=A&65535,!(P+I<=d);){if(a===0)break e;a--,l+=n[o++]<>>=P,d-=P,t.back+=P}if(l>>>=I,d-=I,t.back+=I,t.length=S,B===0){t.mode=Wv;break}if(B&32){t.back=-1,t.mode=ro;break}if(B&64){r.msg="invalid literal/length code",t.mode=mr;break}t.extra=B&15,t.mode=Kv;case Kv:if(t.extra){for(p=t.extra;d>>=t.extra,d-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Vv;case Vv:for(;A=t.distcode[l&(1<>>24,B=A>>>16&255,S=A&65535,!(I<=d);){if(a===0)break e;a--,l+=n[o++]<>P)],I=A>>>24,B=A>>>16&255,S=A&65535,!(P+I<=d);){if(a===0)break e;a--,l+=n[o++]<>>=P,d-=P,t.back+=P}if(l>>>=I,d-=I,t.back+=I,B&64){r.msg="invalid distance code",t.mode=mr;break}t.offset=S,t.extra=B&15,t.mode=qv;case qv:if(t.extra){for(p=t.extra;d>>=t.extra,d-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=mr;break}t.mode=Hv;case Hv:if(u===0)break e;if(m=E-u,t.offset>m){if(m=t.offset-m,m>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=mr;break}m>t.wnext?(m-=t.wnext,w=t.wsize-m):w=t.wnext-m,m>t.length&&(m=t.length),v=t.window}else v=i,w=s-t.offset,m=t.length;m>u&&(m=u),u-=m,t.length-=m;do i[s++]=v[w++];while(--m);t.length===0&&(t.mode=$l);break;case Wv:if(u===0)break e;i[s++]=t.length,u--,t.mode=$l;break;case v0:if(t.wrap){for(;d<32;){if(a===0)break e;a--,l|=n[o++]<{if(ea(r))return si;let e=r.state;return e.window&&(e.window=null),r.state=null,Hs},QT=(r,e)=>{if(ea(r))return si;const t=r.state;return t.wrap&2?(t.head=e,e.done=!1,Hs):si},eO=(r,e)=>{const t=e.length;let n,i,o;return ea(r)||(n=r.state,n.wrap!==0&&n.mode!==Rh)?si:n.mode===Rh&&(i=1,i=Pc(i,e,t,0),i!==n.check)?y_:(o=A_(r,e,t,t),o?(n.mode=w_,m_):(n.havedict=1,Hs))};var tO=__,rO=E_,nO=v_,iO=GT,oO=x_,sO=JT,aO=XT,uO=QT,cO=eO,lO="pako inflate (from Nodeca project)",lo={inflateReset:tO,inflateReset2:rO,inflateResetKeep:nO,inflateInit:iO,inflateInit2:oO,inflate:sO,inflateEnd:aO,inflateGetHeader:uO,inflateSetDictionary:cO,inflateInfo:lO};function hO(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var fO=hO;const k_=Object.prototype.toString,{Z_NO_FLUSH:dO,Z_FINISH:pO,Z_OK:Tc,Z_STREAM_END:x0,Z_NEED_DICT:A0,Z_STREAM_ERROR:gO,Z_DATA_ERROR:Xv,Z_MEM_ERROR:yO}=tl;function nl(r){this.options=Cf.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f_,this.strm.avail_out=0;let t=lo.inflateInit2(this.strm,e.windowBits);if(t!==Tc)throw new Error(Qa[t]);if(this.header=new fO,lo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Cc.string2buf(e.dictionary):k_.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=lo.inflateSetDictionary(this.strm,e.dictionary),t!==Tc)))throw new Error(Qa[t])}nl.prototype.push=function(r,e){const t=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?pO:dO,k_.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),o=lo.inflate(t,s),o===A0&&i&&(o=lo.inflateSetDictionary(t,i),o===Tc?o=lo.inflate(t,s):o===Xv&&(o=A0));t.avail_in>0&&o===x0&&t.state.wrap>0&&r[t.next_in]!==0;)lo.inflateReset(t),o=lo.inflate(t,s);switch(o){case gO:case Xv:case A0:case yO:return this.onEnd(o),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||o===x0))if(this.options.to==="string"){let u=Cc.utf8border(t.output,t.next_out),l=t.next_out-u,d=Cc.buf2string(t.output,u);t.next_out=l,t.avail_out=n-l,l&&t.output.set(t.output.subarray(u,u+l),0),this.onData(d)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(o===Tc&&a===0)){if(o===x0)return o=lo.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};nl.prototype.onData=function(r){this.chunks.push(r)};nl.prototype.onEnd=function(r){r===Tc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Cf.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Qg(r,e){const t=new nl(e);if(t.push(r),t.err)throw t.msg||Qa[t.err];return t.result}function mO(r,e){return e=e||{},e.raw=!0,Qg(r,e)}var wO=nl,bO=Qg,vO=mO,_O=Qg,EO=tl,xO={Inflate:wO,inflate:bO,inflateRaw:vO,ungzip:_O,constants:EO};const{Inflate:xN,inflate:AO,inflateRaw:AN,ungzip:kN}=xO;var kO=AO;function SO(r,e){return Array.apply(0,new Array(Math.ceil(r.length/e))).map((t,n)=>r.slice(n*e,(n+1)*e))}const Ou=r=>"version"in r;function IO(r){return r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),"0x")}function BO(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let e=r.match(/.{2}/g);return e===null?Zr.Buffer.from([]):Zr.Buffer.from(e.map(t=>parseInt(t,16)))}var MO=Object.freeze({__proto__:null,encode:IO,decode:BO});function S_(r){return new TextDecoder("utf-8").decode(r)}function I_(r){return new TextEncoder().encode(r)}var PO=Object.freeze({__proto__:null,decode:S_,encode:I_});function o1(r){return Ua.encode(r)}function LO(r){return Ua.decode(r)}var CO=Object.freeze({__proto__:null,encode:o1,decode:LO});function TO(r){return M0(r)}function B_(r){return Zr.Buffer.from(k5(r))}var OO=Object.freeze({__proto__:null,encode:TO,decode:B_}),RO=Object.freeze({__proto__:null,hex:MO,utf8:PO,bs58:CO,base64:OO});function M_(r){const e=new Map;return r.errors&&r.errors.forEach(t=>{var n;let i=(n=t.msg)!==null&&n!==void 0?n:t.name;e.set(t.code,i)}),e}function P_(r,...e){if(r.args.length!=e.length)throw new Error("Invalid argument length");const t={};let n=0;return r.args.forEach(i=>{t[i.name]=e[n],n+=1}),t}function ey(r,e={}){r.forEach(t=>{if("accounts"in t)ey(t.accounts,e[t.name]);else if(e[t.name]===void 0)throw new Error(`Invalid arguments: ${t.name} not provided.`)})}function Bn(r){return r instanceof Kt?r:new Kt(r)}class UO extends TypeError{constructor(e,t){let n;const{message:i,...o}=e,{path:s}=e,a=s.length===0?i:"At path: "+s.join(".")+" -- "+i;super(a),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var u;return(u=n)!=null?u:n=[e,...t()]}}}function NO(r){return Da(r)&&typeof r[Symbol.iterator]=="function"}function Da(r){return typeof r=="object"&&r!=null}function Qo(r){return typeof r=="string"?JSON.stringify(r):""+r}function DO(r){const{done:e,value:t}=r.next();return e?void 0:t}function zO(r,e,t,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:o}=e,{type:s}=t,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+Qo(n)+"`"}=r;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...r,message:u}}function*Qv(r,e,t,n){NO(r)||(r=[r]);for(const i of r){const o=zO(i,e,t,n);o&&(yield o)}}function*ty(r,e,t){t===void 0&&(t={});const{path:n=[],branch:i=[r],coerce:o=!1,mask:s=!1}=t,a={path:n,branch:i};if(o&&(r=e.coercer(r,a),s&&e.type!=="type"&&Da(e.schema)&&Da(r)&&!Array.isArray(r)))for(const l in r)e.schema[l]===void 0&&delete r[l];let u=!0;for(const l of e.validator(r,a))u=!1,yield[l,void 0];for(let[l,d,_]of e.entries(r,a)){const E=ty(d,_,{path:l===void 0?n:[...n,l],branch:l===void 0?i:[...i,d],coerce:o,mask:s});for(const m of E)m[0]?(u=!1,yield[m[0],void 0]):o&&(d=m[1],l===void 0?r=d:r instanceof Map?r.set(l,d):r instanceof Set?r.add(d):Da(r)&&(r[l]=d))}if(u)for(const l of e.refiner(r,a))u=!1,yield[l,void 0];u&&(yield[void 0,r])}class ns{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:i,refiner:o,coercer:s=u=>u,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=s,i?this.validator=(u,l)=>{const d=i(u,l);return Qv(d,l,this,u)}:this.validator=()=>[],o?this.refiner=(u,l)=>{const d=o(u,l);return Qv(d,l,this,u)}:this.refiner=()=>[]}assert(e){return jO(e,this)}create(e){return ry(e,this)}is(e){return L_(e,this)}mask(e){return FO(e,this)}validate(e,t){return t===void 0&&(t={}),il(e,this,t)}}function jO(r,e){const t=il(r,e);if(t[0])throw t[0]}function ry(r,e){const t=il(r,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function FO(r,e){const t=il(r,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function L_(r,e){return!il(r,e)[0]}function il(r,e,t){t===void 0&&(t={});const n=ty(r,e,t),i=DO(n);return i[0]?[new UO(i[0],function*(){for(const s of n)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function ol(r,e){return new ns({type:r,schema:null,validator:e})}function $O(){return ol("any",()=>!0)}function k0(r){return new ns({type:"array",schema:r,*entries(e){if(r&&Array.isArray(e))for(const[t,n]of e.entries())yield[t,n,r]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+Qo(e)}})}function KO(){return ol("boolean",r=>typeof r=="boolean")}function e5(r){const e=Qo(r),t=typeof r;return new ns({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?r:null,validator(n){return n===r||"Expected the literal `"+e+"`, but received: "+Qo(n)}})}function Kl(r){return new ns({...r,validator:(e,t)=>e===null||r.validator(e,t),refiner:(e,t)=>e===null||r.refiner(e,t)})}function nh(){return ol("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+Qo(r))}function ih(r){return new ns({...r,validator:(e,t)=>e===void 0||r.validator(e,t),refiner:(e,t)=>e===void 0||r.refiner(e,t)})}function Ps(){return ol("string",r=>typeof r=="string"||"Expected a string, but received: "+Qo(r))}function Yo(r){const e=Object.keys(r);return new ns({type:"type",schema:r,*entries(t){if(Da(t))for(const n of e)yield[n,t[n],r[n]]},validator(t){return Da(t)||"Expected an object, but received: "+Qo(t)}})}function C_(r){const e=r.map(t=>t.type).join(" | ");return new ns({type:"union",schema:null,coercer(t,n){return(r.find(o=>{const[s]=o.validate(t,{coerce:!0});return!s})||ny()).coercer(t,n)},validator(t,n){const i=[];for(const o of r){const[...s]=ty(t,o,n),[a]=s;if(a[0])for(const[u]of s)u&&i.push(u);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Qo(t),...i]}})}function ny(){return ol("unknown",()=>!0)}function VO(r,e,t){return new ns({...r,coercer:(n,i)=>L_(n,e)?r.coercer(t(n,i),i):r.coercer(n,i)})}async function qO(r,e,t,n){r=Bn(r),n||(n=Oc());const i=new Dh;if(i.add(new Dc({programId:r,keys:e??[],data:t})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(i,[])}const t5=99;async function HO(r,e,t){return(await iy(r,e,t)).map(i=>i?{publicKey:i.publicKey,account:i.account}:null)}async function iy(r,e,t){if(e.length<=t5)return await r5(r,e,t);{const n=SO(e,t5);return(await Promise.all(n.map(o=>r5(r,o,t)))).flat()}}async function r5(r,e,t){const n=t??r.commitment,{value:i,context:o}=await r.getMultipleAccountsInfoAndContext(e,n);return i.map((a,u)=>a===null?null:{publicKey:e[u],account:a,context:o})}async function T_(r,e,t,n,i){var o;t&&t.length>0&&e.sign(...t);const s=e._compile(),a=s.serialize(),l=e._serialize(a).toString("base64"),d={encoding:"base64",commitment:n??r.commitment};if(i){const w=(Array.isArray(i)?i:s.nonProgramIds()).map(v=>v.toBase58());d.accounts={encoding:"base64",addresses:w}}t&&(d.sigVerify=!0);const _=[l,d],E=await r._rpcRequest("simulateTransaction",_),m=ry(E,YO);if("error"in m){let w;if("data"in m.error&&(w=(o=m.error.data)===null||o===void 0?void 0:o.logs,w&&Array.isArray(w))){const v=` - `,A=v+w.join(v);console.error(m.error.message,A)}throw new B0("failed to simulate transaction: "+m.error.message,w)}return m.result}function WO(r){return VO(O_(r),ZO,e=>"error"in e?e:{...e,result:ry(e.result,r)})}const ZO=O_(ny());function O_(r){return C_([Yo({jsonrpc:e5("2.0"),id:Ps(),result:r}),Yo({jsonrpc:e5("2.0"),id:Ps(),error:Yo({code:ny(),message:Ps(),data:ih($O())})})])}function GO(r){return WO(Yo({context:Yo({slot:nh()}),value:r}))}const YO=GO(Yo({err:Kl(C_([Yo({}),Ps()])),logs:Kl(k0(Ps())),accounts:ih(Kl(k0(Kl(Yo({executable:KO(),owner:Ps(),lamports:nh(),data:k0(Ps()),rentEpoch:ih(nh())}))))),unitsConsumed:ih(nh())}));var JO=Object.freeze({__proto__:null,invoke:qO,getMultipleAccounts:HO,getMultipleAccountsAndContext:iy,simulateTransaction:T_});class R_{constructor(e,t,n){this.connection=e,this.wallet=t,this.opts=n,this.publicKey=t==null?void 0:t.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(e,t){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(e,t,n){var i,o,s,a;if(n===void 0&&(n=this.opts),Ou(e))t&&e.sign(t);else if(e.feePayer=(i=e.feePayer)!==null&&i!==void 0?i:this.wallet.publicKey,e.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,t)for(const l of t)e.partialSign(l);e=await this.wallet.signTransaction(e);const u=e.serialize();try{return await n5(this.connection,u,n)}catch(l){if(l instanceof s1){const d=o1(Ou(e)?((o=e.signatures)===null||o===void 0?void 0:o[0])||new Uint8Array:(s=e.signature)!==null&&s!==void 0?s:new Uint8Array),_=await this.connection.getTransaction(d,{commitment:"confirmed"});if(_){const E=(a=_.meta)===null||a===void 0?void 0:a.logMessages;throw E?new B0(l.message,E):l}else throw l}else throw l}}async sendAll(e,t){var n,i,o;t===void 0&&(t=this.opts);const s=(await this.connection.getLatestBlockhash(t.preflightCommitment)).blockhash;let a=e.map(d=>{var _,E;if(Ou(d.tx)){let m=d.tx;return d.signers&&m.sign(d.signers),m}else{let m=d.tx,w=(_=d.signers)!==null&&_!==void 0?_:[];return m.feePayer=(E=m.feePayer)!==null&&E!==void 0?E:this.wallet.publicKey,m.recentBlockhash=s,w.forEach(v=>{m.partialSign(v)}),m}});const u=await this.wallet.signAllTransactions(a),l=[];for(let d=0;dE.startsWith("Program log: AnchorError"));if(t===-1)return null;const n=e[t],i=[n];let o;if(t+11)return null;i=a[0].match(/([0-9]+)/g)[0]}let o;try{o=parseInt(i)}catch{return null}let s=t.get(o);return s!==void 0?new Uc(o,s,e.logs):(s=N_.get(o),s!==void 0?new Uc(o,s,e.logs):null)}get program(){var e;return(e=this._programErrorStack)===null||e===void 0?void 0:e.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var e;return(e=this._programErrorStack)===null||e===void 0?void 0:e.stack}toString(){return this.msg}}function sy(r,e){oy("debug-logs")&&console.log("Translating error:",r);const t=za.parse(r.logs);if(t)return t;const n=Uc.parse(r,e);if(n)return n;if(r.logs){const i={get:function(o,s){return s==="programErrorStack"?o.programErrorStack.stack:s==="program"?o.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=pu.parse(r.logs),new Proxy(r,i)}return r}const dt={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},N_=new Map([[dt.InstructionMissing,"8 byte instruction identifier not provided"],[dt.InstructionFallbackNotFound,"Fallback functions are not supported"],[dt.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[dt.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[dt.IdlInstructionStub,"The program was compiled without idl instructions"],[dt.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[dt.ConstraintMut,"A mut constraint was violated"],[dt.ConstraintHasOne,"A has one constraint was violated"],[dt.ConstraintSigner,"A signer constraint was violated"],[dt.ConstraintRaw,"A raw constraint was violated"],[dt.ConstraintOwner,"An owner constraint was violated"],[dt.ConstraintRentExempt,"A rent exemption constraint was violated"],[dt.ConstraintSeeds,"A seeds constraint was violated"],[dt.ConstraintExecutable,"An executable constraint was violated"],[dt.ConstraintState,"Deprecated Error, feel free to replace with something else"],[dt.ConstraintAssociated,"An associated constraint was violated"],[dt.ConstraintAssociatedInit,"An associated init constraint was violated"],[dt.ConstraintClose,"A close constraint was violated"],[dt.ConstraintAddress,"An address constraint was violated"],[dt.ConstraintZero,"Expected zero account discriminant"],[dt.ConstraintTokenMint,"A token mint constraint was violated"],[dt.ConstraintTokenOwner,"A token owner constraint was violated"],[dt.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[dt.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[dt.ConstraintMintDecimals,"A mint decimals constraint was violated"],[dt.ConstraintSpace,"A space constraint was violated"],[dt.ConstraintAccountIsNone,"A required account for the constraint is None"],[dt.RequireViolated,"A require expression was violated"],[dt.RequireEqViolated,"A require_eq expression was violated"],[dt.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[dt.RequireNeqViolated,"A require_neq expression was violated"],[dt.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[dt.RequireGtViolated,"A require_gt expression was violated"],[dt.RequireGteViolated,"A require_gte expression was violated"],[dt.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[dt.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[dt.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[dt.AccountDidNotDeserialize,"Failed to deserialize the account"],[dt.AccountDidNotSerialize,"Failed to serialize the account"],[dt.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[dt.AccountNotMutable,"The given account is not mutable"],[dt.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[dt.InvalidProgramId,"Program ID was not as expected"],[dt.InvalidProgramExecutable,"Program account is not executable"],[dt.AccountNotSigner,"The given account did not sign"],[dt.AccountNotSystemOwned,"The given account is not owned by the system program"],[dt.AccountNotInitialized,"The program expected this account to be already initialized"],[dt.AccountNotProgramData,"The given account is not a program data account"],[dt.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[dt.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[dt.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[dt.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[dt.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[dt.Deprecated,"The API being used is deprecated and should no longer be used"]]);var u1=function(){return u1=Object.assign||function(e){for(var t,n=1,i=arguments.length;ns.name===i);if(o.length!==1)throw new Rc(`Type not found: ${JSON.stringify(e)}`);return Kn.typeDefLayout(o[0],t,n)}else if("array"in e.type){let i=e.type.array[0],o=e.type.array[1],s=Kn.fieldLayout({name:void 0,type:i},t);return Mt.array(s,o,n)}else throw new Error(`Not yet implemented: ${e}`)}}}static typeDefLayout(e,t=[],n){if(e.type.kind==="struct"){const i=e.type.fields.map(o=>Kn.fieldLayout(o,t));return Mt.struct(i,n)}else if(e.type.kind==="enum"){let i=e.type.variants.map(o=>{const s=pr(o.name);if(o.fields===void 0)return Mt.struct([],s);const a=o.fields.map((u,l)=>u.hasOwnProperty("name")?Kn.fieldLayout(u,t):Kn.fieldLayout({type:u,name:l.toString()},t));return Mt.struct(a,s)});return n!==void 0?Mt.rustEnum(i).replicate(n):Mt.rustEnum(i,n)}else throw new Error(`Unknown type kint: ${e}`)}}const o5="global";class Of{constructor(e){this.idl=e,this.ixLayout=Of.parseIxLayout(e);const t=new Map;e.instructions.forEach(n=>{const i=s5(o5,n.name);t.set(Ua.encode(i),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=t}encode(e,t){return this._encode(o5,e,t)}_encode(e,t,n){const i=Zr.Buffer.alloc(1e3),o=pr(t),s=this.ixLayout.get(o);if(!s)throw new Error(`Unknown method: ${o}`);const a=s.encode(n,i),u=i.slice(0,a);return Zr.Buffer.concat([s5(e,t),u])}static parseIxLayout(e){const t=e.instructions.map(n=>{let i=n.args.map(s=>{var a,u;return Kn.fieldLayout(s,Array.from([...(a=e.accounts)!==null&&a!==void 0?a:[],...(u=e.types)!==null&&u!==void 0?u:[]]))});const o=pr(n.name);return[o,Mt.struct(i,o)]});return new Map(t)}decode(e,t="hex"){typeof e=="string"&&(e=t==="hex"?Zr.Buffer.from(e,"hex"):Ua.decode(e));let n=Ua.encode(e.slice(0,8)),i=e.slice(8);const o=this.sighashLayouts.get(n);return o?{data:o.layout.decode(i),name:o.name}:null}format(e,t){return so.format(e,t,this.idl)}}class so{static format(e,t,n){const i=n.instructions.filter(u=>e.name===u.name)[0];if(i===void 0)return console.error("Invalid instruction given"),null;const o=i.args.map(u=>({name:u.name,type:so.formatIdlType(u.type),data:so.formatIdlData(u,e.data[u.name],n.types)})),s=so.flattenIdlAccounts(i.accounts),a=t.map((u,l)=>l`;if("option"in e)return`Option<${this.formatIdlType(e.option)}>`;if("defined"in e)return e.defined;if("array"in e)return`Array<${e.array[0]}; ${e.array[1]}>`;throw new Error(`Unknown IDL type: ${e}`)}static formatIdlData(e,t,n){if(typeof e.type=="string")return t.toString();if(e.type.hasOwnProperty("vec"))return"["+t.map(i=>this.formatIdlData({name:"",type:e.type.vec},i)).join(", ")+"]";if(e.type.hasOwnProperty("option"))return t===null?"null":this.formatIdlData({name:"",type:e.type.option},t,n);if(e.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const i=n.filter(o=>o.name===e.type.defined);if(i.length!==1)throw new Error(`Type not found: ${e.type.defined}`);return so.formatIdlDataDefined(i[0],t,n)}return"unknown"}static formatIdlDataDefined(e,t,n){if(e.type.kind==="struct"){const i=e.type;return"{ "+Object.keys(t).map(s=>{const a=i.fields.filter(u=>u.name===s)[0];if(a===void 0)throw new Error("Unable to find type");return s+": "+so.formatIdlData(a,t[s],n)}).join(", ")+" }"}else{if(e.type.variants.length===0)return"{}";if(e.type.variants[0].name){const i=e.type.variants,o=Object.keys(t)[0],s=t[o],a=Object.keys(s).map(l=>{var d;const _=s[l],E=(d=i[o])===null||d===void 0?void 0:d.filter(m=>m.name===l)[0];if(E===void 0)throw new Error("Unable to find variant");return l+": "+so.formatIdlData(E,_,n)}).join(", "),u=pr(o,{pascalCase:!0});return a.length===0?u:`${u} { ${a} }`}else return"Tuple formatting not yet implemented"}}static flattenIdlAccounts(e,t){return e.map(n=>{const i=cR(n.name);if(n.hasOwnProperty("accounts")){const o=t?`${t} > ${i}`:i;return so.flattenIdlAccounts(n.accounts,o)}else return{...n,name:t?`${t} > ${i}`:i}}).flat()}}function cR(r){const e=r.replace(/([A-Z])/g," $1");return e.charAt(0).toUpperCase()+e.slice(1)}function s5(r,e){let t=uR(e),n=`${r}:${t}`;return Zr.Buffer.from(Fh(n).slice(0,8))}function ay(r,e){if(e.type.kind==="enum"){const t=e.type.variants.map(n=>n.fields?n.fields.map(i=>typeof i=="object"&&"name"in i?ja(r,i.type):ja(r,i)).reduce((i,o)=>i+o,0):0);return Math.max(...t)+1}return e.type.fields.map(t=>ja(r,t.type)).reduce((t,n)=>t+n,0)}function ja(r,e){var t,n;switch(e){case"bool":return 1;case"u8":return 1;case"i8":return 1;case"i16":return 2;case"u16":return 2;case"u32":return 4;case"i32":return 4;case"f32":return 4;case"u64":return 8;case"i64":return 8;case"f64":return 8;case"u128":return 16;case"i128":return 16;case"u256":return 32;case"i256":return 32;case"bytes":return 1;case"string":return 1;case"publicKey":return 32;default:if("vec"in e)return 1;if("option"in e)return 1+ja(r,e.option);if("coption"in e)return 4+ja(r,e.coption);if("defined"in e){const i=(n=(t=r.types)===null||t===void 0?void 0:t.filter(s=>s.name===e.defined))!==null&&n!==void 0?n:[];if(i.length!==1)throw new Rc(`Type not found: ${JSON.stringify(e)}`);let o=i[0];return ay(r,o)}if("array"in e){let i=e.array[0],o=e.array[1];return ja(r,i)*o}throw new Error(`Invalid type ${JSON.stringify(e)}`)}}const Uh=8;function D_(r){return Ae.Buffer.from(Fh(r).slice(0,Uh))}class Ls{constructor(e){if(e.accounts===void 0){this.accountLayouts=new Map;return}const t=e.accounts.map(n=>[n.name,Kn.typeDefLayout(n,e.types)]);this.accountLayouts=new Map(t),this.idl=e}async encode(e,t){const n=Zr.Buffer.alloc(1e3),i=this.accountLayouts.get(e);if(!i)throw new Error(`Unknown account: ${e}`);const o=i.encode(t,n);let s=n.slice(0,o),a=Ls.accountDiscriminator(e);return Zr.Buffer.concat([a,s])}decode(e,t){if(Ls.accountDiscriminator(e).compare(t.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(e,t)}decodeAny(e){const t=e.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(i=>Ls.accountDiscriminator(i).equals(t));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,e)}decodeUnchecked(e,t){const n=t.subarray(Uh),i=this.accountLayouts.get(e);if(!i)throw new Error(`Unknown account: ${e}`);return i.decode(n)}memcmp(e,t){const n=Ls.accountDiscriminator(e);return{offset:0,bytes:Ua.encode(t?Zr.Buffer.concat([n,t]):n)}}size(e){var t;return Uh+((t=ay(this.idl,e))!==null&&t!==void 0?t:0)}static accountDiscriminator(e){const t=`account:${pr(e,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return D_(t)}}class z_{constructor(e){if(e.events===void 0){this.layouts=new Map;return}const t=e.events.map(n=>{let i={name:n.name,type:{kind:"struct",fields:n.fields.map(o=>({name:o.name,type:o.type}))}};return[n.name,Kn.typeDefLayout(i,e.types)]});this.layouts=new Map(t),this.discriminators=new Map(e.events===void 0?[]:e.events.map(n=>[M0(j_(n.name)),n.name]))}decode(e){let t;try{t=Zr.Buffer.from(k5(e))}catch{return null}const n=M0(t.slice(0,8)),i=this.discriminators.get(n);if(i===void 0)return null;const o=this.layouts.get(i);if(!o)throw new Error(`Unknown event: ${i}`);return{data:o.decode(t.slice(8)),name:i}}}function j_(r){return D_(`event:${r}`)}class lR{constructor(e){if(e.types===void 0){this.typeLayouts=new Map;return}const t=e.types.map(n=>[n.name,Kn.typeDefLayout(n,e.types)]);this.typeLayouts=new Map(t),this.idl=e}encode(e,t){const n=Zr.Buffer.alloc(1e3),i=this.typeLayouts.get(e);if(!i)throw new Error(`Unknown type: ${e}`);const o=i.encode(t,n);return n.slice(0,o)}decode(e,t){const n=this.typeLayouts.get(e);if(!n)throw new Error(`Unknown type: ${e}`);return n.decode(t)}}class uy{constructor(e){this.instruction=new Of(e),this.accounts=new Ls(e),this.events=new z_(e),this.types=new lR(e)}}var hR=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ae.global<"u"?Ae.global:typeof self<"u"?self:{};function fR(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class Tn{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}var Rf=Tn;function dR(r,e){return e.property?r+"["+e.property+"]":r}class Cs extends Tn{isCount(){throw new Error("ExternalLayout is abstract")}}class F_ extends Cs{constructor(e,t,n){if(!(e instanceof Tn))throw new TypeError("layout must be a Layout");if(t===void 0)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof Uf||this.layout instanceof $_}decode(e,t){return t===void 0&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return n===void 0&&(n=0),this.layout.encode(e,t,n+this.offset)}}class Uf extends Tn{constructor(e,t){if(super(e,t),6o&&s instanceof Tn,!0)))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&n===void 0&&(n=t,t=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,t);return t+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,t){t===void 0&&(t=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let u=a.span;if(s=0u&&(u=a.getSpan(t,n)))}o=n,n+=u}return o+s-i}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?t=-1:0<=t&&(t+=n.span)}}}class q_{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class a5 extends q_{constructor(e,t){if(!(e instanceof Cs&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class H_ extends Tn{constructor(e,t,n){const i=e instanceof Uf||e instanceof $_;if(i)e=new a5(new F_(e));else if(e instanceof Cs&&e.isCount())e=new a5(e);else if(!(e instanceof q_))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof Tn))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let o=-1;t&&(o=t.span,0<=o&&i&&(o+=e.layout.span)),super(o,n),this.discriminator=e,this.usesPrefixDiscriminator=i,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){t===void 0&&(t=0);let n;const i=this.discriminator,o=i.decode(e,t);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(e,t+a)}else n=s.decode(e,t);return n}encode(e,t,n){n===void 0&&(n=0);const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(e[o.property],t,n),a+s.encode(e[s.property],t,n+a)}return i.encode(e,t,n)}addVariant(e,t,n){const i=new mR(this,e,t,n);return this.registry[e]=i,i}getVariant(e,t){let n=e;return Ae.Buffer.isBuffer(e)&&(t===void 0&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class mR extends Tn{constructor(e,t,n,i){if(!(e instanceof H_))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof Tn))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;t===void 0&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(t===void 0&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],t,n+i),o+=this.layout.getSpan(t,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}class wR extends Tn{constructor(e,t){if(!(e instanceof Cs&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof Cs||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){t===void 0&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let i=this.length;if(this.length instanceof Cs&&(i=e.length),!(Ae.Buffer.isBuffer(e)&&i===e.length))throw new TypeError(dR("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,i,"hex"),this.length instanceof Cs&&this.length.encode(i,t,n),i}}var bR=(r,e,t)=>new F_(r,e,t),vR=r=>new Uf(1,r),vo=r=>new Uf(4,r),_R=r=>new pR(r),Eo=r=>new gR(r),jr=(r,e,t)=>new yR(r,e,t),W_=(r,e,t)=>new H_(r,e,t),sl=(r,e)=>new wR(r,e);class ER{constructor(e){}encode(e,t){switch(pr(e)){case"createAccount":return AR(t);case"assign":return kR(t);case"transfer":return SR(t);case"createAccountWithSeed":return IR(t);case"advanceNonceAccount":return MR(t);case"withdrawNonceAccount":return PR(t);case"initializeNonceAccount":return BR(t);case"authorizeNonceAccount":return LR(t);case"allocate":return CR(t);case"allocateWithSeed":return TR(t);case"assignWithSeed":return OR(t);case"transferWithSeed":return RR(t);default:throw new Error(`Invalid instruction: ${e}`)}}encodeState(e,t){throw new Error("System does not have state")}}class xR extends Rf{constructor(e){super(-1,e),this.property=e,this.layout=jr([vo("length"),vo("lengthPadding"),sl(bR(vo(),-8),"chars")],this.property)}encode(e,t,n=0){if(e==null)return this.layout.span;const i={chars:Ae.Buffer.from(e,"utf8")};return this.layout.encode(i,t,n)}decode(e,t=0){return this.layout.decode(e,t).chars.toString()}getSpan(e,t=0){return vo().span+vo().span+new g1(new Uint8Array(e).slice(t,t+4),10,"le").toNumber()}}function Nf(r){return new xR(r)}function ai(r){return sl(32,r)}function AR({lamports:r,space:e,owner:t}){return ui({createAccount:{lamports:r,space:e,owner:t.toBuffer()}})}function kR({owner:r}){return ui({assign:{owner:r.toBuffer()}})}function SR({lamports:r}){return ui({transfer:{lamports:r}})}function IR({base:r,seed:e,lamports:t,space:n,owner:i}){return ui({createAccountWithSeed:{base:r.toBuffer(),seed:e,lamports:t,space:n,owner:i.toBuffer()}},Gr.getVariant(3).span+e.length)}function BR({authorized:r}){return ui({initializeNonceAccount:{authorized:r.toBuffer()}})}function MR({authorized:r}){return ui({advanceNonceAccount:{authorized:r.toBuffer()}})}function PR({lamports:r}){return ui({withdrawNonceAccount:{lamports:r}})}function LR({authorized:r}){return ui({authorizeNonceAccount:{authorized:r.toBuffer()}})}function CR({space:r}){return ui({allocate:{space:r}})}function TR({base:r,seed:e,space:t,owner:n}){return ui({allocateWithSeed:{base:r.toBuffer(),seed:e,space:t,owner:n.toBuffer()}},Gr.getVariant(9).span+e.length)}function OR({base:r,seed:e,owner:t}){return ui({assignWithSeed:{base:r.toBuffer(),seed:e,owner:t.toBuffer()}},Gr.getVariant(10).span+e.length)}function RR({lamports:r,seed:e,owner:t}){return ui({transferWithSeed:{lamports:r,seed:e,owner:t.toBuffer()}},Gr.getVariant(11).span+e.length)}const Gr=W_(vo("instruction"));Gr.addVariant(0,jr([Eo("lamports"),Eo("space"),ai("owner")]),"createAccount");Gr.addVariant(1,jr([ai("owner")]),"assign");Gr.addVariant(2,jr([Eo("lamports")]),"transfer");Gr.addVariant(3,jr([ai("base"),Nf("seed"),Eo("lamports"),Eo("space"),ai("owner")]),"createAccountWithSeed");Gr.addVariant(4,jr([ai("authorized")]),"advanceNonceAccount");Gr.addVariant(5,jr([Eo("lamports")]),"withdrawNonceAccount");Gr.addVariant(6,jr([ai("authorized")]),"initializeNonceAccount");Gr.addVariant(7,jr([ai("authorized")]),"authorizeNonceAccount");Gr.addVariant(8,jr([Eo("space")]),"allocate");Gr.addVariant(9,jr([ai("base"),Nf("seed"),Eo("space"),ai("owner")]),"allocateWithSeed");Gr.addVariant(10,jr([ai("base"),Nf("seed"),ai("owner")]),"assignWithSeed");Gr.addVariant(11,jr([Eo("lamports"),Nf("seed"),ai("owner")]),"transferWithSeed");function ui(r,e){const t=Ae.Buffer.alloc(e??UR),n=Gr.encode(r,t);return e===void 0?t.slice(0,n):t}const UR=Math.max(...Object.values(Gr.registry).map(r=>r.span));class NR{constructor(e){this.idl=e}async encode(e,t){switch(e){case"nonce":{const n=Ae.Buffer.alloc(gy),i=Z_.encode(t,n);return n.slice(0,i)}default:throw new Error(`Invalid account name: ${e}`)}}decode(e,t){return this.decodeUnchecked(e,t)}decodeUnchecked(e,t){switch(e){case"nonce":return DR(t);default:throw new Error(`Invalid account name: ${e}`)}}memcmp(e,t){switch(e){case"nonce":return{dataSize:gy};default:throw new Error(`Invalid account name: ${e}`)}}size(e){var t;return(t=ay(this.idl,e))!==null&&t!==void 0?t:0}}function DR(r){return Z_.decode(r)}class zR extends Rf{constructor(e,t,n,i){super(e.span,i),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}function u5(r){return new zR(sl(32),e=>new Kt(e),e=>e.toBuffer(),r)}const Z_=jr([vo("version"),vo("state"),u5("authorizedPubkey"),u5("nonce"),jr([_R("lamportsPerSignature")],"feeCalculator")]);class jR{constructor(e){}decode(e){throw new Error("System program does not have events")}}class FR{constructor(e){}encode(e,t){throw new Error("System does not have user-defined types")}decode(e,t){throw new Error("System does not have user-defined types")}}class G_{constructor(e){this.instruction=new ER(e),this.accounts=new NR(e),this.events=new jR(e),this.types=new FR(e)}}function $R(r){return new TextDecoder().decode(Fh(r))}var KR=Object.freeze({__proto__:null,hash:$R});function VR(r,e,t){const n=Zr.Buffer.concat([r.toBuffer(),Zr.Buffer.from(e),t.toBuffer()]);return new Kt(Fh(n))}function Y_(r,...e){let t=[Zr.Buffer.from([97,110,99,104,111,114])];e.forEach(i=>{t.push(i instanceof Zr.Buffer?i:Bn(i).toBuffer())});const[n]=Kt.findProgramAddressSync(t,Bn(r));return n}var qR=Object.freeze({__proto__:null,createWithSeedSync:VR,associated:Y_});const cy=new Kt("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),ly=new Kt("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function HR({mint:r,owner:e}){return Kt.findProgramAddressSync([e.toBuffer(),cy.toBuffer(),r.toBuffer()],ly)[0]}var WR=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:cy,ASSOCIATED_PROGRAM_ID:ly,associatedAddress:HR}),h1={exports:{}};(function(r,e){var t=typeof self<"u"?self:hR,n=function(){function o(){this.fetch=!1,this.DOMException=t.DOMException}return o.prototype=t,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function u(h){return h&&DataView.prototype.isPrototypeOf(h)}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(h){return h&&l.indexOf(Object.prototype.toString.call(h))>-1};function _(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function E(h){return typeof h!="string"&&(h=String(h)),h}function m(h){var y={next:function(){var L=h.shift();return{done:L===void 0,value:L}}};return a.iterable&&(y[Symbol.iterator]=function(){return y}),y}function w(h){this.map={},h instanceof w?h.forEach(function(y,L){this.append(L,y)},this):Array.isArray(h)?h.forEach(function(y){this.append(y[0],y[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(y){this.append(y,h[y])},this)}w.prototype.append=function(h,y){h=_(h),y=E(y);var L=this.map[h];this.map[h]=L?L+", "+y:y},w.prototype.delete=function(h){delete this.map[_(h)]},w.prototype.get=function(h){return h=_(h),this.has(h)?this.map[h]:null},w.prototype.has=function(h){return this.map.hasOwnProperty(_(h))},w.prototype.set=function(h,y){this.map[_(h)]=E(y)},w.prototype.forEach=function(h,y){for(var L in this.map)this.map.hasOwnProperty(L)&&h.call(y,this.map[L],L,this)},w.prototype.keys=function(){var h=[];return this.forEach(function(y,L){h.push(L)}),m(h)},w.prototype.values=function(){var h=[];return this.forEach(function(y){h.push(y)}),m(h)},w.prototype.entries=function(){var h=[];return this.forEach(function(y,L){h.push([L,y])}),m(h)},a.iterable&&(w.prototype[Symbol.iterator]=w.prototype.entries);function v(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function A(h){return new Promise(function(y,L){h.onload=function(){y(h.result)},h.onerror=function(){L(h.error)}})}function I(h){var y=new FileReader,L=A(y);return y.readAsArrayBuffer(h),L}function B(h){var y=new FileReader,L=A(y);return y.readAsText(h),L}function S(h){for(var y=new Uint8Array(h),L=new Array(y.length),F=0;F-1?y:h}function H(h,y){y=y||{};var L=y.body;if(h instanceof H){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,y.headers||(this.headers=new w(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!L&&h._bodyInit!=null&&(L=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=y.credentials||this.credentials||"same-origin",(y.headers||!this.headers)&&(this.headers=new w(y.headers)),this.method=j(y.method||this.method||"GET"),this.mode=y.mode||this.mode||null,this.signal=y.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&L)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(L)}H.prototype.clone=function(){return new H(this,{body:this._bodyInit})};function N(h){var y=new FormData;return h.trim().split("&").forEach(function(L){if(L){var F=L.split("="),K=F.shift().replace(/\+/g," "),V=F.join("=").replace(/\+/g," ");y.append(decodeURIComponent(K),decodeURIComponent(V))}}),y}function c(h){var y=new w,L=h.replace(/\r?\n[\t ]+/g," ");return L.split(/\r?\n/).forEach(function(F){var K=F.split(":"),V=K.shift().trim();if(V){var W=K.join(":").trim();y.append(V,W)}}),y}C.call(H.prototype);function p(h,y){y||(y={}),this.type="default",this.status=y.status===void 0?200:y.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in y?y.statusText:"OK",this.headers=new w(y.headers),this.url=y.url||"",this._initBody(h)}C.call(p.prototype),p.prototype.clone=function(){return new p(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new w(this.headers),url:this.url})},p.error=function(){var h=new p(null,{status:0,statusText:""});return h.type="error",h};var x=[301,302,303,307,308];p.redirect=function(h,y){if(x.indexOf(y)===-1)throw new RangeError("Invalid status code");return new p(null,{status:y,headers:{location:h}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(y,L){this.message=y,this.name=L;var F=Error(y);this.stack=F.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function g(h,y){return new Promise(function(L,F){var K=new H(h,y);if(K.signal&&K.signal.aborted)return F(new s.DOMException("Aborted","AbortError"));var V=new XMLHttpRequest;function W(){V.abort()}V.onload=function(){var Z={status:V.status,statusText:V.statusText,headers:c(V.getAllResponseHeaders()||"")};Z.url="responseURL"in V?V.responseURL:Z.headers.get("X-Request-URL");var G="response"in V?V.response:V.responseText;L(new p(G,Z))},V.onerror=function(){F(new TypeError("Network request failed"))},V.ontimeout=function(){F(new TypeError("Network request failed"))},V.onabort=function(){F(new s.DOMException("Aborted","AbortError"))},V.open(K.method,K.url,!0),K.credentials==="include"?V.withCredentials=!0:K.credentials==="omit"&&(V.withCredentials=!1),"responseType"in V&&a.blob&&(V.responseType="blob"),K.headers.forEach(function(Z,G){V.setRequestHeader(G,Z)}),K.signal&&(K.signal.addEventListener("abort",W),V.onreadystatechange=function(){V.readyState===4&&K.signal.removeEventListener("abort",W)}),V.send(typeof K._bodyInit>"u"?null:K._bodyInit)})}return g.polyfill=!0,o.fetch||(o.fetch=g,o.Headers=w,o.Request=H,o.Response=p),s.Headers=w,s.Request=H,s.Response=p,s.fetch=g,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(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,r.exports=e})(h1,h1.exports);var ZR=fR(h1.exports);async function GR(r,e,t=5){const n=`https://api.apr.dev/api/v0/program/${e.toString()}/latest?limit=${t}`,[i,o]=await Promise.all([J_(r,e),ZR(n)]),s=(await o.json()).filter(u=>!u.aborted&&u.state==="Built"&&u.verified==="Verified");if(s.length===0)return null;const a=s[0];return i.slot.toNumber()!==a.verified_slot?null:a}async function J_(r,e){const t=await r.getAccountInfo(e);if(t===null)throw new Error("program account not found");const{program:n}=f1(t.data),i=await r.getAccountInfo(n.programdataAddress);if(i===null)throw new Error("program data account not found");const{programData:o}=f1(i.data);return o}const YR=Mt.rustEnum([Mt.struct([],"uninitialized"),Mt.struct([Mt.option(Mt.publicKey(),"authorityAddress")],"buffer"),Mt.struct([Mt.publicKey("programdataAddress")],"program"),Mt.struct([Mt.u64("slot"),Mt.option(Mt.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,Mt.u32());function f1(r){return YR.decode(r)}var JR=Object.freeze({__proto__:null,verifiedBuild:GR,fetchData:J_,decodeUpgradeableLoaderState:f1}),XR=Object.freeze({__proto__:null,sha256:KR,rpc:JO,publicKey:qR,bytes:RO,token:WR,features:rR,registry:JR});function QR(r){return"accounts"in r}async function eU(r){const e=(await Kt.findProgramAddress([],r))[0];return await Kt.createWithSeed(e,tU(),r)}function tU(){return"anchor:idl"}const rU=Mt.struct([Mt.publicKey("authority"),Mt.vecU8("data")]);function nU(r){return rU.decode(r)}function al(r,e){var t,n;let i={};const o=r.args?r.args.length:0;if(e.length>o){if(e.length!==o+1)throw new Error(`provided too many arguments ${e} to instruction ${r==null?void 0:r.name} expecting: ${(n=(t=r.args)===null||t===void 0?void 0:t.map(s=>s.name))!==null&&n!==void 0?n:[]}`);i=e.pop()}return[e,i]}class Nh{static build(e,t,n){if(e.name==="_inner")throw new Rc("the _inner name is reserved");const i=(...o)=>{const[s,a]=al(e,[...o]);ey(e.accounts,a.accounts),iU(e,...o);const u=i.accounts(a.accounts);return a.remainingAccounts!==void 0&&u.push(...a.remainingAccounts),oy("debug-logs")&&console.log("Outgoing account metas:",u),new Dc({keys:u,programId:n,data:t(e.name,P_(e,...s))})};return i.accounts=o=>Nh.accountsArray(o,e.accounts,n,e.name),i}static accountsArray(e,t,n,i){return e?t.map(o=>{if(("accounts"in o?o.accounts:void 0)!==void 0){const a=e[o.name];return Nh.accountsArray(a,o.accounts,n,i).flat()}else{const a=o;let u;try{u=Bn(e[o.name])}catch{throw new Error(`Wrong input type for account "${o.name}" in the instruction accounts object${i!==void 0?' for instruction "'+i+'"':""}. Expected PublicKey or string.`)}const l=a.isOptional&&u.equals(n),d=a.isMut&&!l,_=a.isSigner&&!l;return{pubkey:u,isWritable:d,isSigner:_}}}).flat():[]}}function iU(r,...e){}class oU{static build(e,t){return(...i)=>{var o,s,a;const[,u]=al(e,[...i]),l=new Dh;if(u.preInstructions&&u.instructions)throw new Error("instructions is deprecated, use preInstructions");return(o=u.preInstructions)===null||o===void 0||o.forEach(d=>l.add(d)),(s=u.instructions)===null||s===void 0||s.forEach(d=>l.add(d)),l.add(t(...i)),(a=u.postInstructions)===null||a===void 0||a.forEach(d=>l.add(d)),l}}}class sU{static build(e,t,n,i){return async(...s)=>{var a;const u=t(...s),[,l]=al(e,[...s]);if(i.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await i.sendAndConfirm(u,(a=l.signers)!==null&&a!==void 0?a:[],l.options)}catch(d){throw sy(d,n)}}}}class aU{static build(e,t,n,i){var o;const s={};return(o=e.accounts)===null||o===void 0||o.forEach(a=>{const u=pr(a.name);s[u]=new X_(e,a,n,i,t)}),s}}class X_{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(e,t,n,i,o){this._idlAccount=t,this._programId=n,this._provider=i??Oc(),this._coder=o??new uy(e),this._size=this._coder.accounts.size(t)}async fetchNullable(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);return n}async fetchNullableAndContext(e,t){const n=await this.getAccountInfoAndContext(e,t),{value:i,context:o}=n;return{data:i&&i.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,i.data):null,context:o}}async fetch(e,t){const{data:n}=await this.fetchNullableAndContext(e,t);if(n===null)throw new Error(`Account does not exist or has no data ${e.toString()}`);return n}async fetchAndContext(e,t){const{data:n,context:i}=await this.fetchNullableAndContext(e,t);if(n===null)throw new Error(`Account does not exist ${e.toString()}`);return{data:n,context:i}}async fetchMultiple(e,t){return(await this.fetchMultipleAndContext(e,t)).map(i=>i?i.data:null)}async fetchMultipleAndContext(e,t){return(await iy(this._provider.connection,e.map(i=>Bn(i)),t)).map(i=>{if(i==null)return null;const{account:o,context:s}=i;return{data:this._coder.accounts.decode(this._idlAccount.name,o.data),context:s}})}async all(e){const t=this.coder.accounts.memcmp(this._idlAccount.name,e instanceof Ae.Buffer?e:void 0),n=[];return(t==null?void 0:t.offset)!=null&&(t==null?void 0:t.bytes)!=null&&n.push({memcmp:{offset:t.offset,bytes:t.bytes}}),(t==null?void 0:t.dataSize)!=null&&n.push({dataSize:t.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(e)?e:[]]})).map(({pubkey:o,account:s})=>({publicKey:o,account:this._coder.accounts.decode(this._idlAccount.name,s.data)}))}subscribe(e,t){const n=Ru.get(e.toString());if(n)return n.ee;const i=new EE;e=Bn(e);const o=this._provider.connection.onAccountChange(e,s=>{const a=this._coder.accounts.decode(this._idlAccount.name,s.data);i.emit("change",a)},t);return Ru.set(e.toString(),{ee:i,listener:o}),i}async unsubscribe(e){let t=Ru.get(e.toString());if(!t){console.warn("Address is not subscribed");return}Ru&&await this._provider.connection.removeAccountChangeListener(t.listener).then(()=>{Ru.delete(e.toString())}).catch(console.error)}async createInstruction(e,t){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return jh.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:e.publicKey,space:t??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(t??n),programId:this._programId})}async associated(...e){const t=await this.associatedAddress(...e);return await this.fetch(t)}async associatedAddress(...e){return await Y_(this._programId,...e)}async getAccountInfo(e,t){return await this._provider.connection.getAccountInfo(Bn(e),t)}async getAccountInfoAndContext(e,t){return await this._provider.connection.getAccountInfoAndContext(Bn(e),t)}}const Ru=new Map,d1="Program log: ",Q_="Program data: ",uU=d1.length,cU=Q_.length;class eE{constructor(e,t,n){this._programId=e,this._provider=t,this._eventParser=new hy(e,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(e,t){var n;let i=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(e)||this._eventListeners.set(e,[]),this._eventListeners.set(e,((n=this._eventListeners.get(e))!==null&&n!==void 0?n:[]).concat(i)),this._eventCallbacks.set(i,[e,t]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(o,s)=>{if(!o.err)for(const a of this._eventParser.parseLogs(o.logs)){const u=this._eventListeners.get(a.name);u&&u.forEach(l=>{const d=this._eventCallbacks.get(l);if(d){const[,_]=d;_(a.data,s.slot,o.signature)}})}})),i}async removeEventListener(e){const t=this._eventCallbacks.get(e);if(!t)throw new Error(`Event listener ${e} doesn't exist!`);const[n]=t;let i=this._eventListeners.get(n);if(!i)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(e),i=i.filter(o=>o!==e),this._eventListeners.set(n,i),i.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class hy{constructor(e,t){this.coder=t,this.programId=e}*parseLogs(e,t=!1){const n=new hU(e),i=new lU;let o=n.next();for(;o!==null;){let[s,a,u]=this.handleLog(i,o,t);s&&(yield s),a&&i.push(a),u&&i.pop(),o=n.next()}}handleLog(e,t,n){return e.stack.length>0&&e.program()===this.programId.toString()?this.handleProgramLog(t,n):[null,...this.handleSystemLog(t)]}handleProgramLog(e,t){if(e.startsWith(d1)||e.startsWith(Q_)){const n=e.startsWith(d1)?e.slice(uU):e.slice(cU),i=this.coder.events.decode(n);if(t&&i===null)throw new Error(`Unable to decode event ${n}`);return[i,null,!1]}else return[null,...this.handleSystemLog(e)]}handleSystemLog(e){const t=e.split(":")[0];return t.match(/^Program (.*) success/g)!==null?[null,!0]:t.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:t.includes("invoke")?["cpi",!1]:[null,!1]}}class lU{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(e){this.stack.push(e)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class hU{constructor(e){this.logs=e}next(){if(this.logs.length===0)return null;let e=this.logs[0];return this.logs=this.logs.slice(1),e}}class fU{static build(e,t,n,i,o,s,a){return async(...l)=>{var d;const _=t(...l),[,E]=al(e,[...l]);let m;if(i.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{m=await i.simulate(_,E.signers,(d=E.options)===null||d===void 0?void 0:d.commitment)}catch(A){throw sy(A,n)}if(m===void 0)throw new Error("Unable to simulate transaction");const w=m.logs;if(!w)throw new Error("Simulated logs not found");const v=[];if(a.events){let A=new hy(s,o);for(const I of A.parseLogs(w))v.push(I)}return{events:v,raw:w}}}}function S0(r){return new tE(sl(8),e=>fy.fromBuffer(e),e=>e.toBuffer(),r)}function Vl(r){return new tE(sl(32),e=>new Kt(e),e=>e.toBuffer(),r)}function I0(r,e){return new dU(r,e)}class tE extends Rf{constructor(e,t,n,i){super(e.span,i),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}class dU extends Rf{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=vo()}encode(e,t,n=0){return e==null?this.layout.span+this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+4)+4)}decode(e,t=0){const n=this.discriminator.decode(e,t);if(n===0)return null;if(n===1)return this.layout.decode(e,t+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e,t=0){return this.layout.getSpan(e,t+4)+4}}class fy extends g1{toBuffer(){const e=super.toArray().reverse(),t=Ae.Buffer.from(e);if(t.length===8)return t;if(t.length>=8)throw new Error("u64 too large");const n=Ae.Buffer.alloc(8);return t.copy(n),n}static fromBuffer(e){if(e.length!==8)throw new Error(`Invalid buffer length: ${e.length}`);return new fy([...e].reverse().map(t=>`00${t.toString(16)}`.slice(-2)).join(""),16)}}const pU=jr([Vl("mint"),Vl("owner"),S0("amount"),I0(Vl(),"delegate"),(r=>{const e=W_(vR("discriminator"),null,r);return e.addVariant(0,jr([]),"uninitialized"),e.addVariant(1,jr([]),"initialized"),e.addVariant(2,jr([]),"frozen"),e})("state"),I0(S0(),"isNative"),S0("delegatedAmount"),I0(Vl(),"closeAuthority")]);function gU(r){return pU.decode(r)}class Nc{constructor(e,t,n,i,o,s,a,u){this._accounts=t,this._provider=n,this._programId=i,this._idlIx=o,this._idlTypes=a,this._customResolver=u,this._args=e,this._accountStore=new yU(n,s,this._programId)}args(e){this._args=e}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:e,resolved:t}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=e,t}return 0}resolveOptionalsHelper(e,t){const n={};for(const i of t){const o=i.name,s=e[o];s!==void 0&&(nE(s)?QR(i)?n[o]=this.resolveOptionalsHelper(s,i.accounts):n[o]=iE(s,!0):s!==null?n[o]=Bn(s):i.isOptional&&(n[o]=this._programId))}return n}resolveOptionals(e){Object.assign(this._accounts,this.resolveOptionalsHelper(e,this._idlIx.accounts))}get(e){const t=e.reduce((n,i)=>n&&n[i],this._accounts);if(t&&t.toBase58)return t}set(e,t){let n=this._accounts;e.forEach((i,o)=>{o==e.length-1&&(n[i]=t),n[i]=n[i]||{},n=n[i]})}async resolveConst(e,t=[]){for(let n=0;n0&&!this.get([...t,u])&&await this.autoPopulatePda(a,t)&&(n+=1)}return n}async resolveRelations(e,t=[]){let n=0;for(let i=0;i!this.get([...t,pr(E)]));if(n+=_.length,_.length>0){const E=await this._accountStore.fetchAccount({publicKey:d});await Promise.all(_.map(async m=>{const w=pr(m);return this.set([...t,w],E[w]),E[w]}))}}}return n}async autoPopulatePda(e,t=[]){if(!e.pda||!e.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(e.pda.seeds.map(s=>this.toBuffer(s,t)));if(n.some(s=>typeof s>"u"))return;const i=await this.parseProgramId(e,t);if(!i)return;const[o]=await Kt.findProgramAddress(n,i);this.set([...t,pr(e.name)],o)}async parseProgramId(e,t=[]){var n;if(!(!((n=e.pda)===null||n===void 0)&&n.programId))return this._programId;switch(e.pda.programId.kind){case"const":return new Kt(this.toBufferConst(e.pda.programId.value));case"arg":return this.argValue(e.pda.programId);case"account":return await this.accountValue(e.pda.programId,t);default:throw new Error(`Unexpected program seed kind: ${e.pda.programId.kind}`)}}async toBuffer(e,t=[]){switch(e.kind){case"const":return this.toBufferConst(e);case"arg":return await this.toBufferArg(e);case"account":return await this.toBufferAccount(e,t);default:throw new Error(`Unexpected seed kind: ${e.kind}`)}}getType(e,t=[]){if(t.length>0&&e.defined){const n=this._idlTypes.find(s=>s.name===e.defined);if(!n)throw new Error(`Cannot find type ${e.defined}`);const o=n.type.fields.find(s=>s.name===t[0]);return this.getType(o.type,t.slice(1))}return e}toBufferConst(e){return this.toBufferValue(this.getType(e.type,(e.path||"").split(".").slice(1)),e.value)}async toBufferArg(e){const t=this.argValue(e);if(!(typeof t>"u"))return this.toBufferValue(this.getType(e.type,(e.path||"").split(".").slice(1)),t)}argValue(e){const t=e.path.split("."),n=pr(t[0]),i=this._idlIx.args.findIndex(o=>o.name===n);if(i===-1)throw new Error(`Unable to find argument for seed: ${n}`);return t.slice(1).reduce((o,s)=>(o||{})[s],this._args[i])}async toBufferAccount(e,t=[]){const n=await this.accountValue(e,t);if(n)return this.toBufferValue(e.type,n)}async accountValue(e,t=[]){const n=e.path.split("."),i=n[0],o=this.get([...t,pr(i)]);if(o===null)throw new Error("fieldPubkey is null");if(n.length===1)return o;const s=await this._accountStore.fetchAccount({publicKey:o,name:e.account});return this.parseAccountValue(s,n.slice(1))}parseAccountValue(e,t){let n;for(;t.length>0;)n=e[pr(t[0])],t=t.slice(1);return n}toBufferValue(e,t){switch(e){case"u8":return Ae.Buffer.from([t]);case"u16":let n=Ae.Buffer.alloc(2);return n.writeUInt16LE(t),n;case"u32":let i=Ae.Buffer.alloc(4);return i.writeUInt32LE(t),i;case"u64":let o=Ae.Buffer.alloc(8);return o.writeBigUInt64LE(BigInt(t)),o;case"string":return Ae.Buffer.from(I_(t));case"publicKey":return t.toBuffer();default:if(e.array)return Ae.Buffer.from(t);throw new Error(`Unexpected seed type: ${e}`)}}}Nc.CONST_ACCOUNTS={associatedTokenProgram:ly,rent:vE,systemProgram:jh.programId,tokenProgram:cy,clock:_E};class yU{constructor(e,t,n){this._provider=e,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=t}async ensureIdl(e){if(!this._idls[e.toBase58()]){const t=await Ws.fetchIdl(e,this._provider);if(t){const n=new Ws(t,e,this._provider);this._idls[e.toBase58()]=n.account}}return this._idls[e.toBase58()]}async fetchAccount({publicKey:e,name:t,programId:n=this._programId}){const i=e.toString();if(!this._cache.has(i))if(t==="TokenAccount"){const o=await this._provider.connection.getAccountInfo(e);if(o===null)throw new Error(`invalid account info for ${i}`);const s=gU(o.data);this._cache.set(i,s)}else if(t){const o=await this.ensureIdl(n);if(o){const s=o[pr(t)];if(s){const a=await s.fetch(e);this._cache.set(i,a)}}}else{const o=await this._provider.connection.getAccountInfo(e);if(o===null)throw new Error(`invalid account info for ${i}`);const s=o.data,a=await this.ensureIdl(o.owner);if(a){const u=Object.values(a)[0];if(!u)throw new Error("No accounts for this program");const l=u.coder.accounts.decodeAny(s);this._cache.set(i,l)}}return this._cache.get(i)}}class rE{static build(e,t,n,i,o,s,a,u,l,d,_){return(...E)=>new mU(E,i,o,s,a,u,e,t,n,l,d,_)}}function nE(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function iE(r,e){const t={};for(const n in r){const i=r[n];if(i===null){if(e)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");continue}t[n]=nE(i)?iE(i,!0):Bn(i)}return t}class mU{constructor(e,t,n,i,o,s,a,u,l,d,_,E){this._ixFn=t,this._txFn=n,this._rpcFn=i,this._simulateFn=o,this._viewFn=s,this._programId=u,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=e,this._accountsResolver=new Nc(e,this._accounts,a,u,l,d,_,E)}args(e){this._args=e,this._accountsResolver.args(e)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(e){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(e),this}accountsStrict(e){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(e),this}signers(e){return this._signers=this._signers.concat(e),this}remainingAccounts(e){return this._remainingAccounts=this._remainingAccounts.concat(e),this}preInstructions(e){return this._preInstructions=this._preInstructions.concat(e),this}postInstructions(e){return this._postInstructions=this._postInstructions.concat(e),this}async rpc(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async rpcAndKeys(e){return{pubkeys:await this.pubkeys(),signature:await this.rpc(e)}}async view(e){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async simulate(e){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:e})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class wU{static build(e,t,n,i){const o=t.accounts.find(u=>u.isMut),s=!!t.returns;return o||!s?void 0:async(...u)=>{var l,d;let _=await n(...u);const E=`Program return: ${e} `;let m=_.raw.find(I=>I.startsWith(E));if(!m)throw new Error("View expected return log");let w=B_(m.slice(E.length)),v=t.returns;if(!v)throw new Error("View expected return type");return Kn.fieldLayout({type:v},Array.from([...(l=i.accounts)!==null&&l!==void 0?l:[],...(d=i.types)!==null&&d!==void 0?d:[]])).decode(w)}}}class bU{static build(e,t,n,i,o){const s={},a={},u={},l={},d={},_={},E=M_(e),m=e.accounts?aU.build(e,t,n,i):{};return e.instructions.forEach(w=>{const v=Nh.build(w,(R,j)=>t.instruction.encode(R,j),n),A=oU.build(w,v),I=sU.build(w,A,E,i),B=fU.build(w,A,E,i,t,n,e),S=wU.build(n,w,B,e),P=rE.build(i,n,w,v,A,I,B,S,m,e.types||[],o&&o(w)),C=pr(w.name);a[C]=v,u[C]=A,s[C]=I,l[C]=B,d[C]=P,S&&(_[C]=S)}),[s,a,u,m,l,d,_]}}class Ws{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(e,t,n,i,o){t=Bn(t),n||(n=Oc()),this._idl=e,this._provider=n,this._programId=t,this._coder=i??new uy(e),this._events=new eE(this._programId,n,this._coder);const[s,a,u,l,d,_,E]=bU.build(e,this._coder,t,n,o??(()=>{}));this.rpc=s,this.instruction=a,this.transaction=u,this.account=l,this.simulate=d,this.methods=_,this.views=E}static async at(e,t){const n=Bn(e),i=await Ws.fetchIdl(n,t);if(!i)throw new Error(`IDL not found for program: ${e.toString()}`);return new Ws(i,n,t)}static async fetchIdl(e,t){t=t??Oc();const n=Bn(e),i=await eU(n),o=await t.connection.getAccountInfo(i);if(!o)return null;let s=nU(o.data.slice(8));const a=kO(s.data);return JSON.parse(S_(a))}addEventListener(e,t){return this._events.addEventListener(e,t)}async removeEventListener(e){return await this._events.removeEventListener(e)}}const vU=new Kt("11111111111111111111111111111111");function _U(r){return new Ws(oE,vU,r,EU())}function EU(){return new G_(oE)}const oE={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class xU{static system(e){return _U(e)}}const AU=Object.freeze(Object.defineProperty({__proto__:null,AccountClient:X_,AnchorError:za,AnchorProvider:R_,BN:g1,BorshAccountsCoder:Ls,BorshCoder:uy,BorshEventCoder:z_,BorshInstructionCoder:Of,DISCRIMINATOR_SIZE:Uh,EventManager:eE,EventParser:hy,IdlError:Rc,LangErrorCode:dt,LangErrorMessage:N_,MethodsBuilderFactory:rE,Native:xU,Program:Ws,ProgramError:Uc,ProgramErrorStack:pu,SystemCoder:G_,eventDiscriminator:j_,getProvider:Oc,parseIdlErrors:M_,setProvider:QO,splitArgsAndCtx:al,toInstruction:P_,translateAddress:Bn,translateError:sy,utils:XR,validateAccounts:ey,web3:E5},Symbol.toStringTag,{value:"Module"})),sE=_5(AU);var Uu={},Nu={},c5;function kU(){if(c5)return Nu;c5=1,Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.PythOracleEventCoder=void 0;var r=function(){function e(){}return e.prototype.decode=function(t){throw new Error("Pyth oracle program does not have events")},e}();return Nu.PythOracleEventCoder=r,Nu}var Du={},l5;function SU(){if(l5)return Du;l5=1;var r=Nt&&Nt.__awaiter||function(n,i,o,s){function a(u){return u instanceof o?u:new o(function(l){l(u)})}return new(o||(o=Promise))(function(u,l){function d(m){try{E(s.next(m))}catch(w){l(w)}}function _(m){try{E(s.throw(m))}catch(w){l(w)}}function E(m){m.done?u(m.value):a(m.value).then(d,_)}E((s=s.apply(n,i||[])).next())})},e=Nt&&Nt.__generator||function(n,i){var o={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},s,a,u,l;return l={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function d(E){return function(m){return _([E,m])}}function _(E){if(s)throw new TypeError("Generator is already executing.");for(;o;)try{if(s=1,a&&(u=E[0]&2?a.return:E[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,E[1])).done)return u;switch(a=0,u&&(E=[E[0]&2,u.value]),E[0]){case 0:case 1:u=E;break;case 4:return o.label++,{value:E[1],done:!1};case 5:o.label++,a=E[1],E=[0];continue;case 7:E=o.ops.pop(),o.trys.pop();continue;default:if(u=o.trys,!(u=u.length>0&&u[u.length-1])&&(E[0]===6||E[0]===2)){o=0;continue}if(E[0]===3&&(!u||E[1]>u[0]&&E[1]d)throw new Error("The metadata is too long");var j=v.subarray(0,S);return s.Buffer.concat([B,j])}else{var H=I.encode(w,v),j=v.subarray(0,H);return s.Buffer.concat([B,j])}},E.parseIxLayout=function(m){var w=m.instructions.map(function(v){var A=v.args.map(function(B){var S,P;return l.IdlCoder.fieldLayout(B,Array.from(n(n([],(S=m.accounts)!==null&&S!==void 0?S:[]),(P=m.types)!==null&&P!==void 0?P:[])))}),I=a.default(v.name);return[I,u.struct(A,I)]});return new Map(w)},E.prototype.decode=function(m,w){w===void 0&&(w="hex"),typeof m=="string"&&(m=w==="hex"?s.Buffer.from(m,"hex"):s.Buffer.from(o.default.decode(m)));var v=o.default.encode(m.subarray(0,this.discriminatorLength)),A=m.subarray(this.discriminatorLength),I=this.discriminatorLayouts.get(v);if(!I)return null;if(I.name==="updProduct"||I.name==="addProduct"){for(var B={},S=0;Sr.MAX_SLOT_DIFFERENCE&&(be=i.Unknown);var me,se;be===i.Trading&&(me=$e.price,se=$e.confidence);for(var ie=[],oe=240;ie.length{var i;const t=(i=await r.getAccountInfo(e))==null?void 0:i.data;if(!t)throw new Error("Unable to retrieve oracle data");const n=DU.parsePriceData(t);return n.price||n.previousPrice},WU=()=>{const{connection:r}=jc();return Dg(async()=>{var n;if(!r)return;const t=new Map;for(const i of v5.keys())t.set(i,{price:await HU(r,v5.get(i)),decimals:((n=ic.find(o=>o.mintAddress===i))==null?void 0:n.decimals)||4});return t},[!!r])},ZU=async(r,e)=>{var t;try{const n=await r.getTokenAccountBalance(e);return((t=n==null?void 0:n.value)==null?void 0:t.uiAmount)||0}catch{return 0}},GU=()=>{const{publicKey:r,connection:e}=Kh(),[t,n]=je.useState({}),i=je.useCallback(async()=>{if(r){const o={};for(const s of ic){const a=new Kt(s.mintAddress),u=C5(a,r),l=await ZU(e,u);if(a.equals(v1)){const d=await e.getBalance(r)/AE;o[s.tokenSymbol]=d+l}else o[s.tokenSymbol]=l}n(o)}},[r,e]);return je.useEffect(()=>{i()},[r,e,i]),{balances:t}},YU=()=>ee.jsxs("div",{className:"flex flex-col items-center justify-center gap-10 grow",children:[ee.jsx("div",{className:"w-[76px] h-[76px] rounded-full border-4 border-theme-secondary border-t-theme-primary animate-spin"}),ee.jsx("span",{className:"max-w-[225px] font-primary text-center font-medium tracking-wider",children:"Your transaction is being processed..."})]}),JU=()=>ee.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[ee.jsx(JE,{width:90,height:90,className:"text-theme-primary text-opacity-60"}),ee.jsx("p",{className:"text-lg font-bold font-primary",children:"Congrats on registering your domains!"}),ee.jsxs("p",{className:"text-sm font-primary",children:["Head over to",ee.jsx("a",{href:"https://www.sns.id/",rel:"noopener",target:"_blank",className:"mx-1 text-theme-primary",children:"sns.id"}),"to learn how to take full advantage of your domains"]})]}),XU=()=>ee.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[ee.jsx(B5,{width:90,height:90,className:"rotate-180 text-theme-primary text-opacity-60"}),ee.jsx("p",{className:"text-lg font-bold font-primary",children:"Something went wrong"}),ee.jsx("p",{className:"text-sm font-primary",children:"Please retry the process"})]}),QU=[{label:"1kb",value:1e3},{label:"2kb",value:2e3},{label:"3kb",value:3e3},{label:"4kb",value:4e3},{label:"5kb",value:5e3},{label:"6kb",value:6e3},{label:"7kb",value:7e3},{label:"8kb",value:8e3},{label:"9kb",value:9e3},{label:"10kb",value:1e4}],eN=({backHandler:r})=>{const e=WU(),{publicKey:t,connection:n,signAllTransactions:i}=Kh(),{balances:o}=GU(),[s,a]=je.useState(1),{cart:u,emptyCart:l,addToCart:d,referrerKey:_}=je.useContext(zc),{setError:E}=je.useContext($h),[m,w]=je.useState(ic[0]),[v,A]=je.useState(!1),[I,B]=je.useState(""),[S,P]=je.useState("registering"),C=m.mintAddress===cl,R=C?.95:1,j=Object.values(u).reduce((y,L)=>y+P5(L.domain,R),0);je.useEffect(()=>{},[t,n]);const H=y=>{var F,K;const L=(K=(F=e.result)==null?void 0:F.get(y))==null?void 0:K.price;return j/(L||1)},N=y=>{const L=H(y);return y===cl?L*.95:L};je.useEffect(()=>{Object.keys(u).length||r()},[u,r]);const c={1:"w-[33%]",2:"w-[66%]",3:"w-full"},p=()=>{s===2?a(1):r()},x=async()=>{switch(s){case 2:await h();break;case 3:S==="error"&&await h(),S==="success"&&(l(),r(!0));break;default:a(s+1);break}},g=N(m.mintAddress),h=async()=>{if(!(!n||!t||!i)){if(o[m.tokenSymbol]_.equals(X)):void 0);y.push(...ne)}if(v1.equals(F)){const G=await FA(n,K,L,Math.ceil(g*1.01*Math.pow(10,9))),ne=$A(K,L);y=[...G,...y,...ne]}const V=BA(y,L),{blockhash:W}=await n.getLatestBlockhash();let Z=V.map(G=>new Dh().add(...G));Z.forEach(G=>{G.feePayer=L,G.recentBlockhash=W}),Z=await i(Z);for(const G of Z){const ne=await n.sendRawTransaction(G.serialize());await n.confirmTransaction(ne),console.log(ne)}P("success"),a(3)}catch(y){if(console.error(y),y instanceof kE){E(y.message),P("registering");return}a(3),P("error")}}};return ee.jsxs("div",{className:"flex flex-col flex-grow pb-14",children:[ee.jsxs("div",{className:"sticky -top-1 bg-background-primary h-[48px] flex justify-center items-center px-3",children:[ee.jsx("button",{type:"button",tabIndex:0,onClick:p,disabled:S==="processing",className:"absolute top-0 p-3 border-0 left-3 text-theme-primary dark:text-theme-secondary",children:ee.jsx(XE,{width:24,height:24})}),ee.jsx("div",{className:"w-[175px] h-[5px] rounded-md bg-background-interactive dark:bg-background-secondary bg-gradient-to-r",children:ee.jsx("div",{className:Lr("bg-theme-primary dark:bg-theme-secondary h-full rounded-md transition-[width] duration-500",c[s])})})]}),ee.jsxs("div",{className:"flex flex-col flex-grow pt-6 body",children:[S==="success"&&ee.jsx(JU,{}),S==="error"&&ee.jsx(XU,{}),S==="processing"&&ee.jsx(YU,{}),S==="registering"&&ee.jsxs(ee.Fragment,{children:[s===1&&ee.jsxs(ee.Fragment,{children:[ee.jsx("p",{className:"px-3 mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You are registering"}),ee.jsx("div",{className:"flex flex-col gap-2 px-3 pb-4",children:Object.values(u).map(y=>ee.jsx(dL,{domain:y.domain,onEdit:()=>B(y.domain)},y.domain))}),ee.jsx(iv,{isVisible:!!I,toggleVisibility:()=>B(""),children:!!I&&ee.jsxs("div",{className:"w-[320px] p bg-background-primary flex flex-col gap-3 p-4 rounded-xl",children:[ee.jsxs("p",{className:"flex items-start justify-between text-lg font-medium font-primary",children:["Storage size",ee.jsx("button",{type:"button",tabIndex:0,className:"p-1 -mt-3 -mr-3",onClick:()=>B(""),children:ee.jsx(M5,{width:24,height:24})})]}),ee.jsxs("div",{className:"text-xs",children:[ee.jsx("p",{className:"mb-2",children:"The storage size will determine the maximum amount of data you can store on your domain."}),ee.jsxs("p",{className:"",children:[ee.jsx(QE,{width:16,height:16,className:"inline mr-1 mb-[2px] text-accent"}),"Each additional kb of memory costs around 0.007 SOL (0.001 USDC)"]})]}),ee.jsx("div",{className:"grid grid-cols-5 gap-2",children:QU.map(y=>{const L=u[I],F=y.value===(L==null?void 0:L.storage);return ee.jsx("button",{type:"button",tabIndex:0,className:Lr("border-2 border-solid rounded-lg px-2 py-2 border-theme-primary border-opacity-10 text-sm",F&&"border-opacity-100"),onClick:()=>{d({...L,storage:y.value}),B("")},children:y.label},y.value)})})]})})]}),s===2&&ee.jsxs("div",{className:"flex flex-col flex-grow px-3 pb-5",children:[ee.jsxs("div",{className:"mb-auto",children:[ee.jsx("p",{className:"mb-3 ml-4 font-medium font-primary",children:"Pay with"}),ee.jsx("div",{children:ee.jsxs("button",{type:"button",tabIndex:0,className:"flex items-center w-full gap-4 p-4 border cursor-pointer rounded-xl border-interactive-border bg-background-interactive",onClick:()=>A(!v),children:[ee.jsx("img",{className:"w-4 h-4 rounded-[50%]",src:m.icon,alt:m.tokenSymbol}),ee.jsx("span",{className:"tracking-wide text-text-primary",children:m.tokenSymbol}),ee.jsxs("div",{className:"relative w-[25px] h-[25px] flex justify-center items-center ml-auto",children:[ee.jsx("div",{className:Lr("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm -rotate-[45deg] ml-[5px]",v&&"rotate-[45deg]")}),ee.jsx("div",{className:Lr("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm rotate-[45deg] -ml-[4px]",v&&"-rotate-[45deg]")})]})]})})]}),ee.jsxs("div",{children:[ee.jsx("p",{className:"mb-3 font-medium font-primary",children:"Order summary"}),ee.jsxs("div",{className:"flex items-start justify-between mb-2 text-sm font-medium leading-6 border-b border-interactive-border",children:[ee.jsx("div",{children:"Total"}),ee.jsxs("div",{className:"flex flex-col items-end",children:[ee.jsxs("span",{children:[ul(g,!0)," ",m.tokenSymbol]}),ee.jsx("span",{className:"text-xs leading-6 text-text-primary text-opacity-60 dark:text-text-secondary",children:ul(j)})]})]}),ee.jsxs("div",{className:"flex items-start justify-between text-sm font-medium leading-6 border-b border-interactive-border",children:[ee.jsx("div",{children:"Discount"}),ee.jsx("div",{children:C?"5%":"0%"})]})]}),ee.jsx(iv,{isVisible:v,toggleVisibility:A,children:ee.jsx("div",{className:"w-[320px] bg-background-primary flex flex-col gap-3 py-3 rounded-xl",children:ic.map(y=>{const L=N(y.mintAddress),F=o[y.tokenSymbol]{w(y),A(!1)},children:[ee.jsx("img",{src:y.icon,alt:y.tokenSymbol,className:"w-6 h-6 rounded-[50%]"}),ee.jsxs("div",{className:"flex flex-col items-start",children:[ee.jsx("span",{children:y.tokenSymbol}),ee.jsxs("span",{className:"flex text-xs text-text-secondary gap-0.5 items-center",children:[ee.jsx(I5,{width:14,height:14}),o[y.tokenSymbol]]})]}),ee.jsxs("div",{className:"flex flex-col ml-auto text-sm",children:[ee.jsxs("span",{className:Lr("tabular-nums",y.mintAddress===cl&&"line-through"),children:[ul(H(y.mintAddress),!0)," ",y.tokenSymbol]}),ee.jsx("span",{className:"tabular-nums text-success",children:y.mintAddress===cl&&ee.jsxs(ee.Fragment,{children:[ul(N(y.mintAddress),!0)," ","FIDA"]})})]})]},y.tokenSymbol)})})})]})]})]}),S==="processing"?null:ee.jsxs("div",{className:"absolute flex flex-col gap-2 left-3 right-3 bottom-4",children:[ee.jsxs(O0,{className:Lr("text-base-button-content",S==="error"&&"bottom-[70px]"),onClick:x,children:[s===1&&"Continue to payment",s===2&&S==="registering"&&"Confirm and register",S==="success"&&"Done",S==="error"&&"Retry"]}),S==="error"&&ee.jsx(O0,{className:Lr("bg-transparent text-theme-primary"),onClick:()=>r(),children:"Close"})]})]})},tN=()=>{const{visible:r,setVisible:e,connected:t,publicKey:n,disconnect:i}=Kh(),[o,s]=je.useState(!1),a=()=>{t?s(!o):e(!r)},u=()=>{i(),s(!1)};return ee.jsxs("div",{className:"relative flex ml-auto",children:[ee.jsxs("button",{type:"button",className:"relative flex items-center gap-2 px-3 h-[32px] py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":"Connect wallet","aria-haspopup":"true",onClick:a,children:[ee.jsx(I5,{width:16,height:16}),t?Y5(n==null?void 0:n.toString(),8,4):"Connect wallet",t&&ee.jsx(ex,{className:Lr("transition-transform",o&&"rotate-180")})]}),ee.jsx("button",{type:"button",tabIndex:0,"aria-label":"Disconnect wallet",className:Lr(!o&&"invisible opacity-0 -translate-y-1","absolute h-[48px] top-[100%] left-0 right-0 w-full z-10","duration-300 transition-[transform,opacity]","bg-background-secondary rounded-xl text-base flex items-center justify-center text-text-primary","shadow-domain dark:shadow-none dark:border dark:border-interactive-border","active:opacity-70 active:transition-none"),onClick:u,children:"Disconnect"})]})},rN=({status:r})=>{const{setStatus:e}=je.useContext($h);return je.useMemo(()=>{setTimeout(()=>{e(null)},4e3)},[e]),ee.jsxs("div",{className:Lr("bg-background-primary dark:border dark:border-interactive-border","shadow-xl dark:shadow-none","absolute top-2.5 left-3 right-3 rounded-lg py-3 px-4 flex gap-2 z-10 overflow-hidden"),children:[ee.jsx("div",{className:Lr("absolute top-0 left-0 right-0 h-0.5 animate-width-to-zero",r.status==="error"&&"bg-error",r.status==="success"&&"bg-success")}),ee.jsxs("button",{className:"absolute flex items-center justify-center w-5 h-5 top-1 right-1",type:"button",tabIndex:0,onClick:()=>e(null),children:[ee.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary rotate-45"}),ee.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary -rotate-45"})]}),r.status==="error"&&ee.jsx(B5,{width:20,height:20,className:"rotate-180 text-error mt-0.5 shrink-0"}),ee.jsx("span",{className:"font-medium font-primary",children:r.message})]})},nN=({className:r,style:e,partnerLogo:t}={})=>{var x,g;const{connected:n,setVisible:i,visible:o}=Kh(),[s,a]=je.useState("home"),[u,l]=je.useState(!1),[d,_]=je.useState(!1),[E,m]=je.useState(""),[w,v]=je.useState(""),{isCartEmpty:A}=je.useContext(zc),{status:I}=je.useContext($h),B=SL(w),S=BL(w),[P,C]=je.useState(null),R=h=>{_(!1),P&&clearTimeout(P),m(xk({value:h,prev:E,onError:()=>{_(!0);const y=setTimeout(()=>{_(!1)},3e3);C(y)}}))},j=h=>{h.preventDefault(),a("search"),v(E)},H=(h=!1)=>{h?(v(""),m(""),l(!1),a("home")):a("search")},N=s==="home",c=s==="search",p=s==="cart";return ee.jsxs("div",{className:Lr("flex flex-col w-[93svw] h-[560px] max-h-[75svh] max-w-[400px] bg-background-primary rounded-lg absolute bottom-16 right-0 text-text-primary overflow-auto","shadow-xl dark:border dark:border-interactive-border",r),style:e,"aria-label":"SNS widget allows you to quickly search and buy .sol domains",children:[I&&ee.jsx(rN,{status:I}),ee.jsxs("div",{className:"flex items-center px-3 pt-3",children:[!N&&ee.jsx("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:ee.jsx("span",{className:"h-[26px]",children:ee.jsx(Jy,{})})}),ee.jsx(tN,{})]}),ee.jsxs("div",{className:"flex flex-col flex-grow overflow-auto",children:[(N||c)&&ee.jsxs(ee.Fragment,{children:[ee.jsxs("div",{className:Lr("translate-y-[80px] transition-all duration-700 px-3",c&&"-translate-y-[22px]"),children:[ee.jsx("h1",{className:Lr("block max-h-[32px] text-2xl font-medium text-center font-primary transition-[opacity] ease-out duration-200",c&&"opacity-0 invisible",u&&"max-h-0"),onTransitionEnd:()=>{c&&l(!0)},children:"Secure a custom domain"}),ee.jsxs("form",{className:"flex gap-2 mt-10",onSubmit:j,children:[ee.jsx(nx,{value:E,placeholder:"Search your domain",autoCapitalize:"off",spellCheck:"false",enterKeyHint:"search",className:"shadow-input-field dark:shadow-none",type:"search",required:!0,errorMessage:d?"Character not allowed":void 0,onChange:h=>R(h.target.value)}),ee.jsx("button",{className:` - rounded-[10px] bg-theme-primary h-[56px] w-[56px] p-2 - flex items-center justify-center text-base-button-content - `,tabIndex:0,children:ee.jsx(YE,{width:24,height:24})})]})]}),c&&ee.jsxs(ee.Fragment,{children:[ee.jsxs("div",{className:"px-3 mb-3 overflow-auto animate-fade-in",children:[B.loading?ee.jsx(Yy,{}):ee.jsx(ee.Fragment,{children:(x=B.result)==null?void 0:x.map(h=>ee.jsx(Gy,{domain:h.domain,available:h.available},h.domain))}),ee.jsxs("div",{className:"mt-4",children:[S.status!=="error"&&ee.jsx("p",{className:"mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You might also like"}),ee.jsxs("div",{className:"flex flex-col gap-2 pb-14",children:[S.status==="error"&&ee.jsxs("div",{children:[ee.jsx("p",{className:"mb-6 text-sm tracking-widest text-center",children:"Looks like we have an issue helping you with domain suggestions."}),ee.jsxs("button",{type:"button",className:"m-auto flex items-center gap-2 px-3 h-[32px] w-max py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":`Try load suggestions for ${w} again`,onClick:()=>S.execute(),children:["Try again '",w,"'"]}),ee.jsx("p",{className:"my-6 text-sm tracking-widest text-center",children:"...and if the problem persists"}),ee.jsx("div",{className:"flex justify-center",children:ee.jsxs("a",{className:"flex items-center gap-2 justify-center text-theme-primary text-[11px] tracking-wider dark:text-theme-secondary",href:"https://discord.bonfida.org",target:"_blank",rel:"noopener",children:[ee.jsx(rx,{width:24}),"Tell us on discord",ee.jsx(tx,{width:18})]})})]}),S.loading?ee.jsx(ee.Fragment,{children:new Array(5).fill(0).map((h,y)=>ee.jsx(Yy,{},y))}):ee.jsx(ee.Fragment,{children:(g=S.result)==null?void 0:g.map(h=>ee.jsx(Gy,{domain:h.domain,available:h.available},h.domain))})]})]})]}),!A&&ee.jsx(O0,{className:"absolute left-3 right-3 bottom-3 text-base-button-content",onClick:()=>{n?a("cart"):i(!o)},children:n?"Go to cart":"Connect your wallet"})]})]}),p&&ee.jsx(eN,{backHandler:H})]}),N&&ee.jsx("div",{className:"p-3",children:ee.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:["Powered by",ee.jsx("span",{className:"h-[20px] flex",children:ee.jsx(Jy,{})}),t&&ee.jsxs(ee.Fragment,{children:[ee.jsx("span",{children:"x"}),ee.jsx("span",{className:"flex",children:t})]})]})})]})},SN=({endpoint:r,connection:e,passthroughWallet:t,containerClassNames:n,containerStyles:i,referrerKey:o,partnerLogo:s})=>ee.jsx(HE,{endpoint:r,connection:e,passthroughWallet:t,children:ee.jsx(zE,{referrerKey:o,children:ee.jsx(jE,{children:ee.jsx(nN,{className:n,style:i,partnerLogo:s})})})});export{SN as default}; diff --git a/preview-build/assets/widget-e5024a77.js b/preview-build/assets/widget-e5024a77.js new file mode 100644 index 0000000..fbc7360 --- /dev/null +++ b/preview-build/assets/widget-e5024a77.js @@ -0,0 +1,12 @@ +import{r as xe,C as Jk,R as Qk,a as tI,s as sr,b as yr,g as j7,i as K7,c as Re,d as Zt,e as Kl,f as Yv,j as St,u as eI,h as rI,k as nI,W as iI,S as oI,l as sI,P as Ne,m as $7,t as aI,n as uI,o as $l,p as Xv,T as gh,q as bb,v as Hl,w as Jv,x as fI,y as cI,z as o2,A as Vl,B as s2,D as H7,E as hI,N as wb,F as Zl,G as lI,H as sn,L as dI,I as pI}from"./index-f54a1fc2.js";import{r as V7,i as br,s as mI,a as vI,b as bf,c as gI}from"./punycode-06c60053.js";const yI=({children:r,endpoint:t,config:e={commitment:"confirmed"}})=>{const n=xe.useMemo(()=>new Jk(t,e),[t,e]);return Qk.createElement(tI.Provider,{value:{connection:n}},r)};function bI(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,i=[],c;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){c={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(c)throw c.error}}return i}var al=sr.Buffer,Z7=V7.Transform,wI=br;function xI(r,t){if(!al.isBuffer(r)&&typeof r!="string")throw new TypeError(t+" must be a string or a buffer")}function oa(r){Z7.call(this),this._block=al.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}wI(oa,Z7);oa.prototype._transform=function(r,t,e){var n=null;try{this.update(r,t)}catch(s){n=s}e(n)};oa.prototype._flush=function(r){var t=null;try{this.push(this.digest())}catch(e){t=e}r(t)};oa.prototype.update=function(r,t){if(xI(r,"Data"),this._finalized)throw new Error("Digest already called");al.isBuffer(r)||(r=al.from(r,t));for(var e=this._block,n=0;this._blockOffset+r.length-n>=this._blockSize;){for(var s=this._blockOffset;s0;++i)this._length[i]+=c,c=this._length[i]/4294967296|0,c>0&&(this._length[i]-=4294967296*c);return this};oa.prototype._update=function(){throw new Error("_update is not implemented")};oa.prototype.digest=function(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();r!==void 0&&(t=t.toString(r)),this._block.fill(0),this._blockOffset=0;for(var e=0;e<4;++e)this._length[e]=0;return t};oa.prototype._digest=function(){throw new Error("_digest is not implemented")};var W7=oa,_I=br,G7=W7,MI=sr.Buffer,EI=new Array(16);function Wl(){G7.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}_I(Wl,G7);Wl.prototype._update=function(){for(var r=EI,t=0;t<16;++t)r[t]=this._block.readInt32LE(t*4);var e=this._a,n=this._b,s=this._c,i=this._d;e=zn(e,n,s,i,r[0],3614090360,7),i=zn(i,e,n,s,r[1],3905402710,12),s=zn(s,i,e,n,r[2],606105819,17),n=zn(n,s,i,e,r[3],3250441966,22),e=zn(e,n,s,i,r[4],4118548399,7),i=zn(i,e,n,s,r[5],1200080426,12),s=zn(s,i,e,n,r[6],2821735955,17),n=zn(n,s,i,e,r[7],4249261313,22),e=zn(e,n,s,i,r[8],1770035416,7),i=zn(i,e,n,s,r[9],2336552879,12),s=zn(s,i,e,n,r[10],4294925233,17),n=zn(n,s,i,e,r[11],2304563134,22),e=zn(e,n,s,i,r[12],1804603682,7),i=zn(i,e,n,s,r[13],4254626195,12),s=zn(s,i,e,n,r[14],2792965006,17),n=zn(n,s,i,e,r[15],1236535329,22),e=qn(e,n,s,i,r[1],4129170786,5),i=qn(i,e,n,s,r[6],3225465664,9),s=qn(s,i,e,n,r[11],643717713,14),n=qn(n,s,i,e,r[0],3921069994,20),e=qn(e,n,s,i,r[5],3593408605,5),i=qn(i,e,n,s,r[10],38016083,9),s=qn(s,i,e,n,r[15],3634488961,14),n=qn(n,s,i,e,r[4],3889429448,20),e=qn(e,n,s,i,r[9],568446438,5),i=qn(i,e,n,s,r[14],3275163606,9),s=qn(s,i,e,n,r[3],4107603335,14),n=qn(n,s,i,e,r[8],1163531501,20),e=qn(e,n,s,i,r[13],2850285829,5),i=qn(i,e,n,s,r[2],4243563512,9),s=qn(s,i,e,n,r[7],1735328473,14),n=qn(n,s,i,e,r[12],2368359562,20),e=Fn(e,n,s,i,r[5],4294588738,4),i=Fn(i,e,n,s,r[8],2272392833,11),s=Fn(s,i,e,n,r[11],1839030562,16),n=Fn(n,s,i,e,r[14],4259657740,23),e=Fn(e,n,s,i,r[1],2763975236,4),i=Fn(i,e,n,s,r[4],1272893353,11),s=Fn(s,i,e,n,r[7],4139469664,16),n=Fn(n,s,i,e,r[10],3200236656,23),e=Fn(e,n,s,i,r[13],681279174,4),i=Fn(i,e,n,s,r[0],3936430074,11),s=Fn(s,i,e,n,r[3],3572445317,16),n=Fn(n,s,i,e,r[6],76029189,23),e=Fn(e,n,s,i,r[9],3654602809,4),i=Fn(i,e,n,s,r[12],3873151461,11),s=Fn(s,i,e,n,r[15],530742520,16),n=Fn(n,s,i,e,r[2],3299628645,23),e=jn(e,n,s,i,r[0],4096336452,6),i=jn(i,e,n,s,r[7],1126891415,10),s=jn(s,i,e,n,r[14],2878612391,15),n=jn(n,s,i,e,r[5],4237533241,21),e=jn(e,n,s,i,r[12],1700485571,6),i=jn(i,e,n,s,r[3],2399980690,10),s=jn(s,i,e,n,r[10],4293915773,15),n=jn(n,s,i,e,r[1],2240044497,21),e=jn(e,n,s,i,r[8],1873313359,6),i=jn(i,e,n,s,r[15],4264355552,10),s=jn(s,i,e,n,r[6],2734768916,15),n=jn(n,s,i,e,r[13],1309151649,21),e=jn(e,n,s,i,r[4],4149444226,6),i=jn(i,e,n,s,r[11],3174756917,10),s=jn(s,i,e,n,r[2],718787259,15),n=jn(n,s,i,e,r[9],3951481745,21),this._a=this._a+e|0,this._b=this._b+n|0,this._c=this._c+s|0,this._d=this._d+i|0};Wl.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var r=MI.allocUnsafe(16);return r.writeInt32LE(this._a,0),r.writeInt32LE(this._b,4),r.writeInt32LE(this._c,8),r.writeInt32LE(this._d,12),r};function Gl(r,t){return r<>>32-t}function zn(r,t,e,n,s,i,c){return Gl(r+(t&e|~t&n)+s+i|0,c)+t|0}function qn(r,t,e,n,s,i,c){return Gl(r+(t&n|e&~n)+s+i|0,c)+t|0}function Fn(r,t,e,n,s,i,c){return Gl(r+(t^e^n)+s+i|0,c)+t|0}function jn(r,t,e,n,s,i,c){return Gl(r+(e^(t|~n))+s+i|0,c)+t|0}var Qv=Wl,qd=yr.Buffer,AI=br,Y7=W7,SI=new Array(16),Df=[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],zf=[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],qf=[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],Ff=[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],jf=[0,1518500249,1859775393,2400959708,2840853838],Kf=[1352829926,1548603684,1836072691,2053994217,0];function Yl(){Y7.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}AI(Yl,Y7);Yl.prototype._update=function(){for(var r=SI,t=0;t<16;++t)r[t]=this._block.readInt32LE(t*4);for(var e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=this._a|0,p=this._b|0,m=this._c|0,v=this._d|0,_=this._e|0,E=0;E<80;E+=1){var w,x;E<16?(w=xb(e,n,s,i,c,r[Df[E]],jf[0],qf[E]),x=Ab(l,p,m,v,_,r[zf[E]],Kf[0],Ff[E])):E<32?(w=_b(e,n,s,i,c,r[Df[E]],jf[1],qf[E]),x=Eb(l,p,m,v,_,r[zf[E]],Kf[1],Ff[E])):E<48?(w=Mb(e,n,s,i,c,r[Df[E]],jf[2],qf[E]),x=Mb(l,p,m,v,_,r[zf[E]],Kf[2],Ff[E])):E<64?(w=Eb(e,n,s,i,c,r[Df[E]],jf[3],qf[E]),x=_b(l,p,m,v,_,r[zf[E]],Kf[3],Ff[E])):(w=Ab(e,n,s,i,c,r[Df[E]],jf[4],qf[E]),x=xb(l,p,m,v,_,r[zf[E]],Kf[4],Ff[E])),e=c,c=i,i=Za(s,10),s=n,n=w,l=_,_=v,v=Za(m,10),m=p,p=x}var A=this._b+s+v|0;this._b=this._c+i+_|0,this._c=this._d+c+l|0,this._d=this._e+e+p|0,this._e=this._a+n+m|0,this._a=A};Yl.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var r=qd.alloc?qd.alloc(20):new qd(20);return r.writeInt32LE(this._a,0),r.writeInt32LE(this._b,4),r.writeInt32LE(this._c,8),r.writeInt32LE(this._d,12),r.writeInt32LE(this._e,16),r};function Za(r,t){return r<>>32-t}function xb(r,t,e,n,s,i,c,l){return Za(r+(t^e^n)+i+c|0,l)+s|0}function _b(r,t,e,n,s,i,c,l){return Za(r+(t&e|~t&n)+i+c|0,l)+s|0}function Mb(r,t,e,n,s,i,c,l){return Za(r+((t|~e)^n)+i+c|0,l)+s|0}function Eb(r,t,e,n,s,i,c,l){return Za(r+(t&n|e&~n)+i+c|0,l)+s|0}function Ab(r,t,e,n,s,i,c,l){return Za(r+(t^(e|~n))+i+c|0,l)+s|0}var tg=Yl,X7={exports:{}},J7=sr.Buffer;function Xl(r,t){this._block=J7.alloc(r),this._finalSize=t,this._blockSize=r,this._len=0}Xl.prototype.update=function(r,t){typeof r=="string"&&(t=t||"utf8",r=J7.from(r,t));for(var e=this._block,n=this._blockSize,s=r.length,i=this._len,c=0;c=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=this._len*8;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(e&4294967295)>>>0,s=(e-n)/4294967296;this._block.writeUInt32BE(s,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var i=this._hash();return r?i.toString(r):i};Xl.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var wf=Xl,kI=br,Q7=wf,II=sr.Buffer,BI=[1518500249,1859775393,-1894007588,-899497514],PI=new Array(80);function yh(){this.init(),this._w=PI,Q7.call(this,64,56)}kI(yh,Q7);yh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function RI(r){return r<<5|r>>>27}function CI(r){return r<<30|r>>>2}function TI(r,t,e,n){return r===0?t&e|~t&n:r===2?t&e|t&n|e&n:t^e^n}yh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=0;l<16;++l)t[l]=r.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var p=0;p<80;++p){var m=~~(p/20),v=RI(e)+TI(m,n,s,i)+c+t[p]+BI[m]|0;c=i,i=s,s=CI(n),n=e,e=v}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0};yh.prototype._hash=function(){var r=II.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var LI=yh,OI=br,t_=wf,UI=sr.Buffer,NI=[1518500249,1859775393,-1894007588,-899497514],DI=new Array(80);function bh(){this.init(),this._w=DI,t_.call(this,64,56)}OI(bh,t_);bh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zI(r){return r<<1|r>>>31}function qI(r){return r<<5|r>>>27}function FI(r){return r<<30|r>>>2}function jI(r,t,e,n){return r===0?t&e|~t&n:r===2?t&e|t&n|e&n:t^e^n}bh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=0;l<16;++l)t[l]=r.readInt32BE(l*4);for(;l<80;++l)t[l]=zI(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var p=0;p<80;++p){var m=~~(p/20),v=qI(e)+jI(m,n,s,i)+c+t[p]+NI[m]|0;c=i,i=s,s=FI(n),n=e,e=v}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0};bh.prototype._hash=function(){var r=UI.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var KI=bh,$I=br,e_=wf,HI=sr.Buffer,VI=[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],ZI=new Array(64);function wh(){this.init(),this._w=ZI,e_.call(this,64,56)}$I(wh,e_);wh.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function WI(r,t,e){return e^r&(t^e)}function GI(r,t,e){return r&t|e&(r|t)}function YI(r){return(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10)}function XI(r){return(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7)}function JI(r){return(r>>>7|r<<25)^(r>>>18|r<<14)^r>>>3}function QI(r){return(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10}wh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=this._f|0,p=this._g|0,m=this._h|0,v=0;v<16;++v)t[v]=r.readInt32BE(v*4);for(;v<64;++v)t[v]=QI(t[v-2])+t[v-7]+JI(t[v-15])+t[v-16]|0;for(var _=0;_<64;++_){var E=m+XI(c)+WI(c,l,p)+VI[_]+t[_]|0,w=YI(e)+GI(e,n,s)|0;m=p,p=l,l=c,c=i+E|0,i=s,s=n,n=e,e=E+w|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0,this._f=l+this._f|0,this._g=p+this._g|0,this._h=m+this._h|0};wh.prototype._hash=function(){var r=HI.allocUnsafe(32);return r.writeInt32BE(this._a,0),r.writeInt32BE(this._b,4),r.writeInt32BE(this._c,8),r.writeInt32BE(this._d,12),r.writeInt32BE(this._e,16),r.writeInt32BE(this._f,20),r.writeInt32BE(this._g,24),r.writeInt32BE(this._h,28),r};var r_=wh,tB=br,eB=r_,rB=wf,nB=sr.Buffer,iB=new Array(64);function Jl(){this.init(),this._w=iB,rB.call(this,64,56)}tB(Jl,eB);Jl.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Jl.prototype._hash=function(){var r=nB.allocUnsafe(28);return r.writeInt32BE(this._a,0),r.writeInt32BE(this._b,4),r.writeInt32BE(this._c,8),r.writeInt32BE(this._d,12),r.writeInt32BE(this._e,16),r.writeInt32BE(this._f,20),r.writeInt32BE(this._g,24),r};var oB=Jl,sB=br,n_=wf,aB=sr.Buffer,Sb=[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],uB=new Array(160);function xh(){this.init(),this._w=uB,n_.call(this,128,112)}sB(xh,n_);xh.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function kb(r,t,e){return e^r&(t^e)}function Ib(r,t,e){return r&t|e&(r|t)}function Bb(r,t){return(r>>>28|t<<4)^(t>>>2|r<<30)^(t>>>7|r<<25)}function Pb(r,t){return(r>>>14|t<<18)^(r>>>18|t<<14)^(t>>>9|r<<23)}function fB(r,t){return(r>>>1|t<<31)^(r>>>8|t<<24)^r>>>7}function cB(r,t){return(r>>>1|t<<31)^(r>>>8|t<<24)^(r>>>7|t<<25)}function hB(r,t){return(r>>>19|t<<13)^(t>>>29|r<<3)^r>>>6}function lB(r,t){return(r>>>19|t<<13)^(t>>>29|r<<3)^(r>>>6|t<<26)}function yn(r,t){return r>>>0>>0?1:0}xh.prototype._update=function(r){for(var t=this._w,e=this._ah|0,n=this._bh|0,s=this._ch|0,i=this._dh|0,c=this._eh|0,l=this._fh|0,p=this._gh|0,m=this._hh|0,v=this._al|0,_=this._bl|0,E=this._cl|0,w=this._dl|0,x=this._el|0,A=this._fl|0,B=this._gl|0,P=this._hl|0,R=0;R<32;R+=2)t[R]=r.readInt32BE(R*4),t[R+1]=r.readInt32BE(R*4+4);for(;R<160;R+=2){var C=t[R-30],O=t[R-15*2+1],z=fB(C,O),H=cB(O,C);C=t[R-2*2],O=t[R-2*2+1];var tt=hB(C,O),nt=lB(O,C),G=t[R-7*2],M=t[R-7*2+1],d=t[R-16*2],o=t[R-16*2+1],a=H+M|0,f=z+G+yn(a,H)|0;a=a+nt|0,f=f+tt+yn(a,nt)|0,a=a+o|0,f=f+d+yn(a,o)|0,t[R]=f,t[R+1]=a}for(var h=0;h<160;h+=2){f=t[h],a=t[h+1];var g=Ib(e,n,s),S=Ib(v,_,E),I=Bb(e,v),y=Bb(v,e),u=Pb(c,x),b=Pb(x,c),D=Sb[h],Z=Sb[h+1],F=kb(c,l,p),q=kb(x,A,B),it=P+b|0,at=m+u+yn(it,P)|0;it=it+q|0,at=at+F+yn(it,q)|0,it=it+Z|0,at=at+D+yn(it,Z)|0,it=it+a|0,at=at+f+yn(it,a)|0;var Bt=y+S|0,yt=I+g+yn(Bt,y)|0;m=p,P=B,p=l,B=A,l=c,A=x,x=w+it|0,c=i+at+yn(x,w)|0,i=s,w=E,s=n,E=_,n=e,_=v,v=it+Bt|0,e=at+yt+yn(v,it)|0}this._al=this._al+v|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+w|0,this._el=this._el+x|0,this._fl=this._fl+A|0,this._gl=this._gl+B|0,this._hl=this._hl+P|0,this._ah=this._ah+e+yn(this._al,v)|0,this._bh=this._bh+n+yn(this._bl,_)|0,this._ch=this._ch+s+yn(this._cl,E)|0,this._dh=this._dh+i+yn(this._dl,w)|0,this._eh=this._eh+c+yn(this._el,x)|0,this._fh=this._fh+l+yn(this._fl,A)|0,this._gh=this._gh+p+yn(this._gl,B)|0,this._hh=this._hh+m+yn(this._hl,P)|0};xh.prototype._hash=function(){var r=aB.allocUnsafe(64);function t(e,n,s){r.writeInt32BE(e,s),r.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),r};var i_=xh,dB=br,pB=i_,mB=wf,vB=sr.Buffer,gB=new Array(160);function Ql(){this.init(),this._w=gB,mB.call(this,128,112)}dB(Ql,pB);Ql.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Ql.prototype._hash=function(){var r=vB.allocUnsafe(48);function t(e,n,s){r.writeInt32BE(e,s),r.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),r};var yB=Ql,ou=X7.exports=function(t){t=t.toLowerCase();var e=ou[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};ou.sha=LI;ou.sha1=KI;ou.sha224=oB;ou.sha256=r_;ou.sha384=yB;ou.sha512=i_;var eg=X7.exports,o_=sr.Buffer,s_=mI.Transform,bB=vI().StringDecoder,wB=br;function po(r){s_.call(this),this.hashMode=typeof r=="string",this.hashMode?this[r]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}wB(po,s_);po.prototype.update=function(r,t,e){typeof r=="string"&&(r=o_.from(r,t));var n=this._update(r);return this.hashMode?this:(e&&(n=this._toString(n,e)),n)};po.prototype.setAutoPadding=function(){};po.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};po.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};po.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};po.prototype._transform=function(r,t,e){var n;try{this.hashMode?this._update(r):this.push(this._update(r))}catch(s){n=s}finally{e(n)}};po.prototype._flush=function(r){var t;try{this.push(this.__final())}catch(e){t=e}r(t)};po.prototype._finalOrDigest=function(r){var t=this.__final()||o_.alloc(0);return r&&(t=this._toString(t,r,!0)),t};po.prototype._toString=function(r,t,e){if(this._decoder||(this._decoder=new bB(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(r);return e&&(n+=this._decoder.end()),n};var sa=po,xB=br,_B=Qv,MB=tg,EB=eg,a_=sa;function td(r){a_.call(this,"digest"),this._hash=r}xB(td,a_);td.prototype._update=function(r){this._hash.update(r)};td.prototype._final=function(){return this._hash.digest()};var _h=function(t){return t=t.toLowerCase(),t==="md5"?new _B:t==="rmd160"||t==="ripemd160"?new MB:new td(EB(t))};const rg=j7(K7);var Je={},Fd,Rb;function AB(){if(Rb)return Fd;Rb=1;var r=br,t=sr.Buffer,e=sa,n=t.alloc(128),s=64;function i(c,l){e.call(this,"digest"),typeof l=="string"&&(l=t.from(l)),this._alg=c,this._key=l,l.length>s?l=c(l):l.length_){var E=m==="rmd160"?new i:c(m);v=E.update(v).digest()}else v.length<_&&(v=n.concat([v,l],_));for(var w=this._ipad=n.allocUnsafe(_),x=this._opad=n.allocUnsafe(_),A=0;A<_;A++)w[A]=v[A]^54,x[A]=v[A]^92;this._hash=m==="rmd160"?new i:c(m),this._hash.update(w)}return r(p,e),p.prototype._update=function(m){this._hash.update(m)},p.prototype._final=function(){var m=this._hash.digest(),v=this._alg==="rmd160"?new i:c(this._alg);return v.update(this._opad).update(m).digest()},Kd=function(v,_){return v=v.toLowerCase(),v==="rmd160"||v==="ripemd160"?new p("rmd160",_):v==="md5"?new t(s,_):new p(v,_)},Kd}const SB={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},kB={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},IB={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},BB={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},PB={sign:"ecdsa",hash:"sha256",id:""},RB={sign:"ecdsa",hash:"sha224",id:""},CB={sign:"ecdsa",hash:"sha384",id:""},TB={sign:"ecdsa",hash:"sha512",id:""},LB={sign:"dsa",hash:"sha1",id:""},OB={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},UB={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},c_={sha224WithRSAEncryption:SB,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:kB,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:IB,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:BB,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:PB,sha224:RB,sha384:CB,sha512:TB,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:LB,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:OB,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:UB,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var $d,Lb;function NB(){return Lb||(Lb=1,$d=c_),$d}var Zh={},Hd,Ob;function h_(){if(Ob)return Hd;Ob=1;var r=Math.pow(2,30)-1;return Hd=function(t,e){if(typeof t!="number")throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if(typeof e!="number")throw new TypeError("Key length not a number");if(e<0||e>r||e!==e)throw new TypeError("Bad key length")},Hd}var Vd,Ub;function l_(){if(Ub)return Vd;Ub=1;var r;if(Re.process&&Re.process.browser)r="utf-8";else if(Re.process&&Re.process.version){var t=parseInt(Zt.process.version.split(".")[0].slice(1),10);r=t>=6?"utf-8":"binary"}else r="utf-8";return Vd=r,Vd}var Zd,Nb;function d_(){if(Nb)return Zd;Nb=1;var r=sr.Buffer;return Zd=function(t,e,n){if(r.isBuffer(t))return t;if(typeof t=="string")return r.from(t,e);if(ArrayBuffer.isView(t))return r.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},Zd}var Wd,Db;function p_(){if(Db)return Wd;Db=1;var r=u_(),t=tg,e=eg,n=sr.Buffer,s=h_(),i=l_(),c=d_(),l=n.alloc(128),p={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function m(E,w,x){var A=v(E),B=E==="sha512"||E==="sha384"?128:64;w.length>B?w=A(w):w.length>>0},pi.writeUInt32BE=function(s,i,c){s[0+c]=i>>>24,s[1+c]=i>>>16&255,s[2+c]=i>>>8&255,s[3+c]=i&255},pi.ip=function(s,i,c,l){for(var p=0,m=0,v=6;v>=0;v-=2){for(var _=0;_<=24;_+=8)p<<=1,p|=i>>>_+v&1;for(var _=0;_<=24;_+=8)p<<=1,p|=s>>>_+v&1}for(var v=6;v>=0;v-=2){for(var _=1;_<=25;_+=8)m<<=1,m|=i>>>_+v&1;for(var _=1;_<=25;_+=8)m<<=1,m|=s>>>_+v&1}c[l+0]=p>>>0,c[l+1]=m>>>0},pi.rip=function(s,i,c,l){for(var p=0,m=0,v=0;v<4;v++)for(var _=24;_>=0;_-=8)p<<=1,p|=i>>>_+v&1,p<<=1,p|=s>>>_+v&1;for(var v=4;v<8;v++)for(var _=24;_>=0;_-=8)m<<=1,m|=i>>>_+v&1,m<<=1,m|=s>>>_+v&1;c[l+0]=p>>>0,c[l+1]=m>>>0},pi.pc1=function(s,i,c,l){for(var p=0,m=0,v=7;v>=5;v--){for(var _=0;_<=24;_+=8)p<<=1,p|=i>>_+v&1;for(var _=0;_<=24;_+=8)p<<=1,p|=s>>_+v&1}for(var _=0;_<=24;_+=8)p<<=1,p|=i>>_+v&1;for(var v=1;v<=3;v++){for(var _=0;_<=24;_+=8)m<<=1,m|=i>>_+v&1;for(var _=0;_<=24;_+=8)m<<=1,m|=s>>_+v&1}for(var _=0;_<=24;_+=8)m<<=1,m|=s>>_+v&1;c[l+0]=p>>>0,c[l+1]=m>>>0},pi.r28shl=function(s,i){return s<>>28-i};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];pi.pc2=function(s,i,c,l){for(var p=0,m=0,v=r.length>>>1,_=0;_>>r[_]&1;for(var _=v;_>>r[_]&1;c[l+0]=p>>>0,c[l+1]=m>>>0},pi.expand=function(s,i,c){var l=0,p=0;l=(s&1)<<5|s>>>27;for(var m=23;m>=15;m-=4)l<<=6,l|=s>>>m&63;for(var m=11;m>=3;m-=4)p|=s>>>m&63,p<<=6;p|=(s&31)<<1|s>>>31,i[c+0]=l>>>0,i[c+1]=p>>>0};var t=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];pi.substitute=function(s,i){for(var c=0,l=0;l<4;l++){var p=s>>>18-l*6&63,m=t[l*64+p];c<<=4,c|=m}for(var l=0;l<4;l++){var p=i>>>18-l*6&63,m=t[4*64+l*64+p];c<<=4,c|=m}return c>>>0};var e=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return pi.permute=function(s){for(var i=0,c=0;c>>e[c]&1;return i>>>0},pi.padSplit=function(s,i,c){for(var l=s.toString(2);l.length0;c--)s+=this._buffer(n,s),i+=this._flushBuffer(l,i);return s+=this._buffer(n,s),l},t.prototype.final=function(n){var s;n&&(s=this.update(n));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),s?s.concat(i):i},t.prototype._pad=function(n,s){if(s===0)return!1;for(;s>>1];v=e.r28shl(v,w),_=e.r28shl(_,w),e.pc2(v,_,p.keys,E)}},i.prototype._update=function(p,m,v,_){var E=this._desState,w=e.readUInt32BE(p,m),x=e.readUInt32BE(p,m+4);e.ip(w,x,E.tmp,0),w=E.tmp[0],x=E.tmp[1],this.type==="encrypt"?this._encrypt(E,w,x,E.tmp,0):this._decrypt(E,w,x,E.tmp,0),w=E.tmp[0],x=E.tmp[1],e.writeUInt32BE(v,w,_),e.writeUInt32BE(v,x,_+4)},i.prototype._pad=function(p,m){if(this.padding===!1)return!1;for(var v=p.length-m,_=m;_>>0,w=O}e.rip(x,w,_,E)},i.prototype._decrypt=function(p,m,v,_,E){for(var w=v,x=m,A=p.keys.length-2;A>=0;A-=2){var B=p.keys[A],P=p.keys[A+1];e.expand(w,p.tmp,0),B^=p.tmp[0],P^=p.tmp[1];var R=e.substitute(B,P),C=e.permute(R),O=w;w=(x^C)>>>0,x=O}e.rip(w,x,_,E)},Xd}var Jd={},$b;function zB(){if($b)return Jd;$b=1;var r=Zi,t=br,e={};function n(i){r.equal(i.length,8,"Invalid IV length"),this.iv=new Array(8);for(var c=0;c>l%8,n._prev=e(n._prev,i?v:_);return m}function e(n,s){var i=n.length,c=-1,l=r.allocUnsafe(n.length);for(n=r.concat([n,r.from([s])]);++c>7;return l}return i1.encrypt=function(n,s,i){for(var c=s.length,l=r.allocUnsafe(c),p=-1;++p>>24]^w[P>>>16&255]^x[R>>>8&255]^A[C&255]^p[nt++],z=E[P>>>24]^w[R>>>16&255]^x[C>>>8&255]^A[B&255]^p[nt++],H=E[R>>>24]^w[C>>>16&255]^x[B>>>8&255]^A[P&255]^p[nt++],tt=E[C>>>24]^w[B>>>16&255]^x[P>>>8&255]^A[R&255]^p[nt++],B=O,P=z,R=H,C=tt;return O=(v[B>>>24]<<24|v[P>>>16&255]<<16|v[R>>>8&255]<<8|v[C&255])^p[nt++],z=(v[P>>>24]<<24|v[R>>>16&255]<<16|v[C>>>8&255]<<8|v[B&255])^p[nt++],H=(v[R>>>24]<<24|v[C>>>16&255]<<16|v[B>>>8&255]<<8|v[P&255])^p[nt++],tt=(v[C>>>24]<<24|v[B>>>16&255]<<16|v[P>>>8&255]<<8|v[R&255])^p[nt++],O=O>>>0,z=z>>>0,H=H>>>0,tt=tt>>>0,[O,z,H,tt]}var s=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var l=new Array(256),p=0;p<256;p++)p<128?l[p]=p<<1:l[p]=p<<1^283;for(var m=[],v=[],_=[[],[],[],[]],E=[[],[],[],[]],w=0,x=0,A=0;A<256;++A){var B=x^x<<1^x<<2^x<<3^x<<4;B=B>>>8^B&255^99,m[w]=B,v[B]=w;var P=l[w],R=l[P],C=l[R],O=l[B]*257^B*16843008;_[0][w]=O<<24|O>>>8,_[1][w]=O<<16|O>>>16,_[2][w]=O<<8|O>>>24,_[3][w]=O,O=C*16843009^R*65537^P*257^w*16843008,E[0][B]=O<<24|O>>>8,E[1][B]=O<<16|O>>>16,E[2][B]=O<<8|O>>>24,E[3][B]=O,w===0?w=x=1:(w=P^l[l[l[C^P]]],x^=l[l[x]])}return{SBOX:m,INV_SBOX:v,SUB_MIX:_,INV_SUB_MIX:E}}();function c(l){this._key=t(l),this._reset()}return c.blockSize=4*4,c.keySize=256/8,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var l=this._key,p=l.length,m=p+6,v=(m+1)*4,_=[],E=0;E>>24,w=i.SBOX[w>>>24]<<24|i.SBOX[w>>>16&255]<<16|i.SBOX[w>>>8&255]<<8|i.SBOX[w&255],w^=s[E/p|0]<<24):p>6&&E%p===4&&(w=i.SBOX[w>>>24]<<24|i.SBOX[w>>>16&255]<<16|i.SBOX[w>>>8&255]<<8|i.SBOX[w&255]),_[E]=_[E-p]^w}for(var x=[],A=0;A>>24]]^i.INV_SUB_MIX[1][i.SBOX[P>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[P>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[P&255]]}this._nRounds=m,this._keySchedule=_,this._invKeySchedule=x},c.prototype.encryptBlockRaw=function(l){return l=t(l),n(l,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},c.prototype.encryptBlock=function(l){var p=this.encryptBlockRaw(l),m=r.allocUnsafe(16);return m.writeUInt32BE(p[0],0),m.writeUInt32BE(p[1],4),m.writeUInt32BE(p[2],8),m.writeUInt32BE(p[3],12),m},c.prototype.decryptBlock=function(l){l=t(l);var p=l[1];l[1]=l[3],l[3]=p;var m=n(l,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),v=r.allocUnsafe(16);return v.writeUInt32BE(m[0],0),v.writeUInt32BE(m[3],4),v.writeUInt32BE(m[2],8),v.writeUInt32BE(m[1],12),v},c.prototype.scrub=function(){e(this._keySchedule),e(this._invKeySchedule),e(this._key)},f1.AES=c,f1}var c1,sw;function JB(){if(sw)return c1;sw=1;var r=sr.Buffer,t=r.alloc(16,0);function e(i){return[i.readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)]}function n(i){var c=r.allocUnsafe(16);return c.writeUInt32BE(i[0]>>>0,0),c.writeUInt32BE(i[1]>>>0,4),c.writeUInt32BE(i[2]>>>0,8),c.writeUInt32BE(i[3]>>>0,12),c}function s(i){this.h=i,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}return s.prototype.ghash=function(i){for(var c=-1;++c0;l--)i[l]=i[l]>>>1|(i[l-1]&1)<<31;i[0]=i[0]>>>1,m&&(i[0]=i[0]^225<<24)}this.state=n(c)},s.prototype.update=function(i){this.cache=r.concat([this.cache,i]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},s.prototype.final=function(i,c){return this.cache.length&&this.ghash(r.concat([this.cache,t],16)),this.ghash(n([0,i,0,c])),this.state},c1=s,c1}var h1,aw;function x_(){if(aw)return h1;aw=1;var r=ed(),t=sr.Buffer,e=sa,n=br,s=JB(),i=Mh(),c=b_();function l(v,_){var E=0;v.length!==_.length&&E++;for(var w=Math.min(v.length,_.length),x=0;x0||c>0;){var _=new t;_.update(v),_.update(n),s&&_.update(s),v=_.digest();var E=0;if(l>0){var w=p.length-l;E=Math.min(l,v.length),v.copy(p,w,0,E),l-=E}if(E0){var x=m.length-c,A=Math.min(c,v.length-E);v.copy(m,x,E,E+A),c-=A}}return v.fill(0),{key:p,iv:m}}return d1=e,d1}var cw;function QB(){if(cw)return Wh;cw=1;var r=ig(),t=x_(),e=sr.Buffer,n=__(),s=sa,i=ed(),c=rd(),l=br;function p(w,x,A){s.call(this),this._cache=new v,this._cipher=new i.AES(x),this._prev=e.from(A),this._mode=w,this._autopadding=!0}l(p,s),p.prototype._update=function(w){this._cache.add(w);for(var x,A,B=[];x=this._cache.get();)A=this._mode.encrypt(this,x),B.push(A);return e.concat(B)};var m=e.alloc(16,16);p.prototype._final=function(){var w=this._cache.flush();if(this._autopadding)return w=this._mode.encrypt(this,w),this._cipher.scrub(),w;if(!w.equals(m))throw this._cipher.scrub(),new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(w){return this._autopadding=!!w,this};function v(){this.cache=e.allocUnsafe(0)}v.prototype.add=function(w){this.cache=e.concat([this.cache,w])},v.prototype.get=function(){if(this.cache.length>15){var w=this.cache.slice(0,16);return this.cache=this.cache.slice(16),w}return null},v.prototype.flush=function(){for(var w=16-this.cache.length,x=e.allocUnsafe(w),A=-1;++A16)return x=this.cache.slice(0,16),this.cache=this.cache.slice(16),x}else if(this.cache.length>=16)return x=this.cache.slice(0,16),this.cache=this.cache.slice(16),x;return null},m.prototype.flush=function(){if(this.cache.length)return this.cache};function v(w){var x=w[15];if(x<1||x>16)throw new Error("unable to decrypt data");for(var A=-1;++A0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(z0)),z0.exports}var q0={exports:{}};q0.exports;var vw;function nP(){return vw||(vw=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(q0)),q0.exports}var Jh={exports:{}},gw;function sg(){if(gw)return Jh.exports;gw=1;var r;Jh.exports=function(s){return r||(r=new t(null)),r.generate(s)};function t(n){this.rand=n}if(Jh.exports.Rand=t,t.prototype.generate=function(s){return this._rand(s)},t.prototype._rand=function(s){if(this.rand.getBytes)return this.rand.getBytes(s);for(var i=new Uint8Array(s),c=0;c=0);return l},e.prototype._randrange=function(s,i){var c=i.sub(s);return s.add(this._randbelow(c))},e.prototype.test=function(s,i,c){var l=s.bitLength(),p=r.mont(s),m=new r(1).toRed(p);i||(i=Math.max(1,l/48|0));for(var v=s.subn(1),_=0;!v.testn(_);_++);for(var E=s.shrn(_),w=v.toRed(p),x=!0;i>0;i--){var A=this._randrange(new r(2),v);c&&c(A);var B=A.toRed(p).redPow(E);if(!(B.cmp(m)===0||B.cmp(w)===0)){for(var P=1;P<_;P++){if(B=B.redSqr(),B.cmp(m)===0)return!1;if(B.cmp(w)===0)break}if(P===_)return!1}}return x},e.prototype.getDivisor=function(s,i){var c=s.bitLength(),l=r.mont(s),p=new r(1).toRed(l);i||(i=Math.max(1,c/48|0));for(var m=s.subn(1),v=0;!m.testn(v);v++);for(var _=s.shrn(v),E=m.toRed(l);i>0;i--){var w=this._randrange(new r(2),m),x=s.gcd(w);if(x.cmpn(1)!==0)return x;var A=w.toRed(l).redPow(_);if(!(A.cmp(p)===0||A.cmp(E)===0)){for(var B=1;BP;)C.ishrn(1);if(C.isEven()&&C.iadd(i),C.testn(1)||C.iadd(c),R.cmp(c)){if(!R.cmp(l))for(;C.mod(p).cmp(m);)C.iadd(_)}else for(;C.mod(e).cmp(v);)C.iadd(_);if(O=C.shrn(1),x(O)&&x(C)&&A(O)&&A(C)&&s.test(O)&&s.test(C))return C}}return v1}const iP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},oP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},sP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},aP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},uP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},fP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},cP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},hP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},lP={modp1:iP,modp2:oP,modp5:sP,modp14:aP,modp15:uP,modp16:fP,modp17:cP,modp18:hP};var g1,ww;function dP(){if(ww)return g1;ww=1;var r=M_(),t=E_(),e=new t,n=new r(24),s=new r(11),i=new r(10),c=new r(3),l=new r(7),p=A_(),m=bf;g1=x;function v(B,P){return P=P||"utf8",Zt.Buffer.isBuffer(B)||(B=new Zt.Buffer(B,P)),this._pub=new r(B),this}function _(B,P){return P=P||"utf8",Zt.Buffer.isBuffer(B)||(B=new Zt.Buffer(B,P)),this._priv=new r(B),this}var E={};function w(B,P){var R=P.toString("hex"),C=[R,B.toString(16)].join("_");if(C in E)return E[C];var O=0;if(B.isEven()||!p.simpleSieve||!p.fermatTest(B)||!e.test(B))return O+=1,R==="02"||R==="05"?O+=8:O+=4,E[C]=O,O;e.test(B.shrn(1))||(O+=2);var z;switch(R){case"02":B.mod(n).cmp(s)&&(O+=8);break;case"05":z=B.mod(i),z.cmp(c)&&z.cmp(l)&&(O+=8);break;default:O+=4}return E[C]=O,O}function x(B,P,R){this.setGenerator(P),this.__prime=new r(B),this._prime=r.mont(this.__prime),this._primeLen=B.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,R?(this.setPublicKey=v,this.setPrivateKey=_):this._primeCode=8}Object.defineProperty(x.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=w(this.__prime,this.__gen)),this._primeCode}}),x.prototype.generateKeys=function(){return this._priv||(this._priv=new r(m(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},x.prototype.computeSecret=function(B){B=new r(B),B=B.toRed(this._prime);var P=B.redPow(this._priv).fromRed(),R=new Zt.Buffer(P.toArray()),C=this.getPrime();if(R.length=0||!l.umod(i.prime1)||!l.umod(i.prime2));return l}function s(i,c){var l=e(c),p=c.modulus.byteLength(),m=new r(i).mul(l.blinder).umod(c.modulus),v=m.toRed(r.mont(c.prime1)),_=m.toRed(r.mont(c.prime2)),E=c.coefficient,w=c.prime1,x=c.prime2,A=v.redPow(c.exponent1).fromRed(),B=_.redPow(c.exponent2).fromRed(),P=A.isub(B).imul(E).umod(w).imul(x);return B.iadd(P).imul(l.unblinder).umod(c.modulus).toArrayLike(Zt.Buffer,"be",p)}return s.getr=n,y1=s,y1}var b1={};const mP="elliptic",vP="6.5.4",gP="EC cryptography",yP="lib/elliptic.js",bP=["lib"],wP={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/"},xP={type:"git",url:"git@github.com:indutny/elliptic"},_P=["EC","Elliptic","curve","Cryptography"],MP="Fedor Indutny ",EP="MIT",AP={url:"https://github.com/indutny/elliptic/issues"},SP="https://github.com/indutny/elliptic",kP={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"},IP={"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"},BP={name:mP,version:vP,description:gP,main:yP,files:bP,scripts:wP,repository:xP,keywords:_P,author:MP,license:EP,bugs:AP,homepage:SP,devDependencies:kP,dependencies:IP};var w1={},F0={exports:{}};F0.exports;var Mw;function Is(){return Mw||(Mw=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(F0)),F0.exports}var x1={},Ew;function S_(){return Ew||(Ew=1,function(r){var t=r;function e(i,c){if(Array.isArray(i))return i.slice();if(!i)return[];var l=[];if(typeof i!="string"){for(var p=0;p>8,_=m&255;v?l.push(v,_):l.push(_)}return l}t.toArray=e;function n(i){return i.length===1?"0"+i:i}t.zero2=n;function s(i){for(var c="",l=0;l(x>>1)-1?P=(x>>1)-R:P=R,A.isubn(P)):P=0,w[B]=P,A.iushrn(1)}return w}t.getNAF=i;function c(v,_){var E=[[],[]];v=v.clone(),_=_.clone();for(var w=0,x=0,A;v.cmpn(-w)>0||_.cmpn(-x)>0;){var B=v.andln(3)+w&3,P=_.andln(3)+x&3;B===3&&(B=-1),P===3&&(P=-1);var R;B&1?(A=v.andln(7)+w&7,(A===3||A===5)&&P===2?R=-B:R=B):R=0,E[0].push(R);var C;P&1?(A=_.andln(7)+x&7,(A===3||A===5)&&B===2?C=-P:C=P):C=0,E[1].push(C),2*w===R+1&&(w=1-w),2*x===C+1&&(x=1-x),v.iushrn(1),_.iushrn(1)}return E}t.getJSF=c;function l(v,_,E){var w="_"+_;v.prototype[_]=function(){return this[w]!==void 0?this[w]:this[w]=E.call(this)}}t.cachedProperty=l;function p(v){return typeof v=="string"?t.toArray(v,"hex"):v}t.parseBytes=p;function m(v){return new e(v,"hex","le")}t.intFromLE=m}(w1)),w1}var _1={},M1,Sw;function nd(){if(Sw)return M1;Sw=1;var r=Is(),t=Wi(),e=t.getNAF,n=t.getJSF,s=t.assert;function i(l,p){this.type=l,this.p=new r(p.p,16),this.red=p.prime?r.red(p.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=p.n&&new r(p.n,16),this.g=p.g&&this.pointFromJSON(p.g,p.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 m=this.n&&this.p.div(this.n);!m||m.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}M1=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(p,m){s(p.precomputed);var v=p._getDoubles(),_=e(m,1,this._bitLength),E=(1<=x;B--)A=(A<<1)+_[B];w.push(A)}for(var P=this.jpoint(null,null,null),R=this.jpoint(null,null,null),C=E;C>0;C--){for(x=0;x=0;A--){for(var B=0;A>=0&&w[A]===0;A--)B++;if(A>=0&&B++,x=x.dblp(B),A<0)break;var P=w[A];s(P!==0),p.type==="affine"?P>0?x=x.mixedAdd(E[P-1>>1]):x=x.mixedAdd(E[-P-1>>1].neg()):P>0?x=x.add(E[P-1>>1]):x=x.add(E[-P-1>>1].neg())}return p.type==="affine"?x.toP():x},i.prototype._wnafMulAdd=function(p,m,v,_,E){var w=this._wnafT1,x=this._wnafT2,A=this._wnafT3,B=0,P,R,C;for(P=0;P<_;P++){C=m[P];var O=C._getNAFPoints(p);w[P]=O.wnd,x[P]=O.points}for(P=_-1;P>=1;P-=2){var z=P-1,H=P;if(w[z]!==1||w[H]!==1){A[z]=e(v[z],w[z],this._bitLength),A[H]=e(v[H],w[H],this._bitLength),B=Math.max(A[z].length,B),B=Math.max(A[H].length,B);continue}var tt=[m[z],null,null,m[H]];m[z].y.cmp(m[H].y)===0?(tt[1]=m[z].add(m[H]),tt[2]=m[z].toJ().mixedAdd(m[H].neg())):m[z].y.cmp(m[H].y.redNeg())===0?(tt[1]=m[z].toJ().mixedAdd(m[H]),tt[2]=m[z].add(m[H].neg())):(tt[1]=m[z].toJ().mixedAdd(m[H]),tt[2]=m[z].toJ().mixedAdd(m[H].neg()));var nt=[-3,-1,-5,-7,0,7,5,1,3],G=n(v[z],v[H]);for(B=Math.max(G[0].length,B),A[z]=new Array(B),A[H]=new Array(B),R=0;R=0;P--){for(var f=0;P>=0;){var h=!0;for(R=0;R<_;R++)a[R]=A[R][P]|0,a[R]!==0&&(h=!1);if(!h)break;f++,P--}if(P>=0&&f++,o=o.dblp(f),P<0)break;for(R=0;R<_;R++){var g=a[R];g!==0&&(g>0?C=x[R][g-1>>1]:g<0&&(C=x[R][-g-1>>1].neg()),C.type==="affine"?o=o.mixedAdd(C):o=o.add(C))}}for(P=0;P<_;P++)x[P]=null;return E?o:o.toP()};function c(l,p){this.curve=l,this.type=p,this.precomputed=null}return i.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},i.prototype.decodePoint=function(p,m){p=t.toArray(p,m);var v=this.p.byteLength();if((p[0]===4||p[0]===6||p[0]===7)&&p.length-1===2*v){p[0]===6?s(p[p.length-1]%2===0):p[0]===7&&s(p[p.length-1]%2===1);var _=this.point(p.slice(1,1+v),p.slice(1+v,1+2*v));return _}else if((p[0]===2||p[0]===3)&&p.length-1===v)return this.pointFromX(p.slice(1,1+v),p[0]===3);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(p){return this.encode(p,!0)},c.prototype._encode=function(p){var m=this.curve.p.byteLength(),v=this.getX().toArray("be",m);return p?[this.getY().isEven()?2:3].concat(v):[4].concat(v,this.getY().toArray("be",m))},c.prototype.encode=function(p,m){return t.encode(this._encode(m),p)},c.prototype.precompute=function(p){if(this.precomputed)return this;var m={doubles:null,naf:null,beta:null};return m.naf=this._getNAFPoints(8),m.doubles=this._getDoubles(4,p),m.beta=this._getBeta(),this.precomputed=m,this},c.prototype._hasDoubles=function(p){if(!this.precomputed)return!1;var m=this.precomputed.doubles;return m?m.points.length>=Math.ceil((p.bitLength()+1)/m.step):!1},c.prototype._getDoubles=function(p,m){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var v=[this],_=this,E=0;E=0&&(z=P,H=R),C.negative&&(C=C.neg(),O=O.neg()),z.negative&&(z=z.neg(),H=H.neg()),[{a:C,b:O},{a:z,b:H}]},i.prototype._endoSplit=function(m){var v=this.endo.basis,_=v[0],E=v[1],w=E.b.mul(m).divRound(this.n),x=_.b.neg().mul(m).divRound(this.n),A=w.mul(_.a),B=x.mul(E.a),P=w.mul(_.b),R=x.mul(E.b),C=m.sub(A).sub(B),O=P.add(R).neg();return{k1:C,k2:O}},i.prototype.pointFromX=function(m,v){m=new t(m,16),m.red||(m=m.toRed(this.red));var _=m.redSqr().redMul(m).redIAdd(m.redMul(this.a)).redIAdd(this.b),E=_.redSqrt();if(E.redSqr().redSub(_).cmp(this.zero)!==0)throw new Error("invalid point");var w=E.fromRed().isOdd();return(v&&!w||!v&&w)&&(E=E.redNeg()),this.point(m,E)},i.prototype.validate=function(m){if(m.inf)return!0;var v=m.x,_=m.y,E=this.a.redMul(v),w=v.redSqr().redMul(v).redIAdd(E).redIAdd(this.b);return _.redSqr().redISub(w).cmpn(0)===0},i.prototype._endoWnafMulAdd=function(m,v,_){for(var E=this._endoWnafT1,w=this._endoWnafT2,x=0;x":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(m){if(this.inf)return m;if(m.inf)return this;if(this.eq(m))return this.dbl();if(this.neg().eq(m))return this.curve.point(null,null);if(this.x.cmp(m.x)===0)return this.curve.point(null,null);var v=this.y.redSub(m.y);v.cmpn(0)!==0&&(v=v.redMul(this.x.redSub(m.x).redInvm()));var _=v.redSqr().redISub(this.x).redISub(m.x),E=v.redMul(this.x.redSub(_)).redISub(this.y);return this.curve.point(_,E)},c.prototype.dbl=function(){if(this.inf)return this;var m=this.y.redAdd(this.y);if(m.cmpn(0)===0)return this.curve.point(null,null);var v=this.curve.a,_=this.x.redSqr(),E=m.redInvm(),w=_.redAdd(_).redIAdd(_).redIAdd(v).redMul(E),x=w.redSqr().redISub(this.x.redAdd(this.x)),A=w.redMul(this.x.redSub(x)).redISub(this.y);return this.curve.point(x,A)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(m){return m=new t(m,16),this.isInfinity()?this:this._hasDoubles(m)?this.curve._fixedNafMul(this,m):this.curve.endo?this.curve._endoWnafMulAdd([this],[m]):this.curve._wnafMul(this,m)},c.prototype.mulAdd=function(m,v,_){var E=[this,v],w=[m,_];return this.curve.endo?this.curve._endoWnafMulAdd(E,w):this.curve._wnafMulAdd(1,E,w,2)},c.prototype.jmulAdd=function(m,v,_){var E=[this,v],w=[m,_];return this.curve.endo?this.curve._endoWnafMulAdd(E,w,!0):this.curve._wnafMulAdd(1,E,w,2,!0)},c.prototype.eq=function(m){return this===m||this.inf===m.inf&&(this.inf||this.x.cmp(m.x)===0&&this.y.cmp(m.y)===0)},c.prototype.neg=function(m){if(this.inf)return this;var v=this.curve.point(this.x,this.y.redNeg());if(m&&this.precomputed){var _=this.precomputed,E=function(w){return w.neg()};v.precomputed={naf:_.naf&&{wnd:_.naf.wnd,points:_.naf.points.map(E)},doubles:_.doubles&&{step:_.doubles.step,points:_.doubles.points.map(E)}}}return v},c.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var m=this.curve.jpoint(this.x,this.y,this.curve.one);return m};function l(p,m,v,_){n.BasePoint.call(this,p,"jacobian"),m===null&&v===null&&_===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new t(0)):(this.x=new t(m,16),this.y=new t(v,16),this.z=new t(_,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 e(l,n.BasePoint),i.prototype.jpoint=function(m,v,_){return new l(this,m,v,_)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var m=this.z.redInvm(),v=m.redSqr(),_=this.x.redMul(v),E=this.y.redMul(v).redMul(m);return this.curve.point(_,E)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(m){if(this.isInfinity())return m;if(m.isInfinity())return this;var v=m.z.redSqr(),_=this.z.redSqr(),E=this.x.redMul(v),w=m.x.redMul(_),x=this.y.redMul(v.redMul(m.z)),A=m.y.redMul(_.redMul(this.z)),B=E.redSub(w),P=x.redSub(A);if(B.cmpn(0)===0)return P.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var R=B.redSqr(),C=R.redMul(B),O=E.redMul(R),z=P.redSqr().redIAdd(C).redISub(O).redISub(O),H=P.redMul(O.redISub(z)).redISub(x.redMul(C)),tt=this.z.redMul(m.z).redMul(B);return this.curve.jpoint(z,H,tt)},l.prototype.mixedAdd=function(m){if(this.isInfinity())return m.toJ();if(m.isInfinity())return this;var v=this.z.redSqr(),_=this.x,E=m.x.redMul(v),w=this.y,x=m.y.redMul(v).redMul(this.z),A=_.redSub(E),B=w.redSub(x);if(A.cmpn(0)===0)return B.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var P=A.redSqr(),R=P.redMul(A),C=_.redMul(P),O=B.redSqr().redIAdd(R).redISub(C).redISub(C),z=B.redMul(C.redISub(O)).redISub(w.redMul(R)),H=this.z.redMul(A);return this.curve.jpoint(O,z,H)},l.prototype.dblp=function(m){if(m===0)return this;if(this.isInfinity())return this;if(!m)return this.dbl();var v;if(this.curve.zeroA||this.curve.threeA){var _=this;for(v=0;v=0)return!1;if(_.redIAdd(w),this.x.cmp(_)===0)return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return this.z.cmpn(0)===0},E1}var A1,Iw;function RP(){if(Iw)return A1;Iw=1;var r=Is(),t=br,e=nd(),n=Wi();function s(c){e.call(this,"mont",c),this.a=new r(c.a,16).toRed(this.red),this.b=new r(c.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}t(s,e),A1=s,s.prototype.validate=function(l){var p=l.normalize().x,m=p.redSqr(),v=m.redMul(p).redAdd(m.redMul(this.a)).redAdd(p),_=v.redSqrt();return _.redSqr().cmp(v)===0};function i(c,l,p){e.BasePoint.call(this,c,"projective"),l===null&&p===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(l,16),this.z=new r(p,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return t(i,e.BasePoint),s.prototype.decodePoint=function(l,p){return this.point(n.toArray(l,p),1)},s.prototype.point=function(l,p){return new i(this,l,p)},s.prototype.pointFromJSON=function(l){return i.fromJSON(this,l)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(l,p){return new i(l,p[0],p[1]||l.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return this.z.cmpn(0)===0},i.prototype.dbl=function(){var l=this.x.redAdd(this.z),p=l.redSqr(),m=this.x.redSub(this.z),v=m.redSqr(),_=p.redSub(v),E=p.redMul(v),w=_.redMul(v.redAdd(this.curve.a24.redMul(_)));return this.curve.point(E,w)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(l,p){var m=this.x.redAdd(this.z),v=this.x.redSub(this.z),_=l.x.redAdd(l.z),E=l.x.redSub(l.z),w=E.redMul(m),x=_.redMul(v),A=p.z.redMul(w.redAdd(x).redSqr()),B=p.x.redMul(w.redISub(x).redSqr());return this.curve.point(A,B)},i.prototype.mul=function(l){for(var p=l.clone(),m=this,v=this.curve.point(null,null),_=this,E=[];p.cmpn(0)!==0;p.iushrn(1))E.push(p.andln(1));for(var w=E.length-1;w>=0;w--)E[w]===0?(m=m.diffAdd(v,_),v=v.dbl()):(v=m.diffAdd(v,_),m=m.dbl());return v},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(l){return this.getX().cmp(l.getX())===0},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},A1}var S1,Bw;function CP(){if(Bw)return S1;Bw=1;var r=Wi(),t=Is(),e=br,n=nd(),s=r.assert;function i(l){this.twisted=(l.a|0)!==1,this.mOneA=this.twisted&&(l.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",l),this.a=new t(l.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new t(l.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new t(l.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(l.c|0)===1}e(i,n),S1=i,i.prototype._mulA=function(p){return this.mOneA?p.redNeg():this.a.redMul(p)},i.prototype._mulC=function(p){return this.oneC?p:this.c.redMul(p)},i.prototype.jpoint=function(p,m,v,_){return this.point(p,m,v,_)},i.prototype.pointFromX=function(p,m){p=new t(p,16),p.red||(p=p.toRed(this.red));var v=p.redSqr(),_=this.c2.redSub(this.a.redMul(v)),E=this.one.redSub(this.c2.redMul(this.d).redMul(v)),w=_.redMul(E.redInvm()),x=w.redSqrt();if(x.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");var A=x.fromRed().isOdd();return(m&&!A||!m&&A)&&(x=x.redNeg()),this.point(p,x)},i.prototype.pointFromY=function(p,m){p=new t(p,16),p.red||(p=p.toRed(this.red));var v=p.redSqr(),_=v.redSub(this.c2),E=v.redMul(this.d).redMul(this.c2).redSub(this.a),w=_.redMul(E.redInvm());if(w.cmp(this.zero)===0){if(m)throw new Error("invalid point");return this.point(this.zero,p)}var x=w.redSqrt();if(x.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");return x.fromRed().isOdd()!==m&&(x=x.redNeg()),this.point(x,p)},i.prototype.validate=function(p){if(p.isInfinity())return!0;p.normalize();var m=p.x.redSqr(),v=p.y.redSqr(),_=m.redMul(this.a).redAdd(v),E=this.c2.redMul(this.one.redAdd(this.d.redMul(m).redMul(v)));return _.cmp(E)===0};function c(l,p,m,v,_){n.BasePoint.call(this,l,"projective"),p===null&&m===null&&v===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 t(p,16),this.y=new t(m,16),this.z=v?new t(v,16):this.curve.one,this.t=_&&new t(_,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 e(c,n.BasePoint),i.prototype.pointFromJSON=function(p){return c.fromJSON(this,p)},i.prototype.point=function(p,m,v,_){return new c(this,p,m,v,_)},c.fromJSON=function(p,m){return new c(p,m[0],m[1],m[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},c.prototype._extDbl=function(){var p=this.x.redSqr(),m=this.y.redSqr(),v=this.z.redSqr();v=v.redIAdd(v);var _=this.curve._mulA(p),E=this.x.redAdd(this.y).redSqr().redISub(p).redISub(m),w=_.redAdd(m),x=w.redSub(v),A=_.redSub(m),B=E.redMul(x),P=w.redMul(A),R=E.redMul(A),C=x.redMul(w);return this.curve.point(B,P,C,R)},c.prototype._projDbl=function(){var p=this.x.redAdd(this.y).redSqr(),m=this.x.redSqr(),v=this.y.redSqr(),_,E,w,x,A,B;if(this.curve.twisted){x=this.curve._mulA(m);var P=x.redAdd(v);this.zOne?(_=p.redSub(m).redSub(v).redMul(P.redSub(this.curve.two)),E=P.redMul(x.redSub(v)),w=P.redSqr().redSub(P).redSub(P)):(A=this.z.redSqr(),B=P.redSub(A).redISub(A),_=p.redSub(m).redISub(v).redMul(B),E=P.redMul(x.redSub(v)),w=P.redMul(B))}else x=m.redAdd(v),A=this.curve._mulC(this.z).redSqr(),B=x.redSub(A).redSub(A),_=this.curve._mulC(p.redISub(x)).redMul(B),E=this.curve._mulC(x).redMul(m.redISub(v)),w=x.redMul(B);return this.curve.point(_,E,w)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(p){var m=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),v=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),_=this.t.redMul(this.curve.dd).redMul(p.t),E=this.z.redMul(p.z.redAdd(p.z)),w=v.redSub(m),x=E.redSub(_),A=E.redAdd(_),B=v.redAdd(m),P=w.redMul(x),R=A.redMul(B),C=w.redMul(B),O=x.redMul(A);return this.curve.point(P,R,O,C)},c.prototype._projAdd=function(p){var m=this.z.redMul(p.z),v=m.redSqr(),_=this.x.redMul(p.x),E=this.y.redMul(p.y),w=this.curve.d.redMul(_).redMul(E),x=v.redSub(w),A=v.redAdd(w),B=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(_).redISub(E),P=m.redMul(x).redMul(B),R,C;return this.curve.twisted?(R=m.redMul(A).redMul(E.redSub(this.curve._mulA(_))),C=x.redMul(A)):(R=m.redMul(A).redMul(E.redSub(_)),C=this.curve._mulC(x).redMul(A)),this.curve.point(P,R,C)},c.prototype.add=function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},c.prototype.mul=function(p){return this._hasDoubles(p)?this.curve._fixedNafMul(this,p):this.curve._wnafMul(this,p)},c.prototype.mulAdd=function(p,m,v){return this.curve._wnafMulAdd(1,[this,m],[p,v],2,!1)},c.prototype.jmulAdd=function(p,m,v){return this.curve._wnafMulAdd(1,[this,m],[p,v],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var p=this.z.redInvm();return this.x=this.x.redMul(p),this.y=this.y.redMul(p),this.t&&(this.t=this.t.redMul(p)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(p){return this===p||this.getX().cmp(p.getX())===0&&this.getY().cmp(p.getY())===0},c.prototype.eqXToP=function(p){var m=p.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(m)===0)return!0;for(var v=p.clone(),_=this.curve.redN.redMul(this.z);;){if(v.iadd(this.curve.n),v.cmp(this.curve.p)>=0)return!1;if(m.redIAdd(_),this.x.cmp(m)===0)return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add,S1}var Pw;function k_(){return Pw||(Pw=1,function(r){var t=r;t.base=nd(),t.short=PP(),t.mont=RP(),t.edwards=CP()}(_1)),_1}var k1={},Eh={},fr={},TP=Zi,LP=br;fr.inherits=LP;function OP(r,t){return(r.charCodeAt(t)&64512)!==55296||t<0||t+1>=r.length?!1:(r.charCodeAt(t+1)&64512)===56320}function UP(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),s=0;s>6|192,e[n++]=i&63|128):OP(r,s)?(i=65536+((i&1023)<<10)+(r.charCodeAt(++s)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}else for(s=0;s>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return t>>>0}fr.htonl=I_;function DP(r,t){for(var e="",n=0;n>>0}return i}fr.join32=zP;function qP(r,t){for(var e=new Array(r.length*4),n=0,s=0;n>>24,e[s+1]=i>>>16&255,e[s+2]=i>>>8&255,e[s+3]=i&255):(e[s+3]=i>>>24,e[s+2]=i>>>16&255,e[s+1]=i>>>8&255,e[s]=i&255)}return e}fr.split32=qP;function FP(r,t){return r>>>t|r<<32-t}fr.rotr32=FP;function jP(r,t){return r<>>32-t}fr.rotl32=jP;function KP(r,t){return r+t>>>0}fr.sum32=KP;function $P(r,t,e){return r+t+e>>>0}fr.sum32_3=$P;function HP(r,t,e,n){return r+t+e+n>>>0}fr.sum32_4=HP;function VP(r,t,e,n,s){return r+t+e+n+s>>>0}fr.sum32_5=VP;function ZP(r,t,e,n){var s=r[t],i=r[t+1],c=n+i>>>0,l=(c>>0,r[t+1]=c}fr.sum64=ZP;function WP(r,t,e,n){var s=t+n>>>0,i=(s>>0}fr.sum64_hi=WP;function GP(r,t,e,n){var s=t+n;return s>>>0}fr.sum64_lo=GP;function YP(r,t,e,n,s,i,c,l){var p=0,m=t;m=m+n>>>0,p+=m>>0,p+=m>>0,p+=m>>0}fr.sum64_4_hi=YP;function XP(r,t,e,n,s,i,c,l){var p=t+n+i+l;return p>>>0}fr.sum64_4_lo=XP;function JP(r,t,e,n,s,i,c,l,p,m){var v=0,_=t;_=_+n>>>0,v+=_>>0,v+=_>>0,v+=_>>0,v+=_>>0}fr.sum64_5_hi=JP;function QP(r,t,e,n,s,i,c,l,p,m){var v=t+n+i+l+m;return v>>>0}fr.sum64_5_lo=QP;function tR(r,t,e){var n=t<<32-e|r>>>e;return n>>>0}fr.rotr64_hi=tR;function eR(r,t,e){var n=r<<32-e|t>>>e;return n>>>0}fr.rotr64_lo=eR;function rR(r,t,e){return r>>>e}fr.shr64_hi=rR;function nR(r,t,e){var n=r<<32-e|t>>>e;return n>>>0}fr.shr64_lo=nR;var xf={},Rw=fr,iR=Zi;function id(){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}xf.BlockHash=id;id.prototype.update=function(t,e){if(t=Rw.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),this.pending.length===0&&(this.pending=null),t=Rw.join32(t,0,t.length-n,this.endian);for(var s=0;s>>24&255,s[i++]=t>>>16&255,s[i++]=t>>>8&255,s[i++]=t&255}else for(s[i++]=t&255,s[i++]=t>>>8&255,s[i++]=t>>>16&255,s[i++]=t>>>24&255,s[i++]=0,s[i++]=0,s[i++]=0,s[i++]=0,c=8;c>>3}Xo.g0_256=fR;function cR(r){return zo(r,17)^zo(r,19)^r>>>10}Xo.g1_256=cR;var tf=fr,hR=xf,lR=Xo,I1=tf.rotl32,Hf=tf.sum32,dR=tf.sum32_5,pR=lR.ft_1,L_=hR.BlockHash,mR=[1518500249,1859775393,2400959708,3395469782];function Vo(){if(!(this instanceof Vo))return new Vo;L_.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}tf.inherits(Vo,L_);var vR=Vo;Vo.blockSize=512;Vo.outSize=160;Vo.hmacStrength=80;Vo.padLength=64;Vo.prototype._update=function(t,e){for(var n=this.W,s=0;s<16;s++)n[s]=t[e+s];for(;sthis.blockSize&&(t=new this.Hash().update(t).digest()),nC(t.length<=this.blockSize);for(var e=t.length;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(i,c,l)}return C1=n,n.prototype._init=function(i,c,l){var p=i.concat(c).concat(l);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var m=0;m=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(i.concat(l||[])),this._reseed=1},n.prototype.generate=function(i,c,l,p){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof c!="string"&&(p=l,l=c,c=null),l&&(l=t.toArray(l,p||"hex"),this._update(l));for(var m=[];m.length"},T1}var L1,zw;function fC(){if(zw)return L1;zw=1;var r=Is(),t=Wi(),e=t.assert;function n(p,m){if(p instanceof n)return p;this._importDER(p,m)||(e(p.r&&p.s,"Signature without r or s"),this.r=new r(p.r,16),this.s=new r(p.s,16),p.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=p.recoveryParam)}L1=n;function s(){this.place=0}function i(p,m){var v=p[m.place++];if(!(v&128))return v;var _=v&15;if(_===0||_>4)return!1;for(var E=0,w=0,x=m.place;w<_;w++,x++)E<<=8,E|=p[x],E>>>=0;return E<=127?!1:(m.place=x,E)}function c(p){for(var m=0,v=p.length-1;!p[m]&&!(p[m+1]&128)&&m>>3);for(p.push(v|128);--v;)p.push(m>>>(v<<3)&255);p.push(m)}return n.prototype.toDER=function(m){var v=this.r.toArray(),_=this.s.toArray();for(v[0]&128&&(v=[0].concat(v)),_[0]&128&&(_=[0].concat(_)),v=c(v),_=c(_);!_[0]&&!(_[1]&128);)_=_.slice(1);var E=[2];l(E,v.length),E=E.concat(v),E.push(2),l(E,_.length);var w=E.concat(_),x=[48];return l(x,w.length),x=x.concat(w),t.encode(x,m)},L1}var O1,qw;function cC(){if(qw)return O1;qw=1;var r=Is(),t=aC(),e=Wi(),n=ug(),s=sg(),i=e.assert,c=uC(),l=fC();function p(m){if(!(this instanceof p))return new p(m);typeof m=="string"&&(i(Object.prototype.hasOwnProperty.call(n,m),"Unknown curve "+m),m=n[m]),m instanceof n.PresetCurve&&(m={curve:m}),this.curve=m.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=m.curve.g,this.g.precompute(m.curve.n.bitLength()+1),this.hash=m.hash||m.curve.hash}return O1=p,p.prototype.keyPair=function(v){return new c(this,v)},p.prototype.keyFromPrivate=function(v,_){return c.fromPrivate(this,v,_)},p.prototype.keyFromPublic=function(v,_){return c.fromPublic(this,v,_)},p.prototype.genKeyPair=function(v){v||(v={});for(var _=new t({hash:this.hash,pers:v.pers,persEnc:v.persEnc||"utf8",entropy:v.entropy||s(this.hash.hmacStrength),entropyEnc:v.entropy&&v.entropyEnc||"utf8",nonce:this.n.toArray()}),E=this.n.byteLength(),w=this.n.sub(new r(2));;){var x=new r(_.generate(E));if(!(x.cmp(w)>0))return x.iaddn(1),this.keyFromPrivate(x)}},p.prototype._truncateToN=function(v,_){var E=v.byteLength()*8-this.n.bitLength();return E>0&&(v=v.ushrn(E)),!_&&v.cmp(this.n)>=0?v.sub(this.n):v},p.prototype.sign=function(v,_,E,w){typeof E=="object"&&(w=E,E=null),w||(w={}),_=this.keyFromPrivate(_,E),v=this._truncateToN(new r(v,16));for(var x=this.n.byteLength(),A=_.getPrivate().toArray("be",x),B=v.toArray("be",x),P=new t({hash:this.hash,entropy:A,nonce:B,pers:w.pers,persEnc:w.persEnc||"utf8"}),R=this.n.sub(new r(1)),C=0;;C++){var O=w.k?w.k(C):new r(P.generate(this.n.byteLength()));if(O=this._truncateToN(O,!0),!(O.cmpn(1)<=0||O.cmp(R)>=0)){var z=this.g.mul(O);if(!z.isInfinity()){var H=z.getX(),tt=H.umod(this.n);if(tt.cmpn(0)!==0){var nt=O.invm(this.n).mul(tt.mul(_.getPrivate()).iadd(v));if(nt=nt.umod(this.n),nt.cmpn(0)!==0){var G=(z.getY().isOdd()?1:0)|(H.cmp(tt)!==0?2:0);return w.canonical&&nt.cmp(this.nh)>0&&(nt=this.n.sub(nt),G^=1),new l({r:tt,s:nt,recoveryParam:G})}}}}}},p.prototype.verify=function(v,_,E,w){v=this._truncateToN(new r(v,16)),E=this.keyFromPublic(E,w),_=new l(_,"hex");var x=_.r,A=_.s;if(x.cmpn(1)<0||x.cmp(this.n)>=0||A.cmpn(1)<0||A.cmp(this.n)>=0)return!1;var B=A.invm(this.n),P=B.mul(v).umod(this.n),R=B.mul(x).umod(this.n),C;return this.curve._maxwellTrick?(C=this.g.jmulAdd(P,E.getPublic(),R),C.isInfinity()?!1:C.eqXToP(x)):(C=this.g.mulAdd(P,E.getPublic(),R),C.isInfinity()?!1:C.getX().umod(this.n).cmp(x)===0)},p.prototype.recoverPubKey=function(m,v,_,E){i((3&_)===_,"The recovery param is more than two bits"),v=new l(v,E);var w=this.n,x=new r(m),A=v.r,B=v.s,P=_&1,R=_>>1;if(A.cmp(this.curve.p.umod(this.curve.n))>=0&&R)throw new Error("Unable to find sencond key candinate");R?A=this.curve.pointFromX(A.add(this.curve.n),P):A=this.curve.pointFromX(A,P);var C=v.r.invm(w),O=w.sub(x).mul(C).umod(w),z=B.mul(C).umod(w);return this.g.mulAdd(O,A,z)},p.prototype.getKeyRecoveryParam=function(m,v,_,E){if(v=new l(v,E),v.recoveryParam!==null)return v.recoveryParam;for(var w=0;w<4;w++){var x;try{x=this.recoverPubKey(m,v,w)}catch{continue}if(x.eq(_))return w}throw new Error("Unable to find valid recovery factor")},O1}var U1,Fw;function hC(){if(Fw)return U1;Fw=1;var r=Wi(),t=r.assert,e=r.parseBytes,n=r.cachedProperty;function s(i,c){this.eddsa=i,this._secret=e(c.secret),i.isPoint(c.pub)?this._pub=c.pub:this._pubBytes=e(c.pub)}return s.fromPublic=function(c,l){return l instanceof s?l:new s(c,{pub:l})},s.fromSecret=function(c,l){return l instanceof s?l:new s(c,{secret:l})},s.prototype.secret=function(){return this._secret},n(s,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(s,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(s,"privBytes",function(){var c=this.eddsa,l=this.hash(),p=c.encodingLength-1,m=l.slice(0,c.encodingLength);return m[0]&=248,m[p]&=127,m[p]|=64,m}),n(s,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(s,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(s,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),s.prototype.sign=function(c){return t(this._secret,"KeyPair can only verify"),this.eddsa.sign(c,this)},s.prototype.verify=function(c,l){return this.eddsa.verify(c,l,this)},s.prototype.getSecret=function(c){return t(this._secret,"KeyPair is public only"),r.encode(this.secret(),c)},s.prototype.getPublic=function(c){return r.encode(this.pubBytes(),c)},U1=s,U1}var N1,jw;function lC(){if(jw)return N1;jw=1;var r=Is(),t=Wi(),e=t.assert,n=t.cachedProperty,s=t.parseBytes;function i(c,l){this.eddsa=c,typeof l!="object"&&(l=s(l)),Array.isArray(l)&&(l={R:l.slice(0,c.encodingLength),S:l.slice(c.encodingLength)}),e(l.R&&l.S,"Signature without R or S"),c.isPoint(l.R)&&(this._R=l.R),l.S instanceof r&&(this._S=l.S),this._Rencoded=Array.isArray(l.R)?l.R:l.Rencoded,this._Sencoded=Array.isArray(l.S)?l.S:l.Sencoded}return n(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return t.encode(this.toBytes(),"hex").toUpperCase()},N1=i,N1}var D1,Kw;function dC(){if(Kw)return D1;Kw=1;var r=Eh,t=ug(),e=Wi(),n=e.assert,s=e.parseBytes,i=hC(),c=lC();function l(p){if(n(p==="ed25519","only tested with ed25519 so far"),!(this instanceof l))return new l(p);p=t[p].curve,this.curve=p,this.g=p.g,this.g.precompute(p.n.bitLength()+1),this.pointClass=p.point().constructor,this.encodingLength=Math.ceil(p.n.bitLength()/8),this.hash=r.sha512}return D1=l,l.prototype.sign=function(m,v){m=s(m);var _=this.keyFromSecret(v),E=this.hashInt(_.messagePrefix(),m),w=this.g.mul(E),x=this.encodePoint(w),A=this.hashInt(x,_.pubBytes(),m).mul(_.priv()),B=E.add(A).umod(this.curve.n);return this.makeSignature({R:w,S:B,Rencoded:x})},l.prototype.verify=function(m,v,_){m=s(m),v=this.makeSignature(v);var E=this.keyFromPublic(_),w=this.hashInt(v.Rencoded(),E.pubBytes(),m),x=this.g.mul(v.S()),A=v.R().add(E.pub().mul(w));return A.eq(x)},l.prototype.hashInt=function(){for(var m=this.hash(),v=0;v0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(j0)),j0.exports}var q1={},F1={},j1,Vw;function cg(){if(Vw)return j1;Vw=1;var r=yr,t=r.Buffer,e={},n;for(n in r)r.hasOwnProperty(n)&&(n==="SlowBuffer"||n==="Buffer"||(e[n]=r[n]));var s=e.Buffer={};for(n in t)t.hasOwnProperty(n)&&(n==="allocUnsafe"||n==="allocUnsafeSlow"||(s[n]=t[n]));if(e.Buffer.prototype=t.prototype,(!s.from||s.from===Uint8Array.from)&&(s.from=function(i,c,l){if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof i);if(i&&typeof i.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);return t(i,c,l)}),s.alloc||(s.alloc=function(i,c,l){if(typeof i!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof i);if(i<0||i>=2*(1<<30))throw new RangeError('The value "'+i+'" is invalid for option "size"');var p=t(i);return!c||c.length===0?p.fill(0):typeof l=="string"?p.fill(c,l):p.fill(c),p}),!e.kStringMaxLength)try{e.kStringMaxLength=Zt.process.binding("buffer").kStringMaxLength}catch{}return e.constants||(e.constants={MAX_LENGTH:e.kMaxLength},e.kStringMaxLength&&(e.constants.MAX_STRING_LENGTH=e.kStringMaxLength)),j1=e,j1}var K1={},Zw;function hg(){if(Zw)return K1;Zw=1;const r=br;function t(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}K1.Reporter=t,t.prototype.isError=function(s){return s instanceof e},t.prototype.save=function(){const s=this._reporterState;return{obj:s.obj,pathLen:s.path.length}},t.prototype.restore=function(s){const i=this._reporterState;i.obj=s.obj,i.path=i.path.slice(0,s.pathLen)},t.prototype.enterKey=function(s){return this._reporterState.path.push(s)},t.prototype.exitKey=function(s){const i=this._reporterState;i.path=i.path.slice(0,s-1)},t.prototype.leaveKey=function(s,i,c){const l=this._reporterState;this.exitKey(s),l.obj!==null&&(l.obj[i]=c)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){const s=this._reporterState,i=s.obj;return s.obj={},i},t.prototype.leaveObject=function(s){const i=this._reporterState,c=i.obj;return i.obj=s,c},t.prototype.error=function(s){let i;const c=this._reporterState,l=s instanceof e;if(l?i=s:i=new e(c.path.map(function(p){return"["+JSON.stringify(p)+"]"}).join(""),s.message||s,s.stack),!c.options.partial)throw i;return l||c.errors.push(i),i},t.prototype.wrapResult=function(s){const i=this._reporterState;return i.options.partial?{result:this.isError(s)?null:s,errors:i.errors}:s};function e(n,s){this.path=n,this.rethrow(s)}return r(e,Error),e.prototype.rethrow=function(s){if(this.message=s+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(i){this.stack=i.stack}return this},K1}var t0={},Ww;function Uc(){if(Ww)return t0;Ww=1;const r=br,t=hg().Reporter,e=cg().Buffer;function n(i,c){if(t.call(this,c),!e.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}r(n,t),t0.DecoderBuffer=n,n.isDecoderBuffer=function(c){return c instanceof n?!0:typeof c=="object"&&e.isBuffer(c.base)&&c.constructor.name==="DecoderBuffer"&&typeof c.offset=="number"&&typeof c.length=="number"&&typeof c.save=="function"&&typeof c.restore=="function"&&typeof c.isEmpty=="function"&&typeof c.readUInt8=="function"&&typeof c.skip=="function"&&typeof c.raw=="function"},n.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},n.prototype.restore=function(c){const l=new n(this.base);return l.offset=c.offset,l.length=this.offset,this.offset=c.offset,t.prototype.restore.call(this,c.reporter),l},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(c){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(c||"DecoderBuffer overrun")},n.prototype.skip=function(c,l){if(!(this.offset+c<=this.length))return this.error(l||"DecoderBuffer overrun");const p=new n(this.base);return p._reporterState=this._reporterState,p.offset=this.offset,p.length=this.offset+c,this.offset+=c,p},n.prototype.raw=function(c){return this.base.slice(c?c.offset:this.offset,this.length)};function s(i,c){if(Array.isArray(i))this.length=0,this.value=i.map(function(l){return s.isEncoderBuffer(l)||(l=new s(l,c)),this.length+=l.length,l},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return c.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=e.byteLength(i);else if(e.isBuffer(i))this.value=i,this.length=i.length;else return c.error("Unsupported type: "+typeof i)}return t0.EncoderBuffer=s,s.isEncoderBuffer=function(c){return c instanceof s?!0:typeof c=="object"&&c.constructor.name==="EncoderBuffer"&&typeof c.length=="number"&&typeof c.join=="function"},s.prototype.join=function(c,l){return c||(c=e.alloc(this.length)),l||(l=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(p){p.join(c,l),l+=p.length}):(typeof this.value=="number"?c[l]=this.value:typeof this.value=="string"?c.write(this.value,l):e.isBuffer(this.value)&&this.value.copy(c,l),l+=this.length)),c},t0}var $1,Gw;function lg(){if(Gw)return $1;Gw=1;const r=hg().Reporter,t=Uc().EncoderBuffer,e=Uc().DecoderBuffer,n=Zi,s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function l(m,v,_){const E={};this._baseState=E,E.name=_,E.enc=m,E.parent=v||null,E.children=null,E.tag=null,E.args=null,E.reverseArgs=null,E.choice=null,E.optional=!1,E.any=!1,E.obj=!1,E.use=null,E.useDecoder=null,E.key=null,E.default=null,E.explicit=null,E.implicit=null,E.contains=null,E.parent||(E.children=[],this._wrap())}$1=l;const p=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return l.prototype.clone=function(){const v=this._baseState,_={};p.forEach(function(w){_[w]=v[w]});const E=new this.constructor(_.parent);return E._baseState=_,E},l.prototype._wrap=function(){const v=this._baseState;i.forEach(function(_){this[_]=function(){const w=new this.constructor(this);return v.children.push(w),w[_].apply(w,arguments)}},this)},l.prototype._init=function(v){const _=this._baseState;n(_.parent===null),v.call(this),_.children=_.children.filter(function(E){return E._baseState.parent===this},this),n.equal(_.children.length,1,"Root node can have only one child")},l.prototype._useArgs=function(v){const _=this._baseState,E=v.filter(function(w){return w instanceof this.constructor},this);v=v.filter(function(w){return!(w instanceof this.constructor)},this),E.length!==0&&(n(_.children===null),_.children=E,E.forEach(function(w){w._baseState.parent=this},this)),v.length!==0&&(n(_.args===null),_.args=v,_.reverseArgs=v.map(function(w){if(typeof w!="object"||w.constructor!==Object)return w;const x={};return Object.keys(w).forEach(function(A){A==(A|0)&&(A|=0);const B=w[A];x[B]=A}),x}))},c.forEach(function(m){l.prototype[m]=function(){const _=this._baseState;throw new Error(m+" not implemented for encoding: "+_.enc)}}),s.forEach(function(m){l.prototype[m]=function(){const _=this._baseState,E=Array.prototype.slice.call(arguments);return n(_.tag===null),_.tag=m,this._useArgs(E),this}}),l.prototype.use=function(v){n(v);const _=this._baseState;return n(_.use===null),_.use=v,this},l.prototype.optional=function(){const v=this._baseState;return v.optional=!0,this},l.prototype.def=function(v){const _=this._baseState;return n(_.default===null),_.default=v,_.optional=!0,this},l.prototype.explicit=function(v){const _=this._baseState;return n(_.explicit===null&&_.implicit===null),_.explicit=v,this},l.prototype.implicit=function(v){const _=this._baseState;return n(_.explicit===null&&_.implicit===null),_.implicit=v,this},l.prototype.obj=function(){const v=this._baseState,_=Array.prototype.slice.call(arguments);return v.obj=!0,_.length!==0&&this._useArgs(_),this},l.prototype.key=function(v){const _=this._baseState;return n(_.key===null),_.key=v,this},l.prototype.any=function(){const v=this._baseState;return v.any=!0,this},l.prototype.choice=function(v){const _=this._baseState;return n(_.choice===null),_.choice=v,this._useArgs(Object.keys(v).map(function(E){return v[E]})),this},l.prototype.contains=function(v){const _=this._baseState;return n(_.use===null),_.contains=v,this},l.prototype._decode=function(v,_){const E=this._baseState;if(E.parent===null)return v.wrapResult(E.children[0]._decode(v,_));let w=E.default,x=!0,A=null;if(E.key!==null&&(A=v.enterKey(E.key)),E.optional){let P=null;if(E.explicit!==null?P=E.explicit:E.implicit!==null?P=E.implicit:E.tag!==null&&(P=E.tag),P===null&&!E.any){const R=v.save();try{E.choice===null?this._decodeGeneric(E.tag,v,_):this._decodeChoice(v,_),x=!0}catch{x=!1}v.restore(R)}else if(x=this._peekTag(v,P,E.any),v.isError(x))return x}let B;if(E.obj&&x&&(B=v.enterObject()),x){if(E.explicit!==null){const R=this._decodeTag(v,E.explicit);if(v.isError(R))return R;v=R}const P=v.offset;if(E.use===null&&E.choice===null){let R;E.any&&(R=v.save());const C=this._decodeTag(v,E.implicit!==null?E.implicit:E.tag,E.any);if(v.isError(C))return C;E.any?w=v.raw(R):v=C}if(_&&_.track&&E.tag!==null&&_.track(v.path(),P,v.length,"tagged"),_&&_.track&&E.tag!==null&&_.track(v.path(),v.offset,v.length,"content"),E.any||(E.choice===null?w=this._decodeGeneric(E.tag,v,_):w=this._decodeChoice(v,_)),v.isError(w))return w;if(!E.any&&E.choice===null&&E.children!==null&&E.children.forEach(function(C){C._decode(v,_)}),E.contains&&(E.tag==="octstr"||E.tag==="bitstr")){const R=new e(w);w=this._getUse(E.contains,v._reporterState.obj)._decode(R,_)}}return E.obj&&x&&(w=v.leaveObject(B)),E.key!==null&&(w!==null||x===!0)?v.leaveKey(A,E.key,w):A!==null&&v.exitKey(A),w},l.prototype._decodeGeneric=function(v,_,E){const w=this._baseState;return v==="seq"||v==="set"?null:v==="seqof"||v==="setof"?this._decodeList(_,v,w.args[0],E):/str$/.test(v)?this._decodeStr(_,v,E):v==="objid"&&w.args?this._decodeObjid(_,w.args[0],w.args[1],E):v==="objid"?this._decodeObjid(_,null,null,E):v==="gentime"||v==="utctime"?this._decodeTime(_,v,E):v==="null_"?this._decodeNull(_,E):v==="bool"?this._decodeBool(_,E):v==="objDesc"?this._decodeStr(_,v,E):v==="int"||v==="enum"?this._decodeInt(_,w.args&&w.args[0],E):w.use!==null?this._getUse(w.use,_._reporterState.obj)._decode(_,E):_.error("unknown tag: "+v)},l.prototype._getUse=function(v,_){const E=this._baseState;return E.useDecoder=this._use(v,_),n(E.useDecoder._baseState.parent===null),E.useDecoder=E.useDecoder._baseState.children[0],E.implicit!==E.useDecoder._baseState.implicit&&(E.useDecoder=E.useDecoder.clone(),E.useDecoder._baseState.implicit=E.implicit),E.useDecoder},l.prototype._decodeChoice=function(v,_){const E=this._baseState;let w=null,x=!1;return Object.keys(E.choice).some(function(A){const B=v.save(),P=E.choice[A];try{const R=P._decode(v,_);if(v.isError(R))return!1;w={type:A,value:R},x=!0}catch{return v.restore(B),!1}return!0},this),x?w:v.error("Choice not matched")},l.prototype._createEncoderBuffer=function(v){return new t(v,this.reporter)},l.prototype._encode=function(v,_,E){const w=this._baseState;if(w.default!==null&&w.default===v)return;const x=this._encodeValue(v,_,E);if(x!==void 0&&!this._skipDefault(x,_,E))return x},l.prototype._encodeValue=function(v,_,E){const w=this._baseState;if(w.parent===null)return w.children[0]._encode(v,_||new r);let x=null;if(this.reporter=_,w.optional&&v===void 0)if(w.default!==null)v=w.default;else return;let A=null,B=!1;if(w.any)x=this._createEncoderBuffer(v);else if(w.choice)x=this._encodeChoice(v,_);else if(w.contains)A=this._getUse(w.contains,E)._encode(v,_),B=!0;else if(w.children)A=w.children.map(function(P){if(P._baseState.tag==="null_")return P._encode(null,_,v);if(P._baseState.key===null)return _.error("Child should have a key");const R=_.enterKey(P._baseState.key);if(typeof v!="object")return _.error("Child expected, but input is not object");const C=P._encode(v[P._baseState.key],_,v);return _.leaveKey(R),C},this).filter(function(P){return P}),A=this._createEncoderBuffer(A);else if(w.tag==="seqof"||w.tag==="setof"){if(!(w.args&&w.args.length===1))return _.error("Too many args for : "+w.tag);if(!Array.isArray(v))return _.error("seqof/setof, but data is not Array");const P=this.clone();P._baseState.implicit=null,A=this._createEncoderBuffer(v.map(function(R){const C=this._baseState;return this._getUse(C.args[0],v)._encode(R,_)},P))}else w.use!==null?x=this._getUse(w.use,E)._encode(v,_):(A=this._encodePrimitive(w.tag,v),B=!0);if(!w.any&&w.choice===null){const P=w.implicit!==null?w.implicit:w.tag,R=w.implicit===null?"universal":"context";P===null?w.use===null&&_.error("Tag could be omitted only for .use()"):w.use===null&&(x=this._encodeComposite(P,B,R,A))}return w.explicit!==null&&(x=this._encodeComposite(w.explicit,!1,"context",x)),x},l.prototype._encodeChoice=function(v,_){const E=this._baseState,w=E.choice[v.type];return w||n(!1,v.type+" not found in "+JSON.stringify(Object.keys(E.choice))),w._encode(v.value,_)},l.prototype._encodePrimitive=function(v,_){const E=this._baseState;if(/str$/.test(v))return this._encodeStr(_,v);if(v==="objid"&&E.args)return this._encodeObjid(_,E.reverseArgs[0],E.args[1]);if(v==="objid")return this._encodeObjid(_,null,null);if(v==="gentime"||v==="utctime")return this._encodeTime(_,v);if(v==="null_")return this._encodeNull();if(v==="int"||v==="enum")return this._encodeInt(_,E.args&&E.reverseArgs[0]);if(v==="bool")return this._encodeBool(_);if(v==="objDesc")return this._encodeStr(_,v);throw new Error("Unsupported tag: "+v)},l.prototype._isNumstr=function(v){return/^[0-9 ]*$/.test(v)},l.prototype._isPrintstr=function(v){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(v)},$1}var H1={},Yw;function dg(){return Yw||(Yw=1,function(r){function t(e){const n={};return Object.keys(e).forEach(function(s){(s|0)==s&&(s=s|0);const i=e[s];n[i]=s}),n}r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=t(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=t(r.tag)}(H1)),H1}var V1,Xw;function V_(){if(Xw)return V1;Xw=1;const r=br,t=cg().Buffer,e=lg(),n=dg();function s(p){this.enc="der",this.name=p.name,this.entity=p,this.tree=new i,this.tree._init(p.body)}V1=s,s.prototype.encode=function(m,v){return this.tree._encode(m,v).join()};function i(p){e.call(this,"der",p)}r(i,e),i.prototype._encodeComposite=function(m,v,_,E){const w=l(m,v,_,this.reporter);if(E.length<128){const B=t.alloc(2);return B[0]=w,B[1]=E.length,this._createEncoderBuffer([B,E])}let x=1;for(let B=E.length;B>=256;B>>=8)x++;const A=t.alloc(1+1+x);A[0]=w,A[1]=128|x;for(let B=1+x,P=E.length;P>0;B--,P>>=8)A[B]=P&255;return this._createEncoderBuffer([A,E])},i.prototype._encodeStr=function(m,v){if(v==="bitstr")return this._createEncoderBuffer([m.unused|0,m.data]);if(v==="bmpstr"){const _=t.alloc(m.length*2);for(let E=0;E=40)return this.reporter.error("Second objid identifier OOB");m.splice(0,2,m[0]*40+m[1])}let E=0;for(let A=0;A=128;B>>=7)E++}const w=t.alloc(E);let x=w.length-1;for(let A=m.length-1;A>=0;A--){let B=m[A];for(w[x--]=B&127;(B>>=7)>0;)w[x--]=128|B&127}return this._createEncoderBuffer(w)};function c(p){return p<10?"0"+p:p}i.prototype._encodeTime=function(m,v){let _;const E=new Date(m);return v==="gentime"?_=[c(E.getUTCFullYear()),c(E.getUTCMonth()+1),c(E.getUTCDate()),c(E.getUTCHours()),c(E.getUTCMinutes()),c(E.getUTCSeconds()),"Z"].join(""):v==="utctime"?_=[c(E.getUTCFullYear()%100),c(E.getUTCMonth()+1),c(E.getUTCDate()),c(E.getUTCHours()),c(E.getUTCMinutes()),c(E.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+v+" time is not supported yet"),this._encodeStr(_,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(m,v){if(typeof m=="string"){if(!v)return this.reporter.error("String int or enum given, but no values map");if(!v.hasOwnProperty(m))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(m));m=v[m]}if(typeof m!="number"&&!t.isBuffer(m)){const w=m.toArray();!m.sign&&w[0]&128&&w.unshift(0),m=t.from(w)}if(t.isBuffer(m)){let w=m.length;m.length===0&&w++;const x=t.alloc(w);return m.copy(x),m.length===0&&(x[0]=0),this._createEncoderBuffer(x)}if(m<128)return this._createEncoderBuffer(m);if(m<256)return this._createEncoderBuffer([0,m]);let _=1;for(let w=m;w>=256;w>>=8)_++;const E=new Array(_);for(let w=E.length-1;w>=0;w--)E[w]=m&255,m>>=8;return E[0]&128&&E.unshift(0),this._createEncoderBuffer(t.from(E))},i.prototype._encodeBool=function(m){return this._createEncoderBuffer(m?255:0)},i.prototype._use=function(m,v){return typeof m=="function"&&(m=m(v)),m._getEncoder("der").tree},i.prototype._skipDefault=function(m,v,_){const E=this._baseState;let w;if(E.default===null)return!1;const x=m.join();if(E.defaultBuffer===void 0&&(E.defaultBuffer=this._encodeValue(E.default,v,_).join()),x.length!==E.defaultBuffer.length)return!1;for(w=0;w=31?_.error("Multi-octet tag encoding unsupported"):(m||(E|=32),E|=n.tagClassByName[v||"universal"]<<6,E)}return V1}var Z1,Jw;function pC(){if(Jw)return Z1;Jw=1;const r=br,t=V_();function e(n){t.call(this,n),this.enc="pem"}return r(e,t),Z1=e,e.prototype.encode=function(s,i){const l=t.prototype.encode.call(this,s).toString("base64"),p=["-----BEGIN "+i.label+"-----"];for(let m=0;m>6],w=(_&32)===0;if((_&31)===31){let A=_;for(_=0;(A&128)===128;){if(A=m.readUInt8(v),m.isError(A))return A;_<<=7,_|=A&127}}else _&=31;const x=s.tag[_];return{cls:E,primitive:w,tag:_,tagStr:x}}function p(m,v,_){let E=m.readUInt8(_);if(m.isError(E))return E;if(!v&&E===128)return null;if(!(E&128))return E;const w=E&127;if(w>4)return m.error("length octect is too long");E=0;for(let x=0;x0&&C.ishrn(O),C}function x(P,R){P=w(P,R),P=P.mod(R);var C=r.from(P.toArray());if(C.length=0)throw new Error("invalid sig")}return rp=i,rp}var np,d6;function AC(){if(d6)return np;d6=1;var r=sr.Buffer,t=_h,e=V7,n=br,s=MC(),i=EC(),c=c_;Object.keys(c).forEach(function(_){c[_].id=r.from(c[_].id,"hex"),c[_.toLowerCase()]=c[_]});function l(_){e.Writable.call(this);var E=c[_];if(!E)throw new Error("Unknown message digest");this._hashType=E.hash,this._hash=t(E.hash),this._tag=E.id,this._signType=E.sign}n(l,e.Writable),l.prototype._write=function(E,w,x){this._hash.update(E),x()},l.prototype.update=function(E,w){return this._hash.update(typeof E=="string"?r.from(E,w):E),this},l.prototype.sign=function(E,w){this.end();var x=this._hash.digest(),A=s(x,E,this._hashType,this._signType,this._tag);return w?A.toString(w):A};function p(_){e.Writable.call(this);var E=c[_];if(!E)throw new Error("Unknown message digest");this._hash=t(E.hash),this._tag=E.id,this._signType=E.sign}n(p,e.Writable),p.prototype._write=function(E,w,x){this._hash.update(E),x()},p.prototype.update=function(E,w){return this._hash.update(typeof E=="string"?r.from(E,w):E),this},p.prototype.verify=function(E,w,x){var A=typeof w=="string"?r.from(w,x):w;this.end();var B=this._hash.digest();return i(A,B,E,this._signType,this._tag)};function m(_){return new l(_)}function v(_){return new p(_)}return np={Sign:m,Verify:v,createSign:m,createVerify:v},np}var K0={exports:{}};K0.exports;var p6;function SC(){return p6||(p6=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(K0)),K0.exports}var ip,m6;function kC(){if(m6)return ip;m6=1;var r=fg(),t=SC();ip=function(c){return new n(c)};var e={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};e.p224=e.secp224r1,e.p256=e.secp256r1=e.prime256v1,e.p192=e.secp192r1=e.prime192v1,e.p384=e.secp384r1,e.p521=e.secp521r1;function n(i){this.curveType=e[i],this.curveType||(this.curveType={name:i}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,c){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,c)},n.prototype.computeSecret=function(i,c,l){c=c||"utf8",Zt.Buffer.isBuffer(i)||(i=new Zt.Buffer(i,c));var p=this.curve.keyFromPublic(i).getPublic(),m=p.mul(this.keys.getPrivate()).getX();return s(m,l,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,c){var l=this.keys.getPublic(c==="compressed",!0);return c==="hybrid"&&(l[l.length-1]%2?l[0]=7:l[0]=6),s(l,i)},n.prototype.getPrivateKey=function(i){return s(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,c){return c=c||"utf8",Zt.Buffer.isBuffer(i)||(i=new Zt.Buffer(i,c)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,c){c=c||"utf8",Zt.Buffer.isBuffer(i)||(i=new Zt.Buffer(i,c));var l=new t(i);return l=l.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(l),this};function s(i,c,l){Array.isArray(i)||(i=i.toArray());var p=new Zt.Buffer(i);if(l&&p.length0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=67108863^67108863>>>a<=67108864;a++)this.words[a]-=67108864,a===this.length-1?this.words[a+1]=1:this.words[a+1]++;return this.length=Math.max(this.length,a+1),this},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}($0)),$0.exports}var up,b6;function t9(){if(b6)return up;b6=1;var r=pg(),t=sr.Buffer;function e(n,s){return t.from(n.toRed(r.mont(s.modulus)).redPow(new r(s.publicExponent)).fromRed().toArray())}return up=e,up}var fp,w6;function IC(){if(w6)return fp;w6=1;var r=od(),t=bf,e=_h,n=J_(),s=Q_(),i=pg(),c=t9(),l=ag(),p=sr.Buffer;fp=function(w,x,A){var B;w.padding?B=w.padding:A?B=1:B=4;var P=r(w),R;if(B===4)R=m(P,x);else if(B===1)R=v(P,x,A);else if(B===3){if(R=new i(x),R.cmp(P.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return A?l(R,P):c(R,P)};function m(E,w){var x=E.modulus.byteLength(),A=w.length,B=e("sha1").update(p.alloc(0)).digest(),P=B.length,R=2*P;if(A>x-R-2)throw new Error("message too long");var C=p.alloc(x-A-R-2),O=x-P-1,z=t(P),H=s(p.concat([B,C,p.alloc(1,1),w],O),n(z,O)),tt=s(z,n(H,P));return new i(p.concat([p.alloc(1),tt,H],x))}function v(E,w,x){var A=w.length,B=E.modulus.byteLength();if(A>B-11)throw new Error("message too long");var P;return x?P=p.alloc(B-A-3,255):P=_(B-A-3),new i(p.concat([p.from([0,x?1:2]),P,p.alloc(1),w],B))}function _(E){for(var w=p.allocUnsafe(E),x=0,A=t(E*2),B=0,P;xP||new n(w).cmp(B.modulus)>=0)throw new Error("decryption error");var R;x?R=c(new n(w),B):R=s(w,B);var C=l.alloc(P-R.length);if(R=l.concat([C,R],P),A===4)return p(B,R);if(A===1)return m(B,R,x);if(A===3)return R;throw new Error("unknown padding")};function p(_,E){var w=_.modulus.byteLength(),x=i("sha1").update(l.alloc(0)).digest(),A=x.length;if(E[0]!==0)throw new Error("decryption error");var B=E.slice(1,A+1),P=E.slice(A+1),R=e(B,t(P,A)),C=e(P,t(R,w-A-1));if(v(x,C.slice(0,A)))throw new Error("decryption error");for(var O=A;C[O]===0;)O++;if(C[O++]!==1)throw new Error("decryption error");return C.slice(O)}function m(_,E,w){for(var x=E.slice(0,2),A=2,B=0;E[A++]!==0;)if(A>=E.length){B++;break}var P=E.slice(2,A-1);if((x.toString("hex")!=="0002"&&!w||x.toString("hex")!=="0001"&&w)&&B++,P.length<8&&B++,B)throw new Error("decryption error");return E.slice(A)}function v(_,E){_=l.from(_),E=l.from(E);var w=0,x=_.length;_.length!==E.length&&(w++,x=Math.min(_.length,E.length));for(var A=-1;++Ac||E<0)throw new TypeError("offset must be a uint32");if(E>s||E>w)throw new RangeError("offset out of range")}function p(E,w,x){if(typeof E!="number"||E!==E)throw new TypeError("size must be a number");if(E>c||E<0)throw new TypeError("size must be a uint32");if(E+w>x||E>s)throw new RangeError("buffer too small")}i&&i.getRandomValues||!Zt.process.browser?(du.randomFill=m,du.randomFillSync=_):(du.randomFill=r,du.randomFillSync=r);function m(E,w,x,A){if(!n.isBuffer(E)&&!(E instanceof Re.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof w=="function")A=w,w=0,x=E.length;else if(typeof x=="function")A=x,x=E.length-w;else if(typeof A!="function")throw new TypeError('"cb" argument must be a function');return l(w,E.length),p(x,w,E.length),v(E,w,x,A)}function v(E,w,x,A){if(Zt.process.browser){var B=E.buffer,P=new Uint8Array(B,w,x);if(i.getRandomValues(P),A){Zt.process.nextTick(function(){A(null,E)});return}return E}if(A){e(x,function(C,O){if(C)return A(C);O.copy(E,w),A(null,E)});return}var R=e(x);return R.copy(E,w),E}function _(E,w,x){if(typeof w>"u"&&(w=0),!n.isBuffer(E)&&!(E instanceof Re.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return l(w,E.length),x===void 0&&(x=E.length-w),p(x,w,E.length),v(E,w,x)}return du}var E6;function e9(){if(E6)return Je;E6=1,Je.randomBytes=Je.rng=Je.pseudoRandomBytes=Je.prng=bf,Je.createHash=Je.Hash=_h,Je.createHmac=Je.Hmac=f_();var r=NB(),t=Object.keys(r),e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);Je.getHashes=function(){return e};var n=m_();Je.pbkdf2=n.pbkdf2,Je.pbkdf2Sync=n.pbkdf2Sync;var s=rP();Je.Cipher=s.Cipher,Je.createCipher=s.createCipher,Je.Cipheriv=s.Cipheriv,Je.createCipheriv=s.createCipheriv,Je.Decipher=s.Decipher,Je.createDecipher=s.createDecipher,Je.Decipheriv=s.Decipheriv,Je.createDecipheriv=s.createDecipheriv,Je.getCiphers=s.getCiphers,Je.listCiphers=s.listCiphers;var i=pP();Je.DiffieHellmanGroup=i.DiffieHellmanGroup,Je.createDiffieHellmanGroup=i.createDiffieHellmanGroup,Je.getDiffieHellman=i.getDiffieHellman,Je.createDiffieHellman=i.createDiffieHellman,Je.DiffieHellman=i.DiffieHellman;var c=AC();Je.createSign=c.createSign,Je.Sign=c.Sign,Je.createVerify=c.createVerify,Je.Verify=c.Verify,Je.createECDH=kC();var l=PC();Je.publicEncrypt=l.publicEncrypt,Je.privateEncrypt=l.privateEncrypt,Je.publicDecrypt=l.publicDecrypt,Je.privateDecrypt=l.privateDecrypt;var p=RC();return Je.randomFill=p.randomFill,Je.randomFillSync=p.randomFillSync,Je.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` +`))},Je.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},Je}var CC=function(r){return function(t,e){var n=xe.useRef(!1);r(function(){return function(){n.current=!1}},[]),r(function(){if(!n.current)n.current=!0;else return t()},e)}},f2=function(r){return typeof r=="function"},TC=function(r){return typeof r>"u"},LC=!1;const OC=LC;function UC(r){OC&&(f2(r)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof r)));var t=xe.useRef(r);t.current=xe.useMemo(function(){return r},[r]);var e=xe.useRef();return e.current||(e.current=function(){for(var n=[],s=0;s{},emptyCart:()=>{},removeFromCart:()=>{},referrerKey:void 0}),KC=({children:r,referrerKey:t}={})=>{const[e={},n]=jC("bonfida-widget-cart",{defaultValue:{}}),s=p=>{n({...e,[p.domain]:p})},i=p=>{const m={...e};delete m[p],n(m)},c=()=>n({}),l=!Object.values(e).length;return St.jsx(Ah.Provider,{value:{cart:e,addToCart:s,removeFromCart:i,isCartEmpty:l,emptyCart:c,referrerKey:t},children:r})},sd=xe.createContext({status:null,setStatus:()=>{},setError:()=>{}}),$C=({children:r})=>{const[t,e]=xe.useState(null),n=s=>{e({status:"error",message:s})};return St.jsx(sd.Provider,{value:{status:t,setStatus:e,setError:n},children:r})},mg=xe.createContext({connection:null});function vg(){return xe.useContext(mg)}const HC=({children:r})=>{const{connection:t}=eI();return St.jsx(mg.Provider,{value:{connection:t},children:r})},VC=({children:r,connection:t})=>t?t?St.jsx(mg.Provider,{value:{connection:t},children:r}):St.jsx(St.Fragment,{children:r}):St.jsx(HC,{children:r}),ZC={publicKey:null,wallets:[],wallet:null,connect:async()=>{},select:()=>{},connecting:!1,connected:!1,disconnect:async()=>{},visible:!1,setVisible:()=>{},connection:null,signAllTransactions:async r=>r},gg=xe.createContext(ZC);function ad(){return xe.useContext(gg)}const WC=({children:r})=>{const t=rI(),{connection:e}=vg(),{visible:n,setVisible:s}=nI(),i={visible:n,setVisible:s,connection:e,...t};return St.jsx(gg.Provider,{value:i,children:r})},GC=({children:r,passthroughWallet:t})=>{const{connection:e}=vg();return t?t?St.jsx(gg.Provider,{value:{...t,connection:e},children:r}):St.jsx(St.Fragment,{children:r}):St.jsx(WC,{children:r})},YC=({children:r,endpoint:t,connection:e,passthroughWallet:n})=>{const s=xe.useMemo(()=>t&&!e?({children:c})=>St.jsx(yI,{endpoint:t,children:c}):xe.Fragment,[t,e]),i=xe.useMemo(()=>n?xe.Fragment:({children:c})=>St.jsx(iI,{wallets:[new oI],autoConnect:!0,children:c}),[n]);return St.jsx(s,{children:St.jsx(i,{children:St.jsx(sI,{children:St.jsx(VC,{connection:e,children:St.jsx(GC,{passthroughWallet:n,children:r})})})})})};function Nc(){return Nc=Object.assign||function(r){for(var t=1;t{const t=r.decode.bind(r),e=r.encode.bind(r);return{decode:t,encode:e}},fT=r=>t=>{const e=$7(r,t),{encode:n,decode:s}=xg(e),i=e;return i.decode=(c,l)=>{const p=s(c,l);return aI(Zt.Buffer.from(p))},i.encode=(c,l,p)=>{const m=uI(c,r);return n(m,l,p)},i},cT=fT(8),hT=r=>{const t=$l(r),{encode:e,decode:n}=xg(t),s=t;return s.decode=(i,c)=>!!n(i,c),s.encode=(i,c,l)=>{const p=Number(i);return e(p,c,l)},s},S6=r=>{const t=$7(32,r),{encode:e,decode:n}=xg(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return new Ne(l)},s.encode=(i,c,l)=>{const p=i.toBuffer();return e(p,c,l)},s};class lT extends Error{constructor(t){super(t)}}class dT extends lT{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var ul;(function(r){r[r.InitializeMint=0]="InitializeMint",r[r.InitializeAccount=1]="InitializeAccount",r[r.InitializeMultisig=2]="InitializeMultisig",r[r.Transfer=3]="Transfer",r[r.Approve=4]="Approve",r[r.Revoke=5]="Revoke",r[r.SetAuthority=6]="SetAuthority",r[r.MintTo=7]="MintTo",r[r.Burn=8]="Burn",r[r.CloseAccount=9]="CloseAccount",r[r.FreezeAccount=10]="FreezeAccount",r[r.ThawAccount=11]="ThawAccount",r[r.TransferChecked=12]="TransferChecked",r[r.ApproveChecked=13]="ApproveChecked",r[r.MintToChecked=14]="MintToChecked",r[r.BurnChecked=15]="BurnChecked",r[r.InitializeAccount2=16]="InitializeAccount2",r[r.SyncNative=17]="SyncNative",r[r.InitializeAccount3=18]="InitializeAccount3",r[r.InitializeMultisig2=19]="InitializeMultisig2",r[r.InitializeMint2=20]="InitializeMint2",r[r.GetAccountDataSize=21]="GetAccountDataSize",r[r.InitializeImmutableOwner=22]="InitializeImmutableOwner",r[r.AmountToUiAmount=23]="AmountToUiAmount",r[r.UiAmountToAmount=24]="UiAmountToAmount",r[r.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",r[r.TransferFeeExtension=26]="TransferFeeExtension",r[r.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",r[r.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",r[r.Reallocate=29]="Reallocate",r[r.MemoTransferExtension=30]="MemoTransferExtension",r[r.CreateNativeMint=31]="CreateNativeMint",r[r.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",r[r.InterestBearingMintExtension=33]="InterestBearingMintExtension",r[r.CpiGuardExtension=34]="CpiGuardExtension",r[r.InitializePermanentDelegate=35]="InitializePermanentDelegate"})(ul||(ul={}));function pT(r,t,e){if(e.length){r.push({pubkey:t,isSigner:!1,isWritable:!1});for(const n of e)r.push({pubkey:n instanceof Ne?n:n.publicKey,isSigner:!0,isWritable:!1})}else r.push({pubkey:t,isSigner:!0,isWritable:!1});return r}const k6=Xv([$l("instruction")]);function mT(r,t,e,n=[],s=Sh){const i=pT([{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0}],e,n),c=Zt.Buffer.alloc(k6.span);return k6.encode({instruction:ul.CloseAccount},c),new gh({keys:i,programId:s,data:c})}const vT=Xv([bb("mintAuthorityOption"),S6("mintAuthority"),cT("supply"),$l("decimals"),hT("isInitialized"),bb("freezeAuthorityOption"),S6("freezeAuthority")]);vT.span;function n9(r,t,e=!1,n=Sh,s=bg){if(!e&&!Ne.isOnCurve(t.toBuffer()))throw new dT;const[i]=Ne.findProgramAddressSync([t.toBuffer(),n.toBuffer(),r.toBuffer()],s);return i}function gT(r,t,e,n,s=Sh,i=bg){return yT(r,t,e,n,Zt.Buffer.alloc(0),s,i)}function yT(r,t,e,n,s,i=Sh,c=bg){const l=[{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:Hl.programId,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}];return new gh({keys:l,programId:c,data:s})}const I6=Xv([$l("instruction")]);function bT(r,t=Sh){const e=[{pubkey:r,isSigner:!1,isWritable:!0}],n=Zt.Buffer.alloc(I6.span);return I6.encode({instruction:ul.SyncNative},n),new gh({keys:e,programId:t,data:n})}const wT="logger/5.7.0";let B6=!1,P6=!1;const H0={debug:1,default:2,info:2,warning:3,error:4,off:5};let R6=H0.default,hp=null;function xT(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const C6=xT();var c2;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(c2||(c2={}));var ro;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ro||(ro={}));const T6="0123456789abcdef";class Qr{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();H0[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(R6>H0[n])&&console.log.apply(console,e)}debug(...t){this._log(Qr.levels.DEBUG,t)}info(...t){this._log(Qr.levels.INFO,t)}warn(...t){this._log(Qr.levels.WARNING,t)}makeError(t,e,n){if(P6)return this.makeError("censored error",e,{});e||(e=Qr.errors.UNKNOWN_ERROR),n||(n={});const s=[];Object.keys(n).forEach(p=>{const m=n[p];try{if(m instanceof Uint8Array){let v="";for(let _=0;_>4],v+=T6[m[_]&15];s.push(p+"=Uint8Array(0x"+v+")")}else s.push(p+"="+JSON.stringify(m))}catch{s.push(p+"="+JSON.stringify(n[p].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const i=t;let c="";switch(e){case ro.NUMERIC_FAULT:{c="NUMERIC_FAULT";const p=t;switch(p){case"overflow":case"underflow":case"division-by-zero":c+="-"+p;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case ro.CALL_EXCEPTION:case ro.INSUFFICIENT_FUNDS:case ro.MISSING_NEW:case ro.NONCE_EXPIRED:case ro.REPLACEMENT_UNDERPRICED:case ro.TRANSACTION_REPLACED:case ro.UNPREDICTABLE_GAS_LIMIT:c=e;break}c&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=i,l.code=e,Object.keys(n).forEach(function(p){l[p]=n[p]}),l}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,Qr.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,s){t||this.throwError(e,n,s)}assertArgument(t,e,n,s){t||this.throwArgumentError(e,n,s)}checkNormalize(t){C6&&this.throwError("platform missing String.prototype.normalize",Qr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:C6})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Qr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Qr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n?n=": "+n:n="",te&&this.throwError("too many arguments"+n,Qr.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||t==null)&&this.throwError("missing new",Qr.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Qr.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",Qr.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return hp||(hp=new Qr(wT)),hp}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Qr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),B6){if(!t)return;this.globalLogger().throwError("error censorship permanent",Qr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P6=!!t,B6=!!e}static setLogLevel(t){const e=H0[t.toLowerCase()];if(e==null){Qr.globalLogger().warn("invalid log level - "+t);return}R6=e}static from(t){return new Qr(t)}}Qr.errors=ro;Qr.levels=c2;const _T="bytes/5.7.0",lp=new Qr(_T);function MT(r){return!!r.toHexString}function V0(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return V0(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function L6(r){return typeof r=="number"&&r==r&&r%1===0}function ET(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!L6(r.length)||r.length<0)return!1;for(let t=0;t=256)return!1}return!0}function AT(r,t){if(t||(t={}),typeof r=="number"){lp.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(r&255),r=parseInt(String(r/256));return e.length===0&&e.push(0),V0(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),MT(r)&&(r=r.toHexString()),ST(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":lp.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let s=0;s= 0 and <= "+t,r)}function PT(r,t){t===void 0&&(t=0),_g(t,"offset");var e=r[t],n=r[t+7];(e===void 0||n===void 0)&&i9(t,r.length-8);var s=r[t+4]+r[t+5]*Math.pow(2,8)+r[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(s)<0&&v[v.length-1])&&(x[0]===6||x[0]===2)){l=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]0&&m[m.length-1])&&(w[0]===6||w[0]===2)){c=0;continue}if(w[0]===3&&(!m||w[1]>m[0]&&w[1]=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,C=new Uint8Array(R);B!==P;){for(var O=w[B],z=0,H=R-1;(O!==0||z>>0,C[H]=O%c>>>0,O=O/c>>>0;if(O!==0)throw new Error("Non-zero carry");A=z,B++}for(var tt=R-A;tt!==R&&C[tt]===0;)tt++;for(var nt=l.repeat(x);tt>>0,R=new Uint8Array(P);w[x];){var C=t[w.charCodeAt(x)];if(C===255)return;for(var O=0,z=P-1;(C!==0||O>>0,R[z]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");B=O,x++}for(var H=P-B;H!==P&&R[H]===0;)H++;var tt=e0.allocUnsafe(A+(P-H));tt.fill(0,0,A);for(var nt=A;H!==P;)tt[nt++]=R[H++];return tt}function E(w){var x=_(w);if(x)return x;throw new Error("Non-base"+c+" character")}return{encode:v,decodeUnsafe:_,decode:E}}var UT=OT,NT=UT,DT="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",zT=NT(DT);const Ou=Yv(zT);var Mg={exports:{}};const qT=/[\p{Lu}]/u,FT=/[\p{Ll}]/u,z6=/^[\p{Lu}](?![\p{Lu}])/gu,o9=/([\p{Alpha}\p{N}_]|$)/u,s9=/[_.\- ]+/,jT=new RegExp("^"+s9.source),q6=new RegExp(s9.source+o9.source,"gu"),F6=new RegExp("\\d+"+o9.source,"gu"),KT=(r,t,e)=>{let n=!1,s=!1,i=!1;for(let c=0;c(z6.lastIndex=0,r.replace(z6,e=>t(e))),HT=(r,t)=>(q6.lastIndex=0,F6.lastIndex=0,r.replace(q6,(e,n)=>t(n)).replace(F6,e=>t(e))),a9=(r,t)=>{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(r)?r=r.map(i=>i.trim()).filter(i=>i.length).join("-"):r=r.trim(),r.length===0)return"";const e=t.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(t.locale),n=t.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(t.locale);return r.length===1?t.pascalCase?n(r):e(r):(r!==e(r)&&(r=KT(r,e,n)),r=r.replace(jT,""),t.preserveConsecutiveUppercase?r=$T(r,e):r=e(r),t.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),HT(r,n))};Mg.exports=a9;Mg.exports.default=a9;var Eg=Mg.exports;const Dr=Yv(Eg);var Ze={},Pe={};let Rr=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};Pe.Layout=Rr;function Ag(r,t){return t.property?r+"["+t.property+"]":r}Pe.nameWithProperty=Ag;function VT(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Rr))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})}Pe.bindConstructorLayout=VT;let ei=class extends Rr{isCount(){throw new Error("ExternalLayout is abstract")}};class u9 extends ei{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}let Sg=class extends ei{constructor(t,e,n){if(!(t instanceof Rr))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Jo||this.layout instanceof Bs}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}},Jo=class extends Rr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ei&&this.count.encode(t.length,e,n),i}}let p9=class extends Rr{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((i,c)=>i&&c instanceof Rr,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}},kg=class{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},fl=class extends kg{constructor(t,e){if(!(t instanceof ei&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}},Ig=class extends Rr{constructor(t,e,n){const s=t instanceof Jo||t instanceof Bs;if(s)t=new fl(new Sg(t));else if(t instanceof ei&&t.isCount())t=new fl(t);else if(!(t instanceof kg))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Rr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new m9(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}},m9=class extends Rr{constructor(t,e,n,s){if(!(t instanceof Ig))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Rr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};function Mu(r){return 0>r&&(r+=4294967296),r}class Bg extends Rr{constructor(t,e,n){if(!(t instanceof Jo||t instanceof Bs))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Mu(t&this.valueMask))throw new TypeError(Ag("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Mu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ei&&(s=t.length),!(Zt.Buffer.isBuffer(t)&&s===t.length))throw new TypeError(Ag("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof ei&&this.length.encode(s,e,n),s}};class y9 extends Rr{constructor(t){super(-1,t)}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),e[n+i]=0,i+1}}class b9 extends Rr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let s=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),i}}class w9 extends Rr{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Pe.ExternalLayout=ei;Pe.GreedyCount=u9;Pe.OffsetLayout=Sg;Pe.UInt=Jo;Pe.UIntBE=Bs;Pe.Int=su;Pe.IntBE=Ef;Pe.Float=f9;Pe.FloatBE=c9;Pe.Double=h9;Pe.DoubleBE=l9;Pe.Sequence=d9;Pe.Structure=p9;Pe.UnionDiscriminator=kg;Pe.UnionLayoutDiscriminator=fl;Pe.Union=Ig;Pe.VariantLayout=m9;Pe.BitStructure=Bg;Pe.BitField=Ec;Pe.Boolean=v9;Pe.Blob=g9;Pe.CString=y9;Pe.UTF8=b9;Pe.Constant=w9;Pe.greedy=(r,t)=>new u9(r,t);Pe.offset=(r,t,e)=>new Sg(r,t,e);Pe.u8=r=>new Jo(1,r);Pe.u16=r=>new Jo(2,r);Pe.u24=r=>new Jo(3,r);Pe.u32=r=>new Jo(4,r);Pe.u40=r=>new Jo(5,r);Pe.u48=r=>new Jo(6,r);Pe.nu64=r=>new ZT(r);Pe.u16be=r=>new Bs(2,r);Pe.u24be=r=>new Bs(3,r);Pe.u32be=r=>new Bs(4,r);Pe.u40be=r=>new Bs(5,r);Pe.u48be=r=>new Bs(6,r);Pe.nu64be=r=>new WT(r);Pe.s8=r=>new su(1,r);Pe.s16=r=>new su(2,r);Pe.s24=r=>new su(3,r);Pe.s32=r=>new su(4,r);Pe.s40=r=>new su(5,r);Pe.s48=r=>new su(6,r);Pe.ns64=r=>new GT(r);Pe.s16be=r=>new Ef(2,r);Pe.s24be=r=>new Ef(3,r);Pe.s32be=r=>new Ef(4,r);Pe.s40be=r=>new Ef(5,r);Pe.s48be=r=>new Ef(6,r);Pe.ns64be=r=>new YT(r);Pe.f32=r=>new f9(r);Pe.f32be=r=>new c9(r);Pe.f64=r=>new h9(r);Pe.f64be=r=>new l9(r);Pe.struct=(r,t,e)=>new p9(r,t,e);Pe.bits=(r,t,e)=>new Bg(r,t,e);Pe.seq=(r,t,e)=>new d9(r,t,e);Pe.union=(r,t,e)=>new Ig(r,t,e);Pe.unionLayoutDiscriminator=(r,t)=>new fl(r,t);Pe.blob=(r,t)=>new g9(r,t);Pe.cstr=r=>new y9(r);Pe.utf8=(r,t)=>new b9(r,t);Pe.const=(r,t)=>new w9(r,t);(function(r){var t=Re&&Re.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=Pe,n=rg,s=t(Kl);var i=Pe;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class c extends e.Layout{constructor(a,f,h){super(a,h),this.blob=(0,e.blob)(a),this.signed=f}decode(a,f=0){const h=new s.default(this.blob.decode(a,f),10,"le");return this.signed?h.fromTwos(this.span*8).clone():h}encode(a,f,h=0){return this.signed&&(a=a.toTwos(this.span*8)),this.blob.encode(a.toArrayLike(Zt.Buffer,"le",this.span),f,h)}}function l(o){return new c(8,!1,o)}r.u64=l;function p(o){return new c(8,!0,o)}r.i64=p;function m(o){return new c(16,!1,o)}r.u128=m;function v(o){return new c(16,!0,o)}r.i128=v;function _(o){return new c(32,!1,o)}r.u256=_;function E(o){return new c(32,!0,o)}r.i256=E;class w extends e.Layout{constructor(a,f,h,g){super(a.span,g),this.layout=a,this.decoder=f,this.encoder=h}decode(a,f){return this.decoder(this.layout.decode(a,f))}encode(a,f,h){return this.layout.encode(this.encoder(a),f,h)}getSpan(a,f){return this.layout.getSpan(a,f)}}function x(o){return new w((0,e.blob)(32),a=>new n.PublicKey(a),a=>a.toBuffer(),o)}r.publicKey=x;class A extends e.Layout{constructor(a,f){super(-1,f),this.layout=a,this.discriminator=(0,e.u8)()}encode(a,f,h=0){return a==null?this.discriminator.encode(0,f,h):(this.discriminator.encode(1,f,h),this.layout.encode(a,f,h+1)+1)}decode(a,f=0){const h=this.discriminator.decode(a,f);if(h===0)return null;if(h===1)return this.layout.decode(a,f+1);throw new Error("Invalid option "+this.property)}getSpan(a,f=0){const h=this.discriminator.decode(a,f);if(h===0)return 1;if(h===1)return this.layout.getSpan(a,f+1)+1;throw new Error("Invalid option "+this.property)}}function B(o,a){return new A(o,a)}r.option=B;function P(o){return new w((0,e.u8)(),R,C,o)}r.bool=P;function R(o){if(o===0)return!1;if(o===1)return!0;throw new Error("Invalid bool: "+o)}function C(o){return o?1:0}function O(o,a){const f=(0,e.u32)("length"),h=(0,e.struct)([f,(0,e.seq)(o,(0,e.offset)(f,-f.span),"values")]);return new w(h,({values:g})=>g,g=>({values:g}),a)}r.vec=O;function z(o,a,f){const h=(0,e.struct)([l("tag"),a.replicate("data")]);function g({tag:S,data:I}){if(!S.eq(o))throw new Error("Invalid tag, expected: "+o.toString("hex")+", got: "+S.toString("hex"));return I}return new w(h,g,S=>({tag:o,data:S}),f)}r.tagged=z;function H(o){const a=(0,e.u32)("length"),f=(0,e.struct)([a,(0,e.blob)((0,e.offset)(a,-a.span),"data")]);return new w(f,({data:h})=>h,h=>({data:h}),o)}r.vecU8=H;function tt(o){return new w(H(),a=>a.toString("utf-8"),a=>Zt.Buffer.from(a,"utf-8"),o)}r.str=tt;function nt(o,a,f){const h=(0,e.union)(f??(0,e.u8)(),a);return o.forEach((g,S)=>h.addVariant(S,g,g.property)),h}r.rustEnum=nt;function G(o,a,f){const h=(0,e.struct)([(0,e.seq)(o,a,"values")]);return new w(h,({values:g})=>g,g=>({values:g}),f)}r.array=G;class M extends e.Layout{constructor(a,f,h){super(a.span+f.span,h),this.keyLayout=a,this.valueLayout=f}decode(a,f){f=f||0;const h=this.keyLayout.decode(a,f),g=this.valueLayout.decode(a,f+this.keyLayout.getSpan(a,f));return[h,g]}encode(a,f,h){h=h||0;const g=this.keyLayout.encode(a[0],f,h),S=this.valueLayout.encode(a[1],f,h+g);return g+S}getSpan(a,f){return this.keyLayout.getSpan(a,f)+this.valueLayout.getSpan(a,f)}}function d(o,a,f){const h=(0,e.u32)("length"),g=(0,e.struct)([h,(0,e.seq)(new M(o,a),(0,e.offset)(h,-h.span),"values")]);return new w(g,({values:S})=>new Map(S),S=>({values:Array.from(S.entries())}),f)}r.map=d})(Ze);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const XT=4,j6=0,K6=1,JT=2;function Af(r){let t=r.length;for(;--t>=0;)r[t]=0}const QT=0,x9=1,tL=2,eL=3,rL=258,Pg=29,kh=256,Dc=kh+1+Pg,Uu=30,Rg=19,_9=2*Dc+1,Ia=15,vp=16,nL=7,Cg=256,M9=16,E9=17,A9=18,l2=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Z0=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),iL=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),S9=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oL=512,hs=new Array((Dc+2)*2);Af(hs);const Ac=new Array(Uu*2);Af(Ac);const zc=new Array(oL);Af(zc);const qc=new Array(rL-eL+1);Af(qc);const Tg=new Array(Pg);Af(Tg);const cl=new Array(Uu);Af(cl);function gp(r,t,e,n,s){this.static_tree=r,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=s,this.has_stree=r&&r.length}let k9,I9,B9;function yp(r,t){this.dyn_tree=r,this.max_code=0,this.stat_desc=t}const P9=r=>r<256?zc[r]:zc[256+(r>>>7)],Fc=(r,t)=>{r.pending_buf[r.pending++]=t&255,r.pending_buf[r.pending++]=t>>>8&255},oi=(r,t,e)=>{r.bi_valid>vp-e?(r.bi_buf|=t<>vp-r.bi_valid,r.bi_valid+=e-vp):(r.bi_buf|=t<{oi(r,e[t*2],e[t*2+1])},R9=(r,t)=>{let e=0;do e|=r&1,r>>>=1,e<<=1;while(--t>0);return e>>>1},sL=r=>{r.bi_valid===16?(Fc(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},aL=(r,t)=>{const e=t.dyn_tree,n=t.max_code,s=t.stat_desc.static_tree,i=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,p=t.stat_desc.max_length;let m,v,_,E,w,x,A=0;for(E=0;E<=Ia;E++)r.bl_count[E]=0;for(e[r.heap[r.heap_max]*2+1]=0,m=r.heap_max+1;m<_9;m++)v=r.heap[m],E=e[e[v*2+1]*2+1]+1,E>p&&(E=p,A++),e[v*2+1]=E,!(v>n)&&(r.bl_count[E]++,w=0,v>=l&&(w=c[v-l]),x=e[v*2],r.opt_len+=x*(E+w),i&&(r.static_len+=x*(s[v*2+1]+w)));if(A!==0){do{for(E=p-1;r.bl_count[E]===0;)E--;r.bl_count[E]--,r.bl_count[E+1]+=2,r.bl_count[p]--,A-=2}while(A>0);for(E=p;E!==0;E--)for(v=r.bl_count[E];v!==0;)_=r.heap[--m],!(_>n)&&(e[_*2+1]!==E&&(r.opt_len+=(E-e[_*2+1])*e[_*2],e[_*2+1]=E),v--)}},C9=(r,t,e)=>{const n=new Array(Ia+1);let s=0,i,c;for(i=1;i<=Ia;i++)s=s+e[i-1]<<1,n[i]=s;for(c=0;c<=t;c++){let l=r[c*2+1];l!==0&&(r[c*2]=R9(n[l]++,l))}},uL=()=>{let r,t,e,n,s;const i=new Array(Ia+1);for(e=0,n=0;n>=7;n{let t;for(t=0;t{r.bi_valid>8?Fc(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},$6=(r,t,e,n)=>{const s=t*2,i=e*2;return r[s]{const n=r.heap[e];let s=e<<1;for(;s<=r.heap_len&&(s{let n,s,i=0,c,l;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+i++]&255,n+=(r.pending_buf[r.sym_buf+i++]&255)<<8,s=r.pending_buf[r.sym_buf+i++],n===0?Do(r,s,t):(c=qc[s],Do(r,c+kh+1,t),l=l2[c],l!==0&&(s-=Tg[c],oi(r,s,l)),n--,c=P9(n),Do(r,c,e),l=Z0[c],l!==0&&(n-=cl[c],oi(r,n,l)));while(i{const e=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,i=t.stat_desc.elems;let c,l,p=-1,m;for(r.heap_len=0,r.heap_max=_9,c=0;c>1;c>=1;c--)bp(r,e,c);m=i;do c=r.heap[1],r.heap[1]=r.heap[r.heap_len--],bp(r,e,1),l=r.heap[1],r.heap[--r.heap_max]=c,r.heap[--r.heap_max]=l,e[m*2]=e[c*2]+e[l*2],r.depth[m]=(r.depth[c]>=r.depth[l]?r.depth[c]:r.depth[l])+1,e[c*2+1]=e[l*2+1]=m,r.heap[1]=m++,bp(r,e,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],aL(r,t),C9(e,p,r.bl_count)},V6=(r,t,e)=>{let n,s=-1,i,c=t[0*2+1],l=0,p=7,m=4;for(c===0&&(p=138,m=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)i=c,c=t[(n+1)*2+1],!(++l{let n,s=-1,i,c=t[0*2+1],l=0,p=7,m=4;for(c===0&&(p=138,m=3),n=0;n<=e;n++)if(i=c,c=t[(n+1)*2+1],!(++l{let t;for(V6(r,r.dyn_ltree,r.l_desc.max_code),V6(r,r.dyn_dtree,r.d_desc.max_code),d2(r,r.bl_desc),t=Rg-1;t>=3&&r.bl_tree[S9[t]*2+1]===0;t--);return r.opt_len+=3*(t+1)+5+5+4,t},cL=(r,t,e,n)=>{let s;for(oi(r,t-257,5),oi(r,e-1,5),oi(r,n-4,4),s=0;s{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&r.dyn_ltree[e*2]!==0)return j6;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return K6;for(e=32;e{W6||(uL(),W6=!0),r.l_desc=new yp(r.dyn_ltree,k9),r.d_desc=new yp(r.dyn_dtree,I9),r.bl_desc=new yp(r.bl_tree,B9),r.bi_buf=0,r.bi_valid=0,T9(r)},O9=(r,t,e,n)=>{oi(r,(QT<<1)+(n?1:0),3),L9(r),Fc(r,e),Fc(r,~e),e&&r.pending_buf.set(r.window.subarray(t,t+e),r.pending),r.pending+=e},dL=r=>{oi(r,x9<<1,3),Do(r,Cg,hs),sL(r)},pL=(r,t,e,n)=>{let s,i,c=0;r.level>0?(r.strm.data_type===JT&&(r.strm.data_type=hL(r)),d2(r,r.l_desc),d2(r,r.d_desc),c=fL(r),s=r.opt_len+3+7>>>3,i=r.static_len+3+7>>>3,i<=s&&(s=i)):s=i=e+5,e+4<=s&&t!==-1?O9(r,t,e,n):r.strategy===XT||i===s?(oi(r,(x9<<1)+(n?1:0),3),H6(r,hs,Ac)):(oi(r,(tL<<1)+(n?1:0),3),cL(r,r.l_desc.max_code+1,r.d_desc.max_code+1,c+1),H6(r,r.dyn_ltree,r.dyn_dtree)),T9(r),n&&L9(r)},mL=(r,t,e)=>(r.pending_buf[r.sym_buf+r.sym_next++]=t,r.pending_buf[r.sym_buf+r.sym_next++]=t>>8,r.pending_buf[r.sym_buf+r.sym_next++]=e,t===0?r.dyn_ltree[e*2]++:(r.matches++,t--,r.dyn_ltree[(qc[e]+kh+1)*2]++,r.dyn_dtree[P9(t)*2]++),r.sym_next===r.sym_end);var vL=lL,gL=O9,yL=pL,bL=mL,wL=dL,xL={_tr_init:vL,_tr_stored_block:gL,_tr_flush_block:yL,_tr_tally:bL,_tr_align:wL};const _L=(r,t,e,n)=>{let s=r&65535|0,i=r>>>16&65535|0,c=0;for(;e!==0;){c=e>2e3?2e3:e,e-=c;do s=s+t[n++]|0,i=i+s|0;while(--c);s%=65521,i%=65521}return s|i<<16|0};var jc=_L;const ML=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},EL=new Uint32Array(ML()),AL=(r,t,e,n)=>{const s=EL,i=n+e;r^=-1;for(let c=n;c>>8^s[(r^t[c])&255];return r^-1};var xn=AL,of={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ih={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:SL,_tr_stored_block:p2,_tr_flush_block:kL,_tr_tally:Gs,_tr_align:IL}=xL,{Z_NO_FLUSH:Ys,Z_PARTIAL_FLUSH:BL,Z_FULL_FLUSH:PL,Z_FINISH:qi,Z_BLOCK:G6,Z_OK:Pn,Z_STREAM_END:Y6,Z_STREAM_ERROR:jo,Z_DATA_ERROR:RL,Z_BUF_ERROR:wp,Z_DEFAULT_COMPRESSION:CL,Z_FILTERED:TL,Z_HUFFMAN_ONLY:r0,Z_RLE:LL,Z_FIXED:OL,Z_DEFAULT_STRATEGY:UL,Z_UNKNOWN:NL,Z_DEFLATED:cd}=Ih,DL=9,zL=15,qL=8,FL=29,jL=256,m2=jL+1+FL,KL=30,$L=19,HL=2*m2+1,VL=15,hr=3,$s=258,Ko=$s+hr+1,ZL=32,sf=42,Lg=57,v2=69,g2=73,y2=91,b2=103,Ba=113,xc=666,Xn=1,Sf=2,Ga=3,kf=4,WL=3,Pa=(r,t)=>(r.msg=of[t],t),X6=r=>r*2-(r>4?9:0),js=r=>{let t=r.length;for(;--t>=0;)r[t]=0},GL=r=>{let t,e,n,s=r.w_size;t=r.hash_size,n=t;do e=r.head[--n],r.head[n]=e>=s?e-s:0;while(--t);t=s,n=t;do e=r.prev[--n],r.prev[n]=e>=s?e-s:0;while(--t)};let YL=(r,t,e)=>(t<{const t=r.state;let e=t.pending;e>r.avail_out&&(e=r.avail_out),e!==0&&(r.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),r.next_out),r.next_out+=e,t.pending_out+=e,r.total_out+=e,r.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Ai=(r,t)=>{kL(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,t),r.block_start=r.strstart,bi(r.strm)},Er=(r,t)=>{r.pending_buf[r.pending++]=t},Gf=(r,t)=>{r.pending_buf[r.pending++]=t>>>8&255,r.pending_buf[r.pending++]=t&255},w2=(r,t,e,n)=>{let s=r.avail_in;return s>n&&(s=n),s===0?0:(r.avail_in-=s,t.set(r.input.subarray(r.next_in,r.next_in+s),e),r.state.wrap===1?r.adler=jc(r.adler,t,s,e):r.state.wrap===2&&(r.adler=xn(r.adler,t,s,e)),r.next_in+=s,r.total_in+=s,s)},U9=(r,t)=>{let e=r.max_chain_length,n=r.strstart,s,i,c=r.prev_length,l=r.nice_match;const p=r.strstart>r.w_size-Ko?r.strstart-(r.w_size-Ko):0,m=r.window,v=r.w_mask,_=r.prev,E=r.strstart+$s;let w=m[n+c-1],x=m[n+c];r.prev_length>=r.good_match&&(e>>=2),l>r.lookahead&&(l=r.lookahead);do if(s=t,!(m[s+c]!==x||m[s+c-1]!==w||m[s]!==m[n]||m[++s]!==m[n+1])){n+=2,s++;do;while(m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&nc){if(r.match_start=t,c=i,i>=l)break;w=m[n+c-1],x=m[n+c]}}while((t=_[t&v])>p&&--e!==0);return c<=r.lookahead?c:r.lookahead},af=r=>{const t=r.w_size;let e,n,s;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=t+(t-Ko)&&(r.window.set(r.window.subarray(t,t+t-n),0),r.match_start-=t,r.strstart-=t,r.block_start-=t,r.insert>r.strstart&&(r.insert=r.strstart),GL(r),n+=t),r.strm.avail_in===0)break;if(e=w2(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=e,r.lookahead+r.insert>=hr)for(s=r.strstart-r.insert,r.ins_h=r.window[s],r.ins_h=Xs(r,r.ins_h,r.window[s+1]);r.insert&&(r.ins_h=Xs(r,r.ins_h,r.window[s+hr-1]),r.prev[s&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=s,s++,r.insert--,!(r.lookahead+r.insert{let e=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,s,i,c=0,l=r.strm.avail_in;do{if(n=65535,i=r.bi_valid+42>>3,r.strm.avail_outs+r.strm.avail_in&&(n=s+r.strm.avail_in),n>i&&(n=i),n>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,bi(r.strm),s&&(s>n&&(s=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+s),r.strm.next_out),r.strm.next_out+=s,r.strm.avail_out-=s,r.strm.total_out+=s,r.block_start+=s,n-=s),n&&(w2(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}while(c===0);return l-=r.strm.avail_in,l&&(l>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=l&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-l,r.strm.next_in),r.strstart),r.strstart+=l,r.insert+=l>r.w_size-r.insert?r.w_size-r.insert:l),r.block_start=r.strstart),r.high_wateri&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,i+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),i>r.strm.avail_in&&(i=r.strm.avail_in),i&&(w2(r.strm,r.window,r.strstart,i),r.strstart+=i,r.insert+=i>r.w_size-r.insert?r.w_size-r.insert:i),r.high_water>3,i=r.pending_buf_size-i>65535?65535:r.pending_buf_size-i,e=i>r.w_size?r.w_size:i,s=r.strstart-r.block_start,(s>=e||(s||t===qi)&&t!==Ys&&r.strm.avail_in===0&&s<=i)&&(n=s>i?i:s,c=t===qi&&r.strm.avail_in===0&&n===s?1:0,p2(r,r.block_start,n,c),r.block_start+=n,bi(r.strm)),c?Ga:Xn)},xp=(r,t)=>{let e,n;for(;;){if(r.lookahead=hr&&(r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),e!==0&&r.strstart-e<=r.w_size-Ko&&(r.match_length=U9(r,e)),r.match_length>=hr)if(n=Gs(r,r.strstart-r.match_start,r.match_length-hr),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=hr){r.match_length--;do r.strstart++,r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+1]);else n=Gs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(Ai(r,!1),r.strm.avail_out===0))return Xn}return r.insert=r.strstart{let e,n,s;for(;;){if(r.lookahead=hr&&(r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=hr-1,e!==0&&r.prev_length4096)&&(r.match_length=hr-1)),r.prev_length>=hr&&r.match_length<=r.prev_length){s=r.strstart+r.lookahead-hr,n=Gs(r,r.strstart-1-r.prev_match,r.prev_length-hr),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=s&&(r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=hr-1,r.strstart++,n&&(Ai(r,!1),r.strm.avail_out===0))return Xn}else if(r.match_available){if(n=Gs(r,0,r.window[r.strstart-1]),n&&Ai(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return Xn}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Gs(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart{let e,n,s,i;const c=r.window;for(;;){if(r.lookahead<=$s){if(af(r),r.lookahead<=$s&&t===Ys)return Xn;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=hr&&r.strstart>0&&(s=r.strstart-1,n=c[s],n===c[++s]&&n===c[++s]&&n===c[++s])){i=r.strstart+$s;do;while(n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&sr.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=hr?(e=Gs(r,1,r.match_length-hr),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(e=Gs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),e&&(Ai(r,!1),r.strm.avail_out===0))return Xn}return r.insert=0,t===qi?(Ai(r,!0),r.strm.avail_out===0?Ga:kf):r.sym_next&&(Ai(r,!1),r.strm.avail_out===0)?Xn:Sf},JL=(r,t)=>{let e;for(;;){if(r.lookahead===0&&(af(r),r.lookahead===0)){if(t===Ys)return Xn;break}if(r.match_length=0,e=Gs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,e&&(Ai(r,!1),r.strm.avail_out===0))return Xn}return r.insert=0,t===qi?(Ai(r,!0),r.strm.avail_out===0?Ga:kf):r.sym_next&&(Ai(r,!1),r.strm.avail_out===0)?Xn:Sf};function vo(r,t,e,n,s){this.good_length=r,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=s}const _c=[new vo(0,0,0,0,N9),new vo(4,4,8,4,xp),new vo(4,5,16,8,xp),new vo(4,6,32,32,xp),new vo(4,4,16,16,pu),new vo(8,16,32,32,pu),new vo(8,16,128,128,pu),new vo(8,32,128,256,pu),new vo(32,128,258,1024,pu),new vo(32,258,258,4096,pu)],QL=r=>{r.window_size=2*r.w_size,js(r.head),r.max_lazy_match=_c[r.level].max_lazy,r.good_match=_c[r.level].good_length,r.nice_match=_c[r.level].nice_length,r.max_chain_length=_c[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=hr-1,r.match_available=0,r.ins_h=0};function tO(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=cd,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(HL*2),this.dyn_dtree=new Uint16Array((2*KL+1)*2),this.bl_tree=new Uint16Array((2*$L+1)*2),js(this.dyn_ltree),js(this.dyn_dtree),js(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(VL+1),this.heap=new Uint16Array(2*m2+1),js(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*m2+1),js(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Bh=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.status!==sf&&t.status!==Lg&&t.status!==v2&&t.status!==g2&&t.status!==y2&&t.status!==b2&&t.status!==Ba&&t.status!==xc?1:0},D9=r=>{if(Bh(r))return Pa(r,jo);r.total_in=r.total_out=0,r.data_type=NL;const t=r.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Lg:t.wrap?sf:Ba,r.adler=t.wrap===2?0:1,t.last_flush=-2,SL(t),Pn},z9=r=>{const t=D9(r);return t===Pn&&QL(r.state),t},eO=(r,t)=>Bh(r)||r.state.wrap!==2?jo:(r.state.gzhead=t,Pn),q9=(r,t,e,n,s,i)=>{if(!r)return jo;let c=1;if(t===CL&&(t=6),n<0?(c=0,n=-n):n>15&&(c=2,n-=16),s<1||s>DL||e!==cd||n<8||n>15||t<0||t>9||i<0||i>OL||n===8&&c!==1)return Pa(r,jo);n===8&&(n=9);const l=new tO;return r.state=l,l.strm=r,l.status=sf,l.wrap=c,l.gzhead=null,l.w_bits=n,l.w_size=1<q9(r,t,cd,zL,qL,UL),nO=(r,t)=>{if(Bh(r)||t>G6||t<0)return r?Pa(r,jo):jo;const e=r.state;if(!r.output||r.avail_in!==0&&!r.input||e.status===xc&&t!==qi)return Pa(r,r.avail_out===0?wp:jo);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(bi(r),r.avail_out===0)return e.last_flush=-1,Pn}else if(r.avail_in===0&&X6(t)<=X6(n)&&t!==qi)return Pa(r,wp);if(e.status===xc&&r.avail_in!==0)return Pa(r,wp);if(e.status===sf&&e.wrap===0&&(e.status=Ba),e.status===sf){let s=cd+(e.w_bits-8<<4)<<8,i=-1;if(e.strategy>=r0||e.level<2?i=0:e.level<6?i=1:e.level===6?i=2:i=3,s|=i<<6,e.strstart!==0&&(s|=ZL),s+=31-s%31,Gf(e,s),e.strstart!==0&&(Gf(e,r.adler>>>16),Gf(e,r.adler&65535)),r.adler=1,e.status=Ba,bi(r),e.pending!==0)return e.last_flush=-1,Pn}if(e.status===Lg){if(r.adler=0,Er(e,31),Er(e,139),Er(e,8),e.gzhead)Er(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),Er(e,e.gzhead.time&255),Er(e,e.gzhead.time>>8&255),Er(e,e.gzhead.time>>16&255),Er(e,e.gzhead.time>>24&255),Er(e,e.level===9?2:e.strategy>=r0||e.level<2?4:0),Er(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(Er(e,e.gzhead.extra.length&255),Er(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(r.adler=xn(r.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=v2;else if(Er(e,0),Er(e,0),Er(e,0),Er(e,0),Er(e,0),Er(e,e.level===9?2:e.strategy>=r0||e.level<2?4:0),Er(e,WL),e.status=Ba,bi(r),e.pending!==0)return e.last_flush=-1,Pn}if(e.status===v2){if(e.gzhead.extra){let s=e.pending,i=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+i>e.pending_buf_size;){let l=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+l),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex+=l,bi(r),e.pending!==0)return e.last_flush=-1,Pn;s=0,i-=l}let c=new Uint8Array(e.gzhead.extra);e.pending_buf.set(c.subarray(e.gzindex,e.gzindex+i),e.pending),e.pending+=i,e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=g2}if(e.status===g2){if(e.gzhead.name){let s=e.pending,i;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),bi(r),e.pending!==0)return e.last_flush=-1,Pn;s=0}e.gzindexs&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=y2}if(e.status===y2){if(e.gzhead.comment){let s=e.pending,i;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),bi(r),e.pending!==0)return e.last_flush=-1,Pn;s=0}e.gzindexs&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s))}e.status=b2}if(e.status===b2){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(bi(r),e.pending!==0))return e.last_flush=-1,Pn;Er(e,r.adler&255),Er(e,r.adler>>8&255),r.adler=0}if(e.status=Ba,bi(r),e.pending!==0)return e.last_flush=-1,Pn}if(r.avail_in!==0||e.lookahead!==0||t!==Ys&&e.status!==xc){let s=e.level===0?N9(e,t):e.strategy===r0?JL(e,t):e.strategy===LL?XL(e,t):_c[e.level].func(e,t);if((s===Ga||s===kf)&&(e.status=xc),s===Xn||s===Ga)return r.avail_out===0&&(e.last_flush=-1),Pn;if(s===Sf&&(t===BL?IL(e):t!==G6&&(p2(e,0,0,!1),t===PL&&(js(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),bi(r),r.avail_out===0))return e.last_flush=-1,Pn}return t!==qi?Pn:e.wrap<=0?Y6:(e.wrap===2?(Er(e,r.adler&255),Er(e,r.adler>>8&255),Er(e,r.adler>>16&255),Er(e,r.adler>>24&255),Er(e,r.total_in&255),Er(e,r.total_in>>8&255),Er(e,r.total_in>>16&255),Er(e,r.total_in>>24&255)):(Gf(e,r.adler>>>16),Gf(e,r.adler&65535)),bi(r),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?Pn:Y6)},iO=r=>{if(Bh(r))return jo;const t=r.state.status;return r.state=null,t===Ba?Pa(r,RL):Pn},oO=(r,t)=>{let e=t.length;if(Bh(r))return jo;const n=r.state,s=n.wrap;if(s===2||s===1&&n.status!==sf||n.lookahead)return jo;if(s===1&&(r.adler=jc(r.adler,t,e,0)),n.wrap=0,e>=n.w_size){s===0&&(js(n.head),n.strstart=0,n.block_start=0,n.insert=0);let p=new Uint8Array(n.w_size);p.set(t.subarray(e-n.w_size,e),0),t=p,e=n.w_size}const i=r.avail_in,c=r.next_in,l=r.input;for(r.avail_in=e,r.next_in=0,r.input=t,af(n);n.lookahead>=hr;){let p=n.strstart,m=n.lookahead-(hr-1);do n.ins_h=Xs(n,n.ins_h,n.window[p+hr-1]),n.prev[p&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=p,p++;while(--m);n.strstart=p,n.lookahead=hr-1,af(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=hr-1,n.match_available=0,r.next_in=c,r.input=l,r.avail_in=i,n.wrap=s,Pn};var sO=rO,aO=q9,uO=z9,fO=D9,cO=eO,hO=nO,lO=iO,dO=oO,pO="pako deflate (from Nodeca project)",Sc={deflateInit:sO,deflateInit2:aO,deflateReset:uO,deflateResetKeep:fO,deflateSetHeader:cO,deflate:hO,deflateEnd:lO,deflateSetDictionary:dO,deflateInfo:pO};const mO=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var vO=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)mO(e,n)&&(r[n]=e[n])}}return r},gO=r=>{let t=0;for(let n=0,s=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Kc[254]=Kc[254]=1;var yO=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,c=r.length,l=0;for(s=0;s>>6,t[i++]=128|e&63):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|e&63):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|e&63);return t};const bO=(r,t)=>{if(t<65534&&r.subarray&&F9)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(e*2);for(s=0,n=0;n4){i[s++]=65533,n+=l-1;continue}for(c&=l===2?31:l===3?15:7;l>1&&n1){i[s++]=65533;continue}c<65536?i[s++]=c:(c-=65536,i[s++]=55296|c>>10&1023,i[s++]=56320|c&1023)}return bO(i,s)},xO=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+Kc[r[e]]>t?e:t},$c={string2buf:yO,buf2string:wO,utf8border:xO};function _O(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var j9=_O;const K9=Object.prototype.toString,{Z_NO_FLUSH:MO,Z_SYNC_FLUSH:EO,Z_FULL_FLUSH:AO,Z_FINISH:SO,Z_OK:hl,Z_STREAM_END:kO,Z_DEFAULT_COMPRESSION:IO,Z_DEFAULT_STRATEGY:BO,Z_DEFLATED:PO}=Ih;function Og(r){this.options=hd.assign({level:IO,method:PO,chunkSize:16384,windowBits:15,memLevel:8,strategy:BO},r||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new j9,this.strm.avail_out=0;let e=Sc.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==hl)throw new Error(of[e]);if(t.header&&Sc.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=$c.string2buf(t.dictionary):K9.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=Sc.deflateSetDictionary(this.strm,n),e!==hl)throw new Error(of[e]);this._dict_set=!0}}Og.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize;let s,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?SO:MO,typeof r=="string"?e.input=$c.string2buf(r):K9.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(i===EO||i===AO)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(s=Sc.deflate(e,i),s===kO)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),s=Sc.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===hl;if(e.avail_out===0){this.onData(e.output);continue}if(i>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0};Og.prototype.onData=function(r){this.chunks.push(r)};Og.prototype.onEnd=function(r){r===hl&&(this.result=hd.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};const n0=16209,RO=16191;var CO=function(t,e){let n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R,C,O,z,H,tt,nt,G,M;const d=t.state;n=t.next_in,G=t.input,s=n+(t.avail_in-5),i=t.next_out,M=t.output,c=i-(e-t.avail_out),l=i+(t.avail_out-257),p=d.dmax,m=d.wsize,v=d.whave,_=d.wnext,E=d.window,w=d.hold,x=d.bits,A=d.lencode,B=d.distcode,P=(1<>>24,w>>>=O,x-=O,O=C>>>16&255,O===0)M[i++]=C&65535;else if(O&16){z=C&65535,O&=15,O&&(x>>=O,x-=O),x<15&&(w+=G[n++]<>>24,w>>>=O,x-=O,O=C>>>16&255,O&16){if(H=C&65535,O&=15,xp){t.msg="invalid distance too far back",d.mode=n0;break t}if(w>>>=O,x-=O,O=i-c,H>O){if(O=H-O,O>v&&d.sane){t.msg="invalid distance too far back",d.mode=n0;break t}if(tt=0,nt=E,_===0){if(tt+=m-O,O2;)M[i++]=nt[tt++],M[i++]=nt[tt++],M[i++]=nt[tt++],z-=3;z&&(M[i++]=nt[tt++],z>1&&(M[i++]=nt[tt++]))}else{tt=i-H;do M[i++]=M[tt++],M[i++]=M[tt++],M[i++]=M[tt++],z-=3;while(z>2);z&&(M[i++]=M[tt++],z>1&&(M[i++]=M[tt++]))}}else if(O&64){t.msg="invalid distance code",d.mode=n0;break t}else{C=B[(C&65535)+(w&(1<>3,n-=z,x-=z<<3,w&=(1<{const p=l.bits;let m=0,v=0,_=0,E=0,w=0,x=0,A=0,B=0,P=0,R=0,C,O,z,H,tt,nt=null,G;const M=new Uint16Array(mu+1),d=new Uint16Array(mu+1);let o=null,a,f,h;for(m=0;m<=mu;m++)M[m]=0;for(v=0;v=1&&M[E]===0;E--);if(w>E&&(w=E),E===0)return s[i++]=1<<24|64<<16|0,s[i++]=1<<24|64<<16|0,l.bits=1,0;for(_=1;_0&&(r===t3||E!==1))return-1;for(d[1]=0,m=1;mJ6||r===e3&&P>Q6)return 1;for(;;){a=m-A,c[v]+1=G?(f=o[c[v]-G],h=nt[c[v]-G]):(f=32+64,h=0),C=1<>A)+O]=a<<24|f<<16|h|0;while(O!==0);for(C=1<>=1;if(C!==0?(R&=C-1,R+=C):R=0,v++,--M[m]===0){if(m===E)break;m=t[e+c[v]]}if(m>w&&(R&H)!==z){for(A===0&&(A=w),tt+=_,x=m-A,B=1<J6||r===e3&&P>Q6)return 1;z=R&H,s[z]=w<<24|x<<16|tt-i|0}}return R!==0&&(s[tt+R]=m-A<<24|64<<16|0),l.bits=w,0};var kc=NO;const DO=0,$9=1,H9=2,{Z_FINISH:r3,Z_BLOCK:zO,Z_TREES:i0,Z_OK:Ya,Z_STREAM_END:qO,Z_NEED_DICT:FO,Z_STREAM_ERROR:$i,Z_DATA_ERROR:V9,Z_MEM_ERROR:Z9,Z_BUF_ERROR:jO,Z_DEFLATED:n3}=Ih,ld=16180,i3=16181,o3=16182,s3=16183,a3=16184,u3=16185,f3=16186,c3=16187,h3=16188,l3=16189,ll=16190,es=16191,Mp=16192,d3=16193,Ep=16194,p3=16195,m3=16196,v3=16197,g3=16198,o0=16199,s0=16200,y3=16201,b3=16202,w3=16203,x3=16204,_3=16205,Ap=16206,M3=16207,E3=16208,qr=16209,W9=16210,G9=16211,KO=852,$O=592,HO=15,VO=HO,A3=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function ZO(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const au=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.modeG9?1:0},Y9=r=>{if(au(r))return $i;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=ld,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(KO),t.distcode=t.distdyn=new Int32Array($O),t.sane=1,t.back=-1,Ya},X9=r=>{if(au(r))return $i;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,Y9(r)},J9=(r,t)=>{let e;if(au(r))return $i;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?$i:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,X9(r))},Q9=(r,t)=>{if(!r)return $i;const e=new ZO;r.state=e,e.strm=r,e.window=null,e.mode=ld;const n=J9(r,t);return n!==Ya&&(r.state=null),n},WO=r=>Q9(r,VO);let S3=!0,Sp,kp;const GO=r=>{if(S3){Sp=new Int32Array(512),kp=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(kc($9,r.lens,0,288,Sp,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;kc(H9,r.lens,0,32,kp,0,r.work,{bits:5}),S3=!1}r.lencode=Sp,r.lenbits=9,r.distcode=kp,r.distbits=5},tM=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),n-=s,n?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave{let e,n,s,i,c,l,p,m,v,_,E,w,x,A,B=0,P,R,C,O,z,H,tt,nt;const G=new Uint8Array(4);let M,d;const o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(au(r)||!r.output||!r.input&&r.avail_in!==0)return $i;e=r.state,e.mode===es&&(e.mode=Mp),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,_=l,E=p,nt=Ya;t:for(;;)switch(e.mode){case ld:if(e.wrap===0){e.mode=Mp;break}for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xn(e.check,G,2,0),m=0,v=0,e.mode=i3;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((m&255)<<8)+(m>>8))%31){r.msg="incorrect header check",e.mode=qr;break}if((m&15)!==n3){r.msg="unknown compression method",e.mode=qr;break}if(m>>>=4,v-=4,tt=(m&15)+8,e.wbits===0&&(e.wbits=tt),tt>15||tt>e.wbits){r.msg="invalid window size",e.mode=qr;break}e.dmax=1<>8&1),e.flags&512&&e.wrap&4&&(G[0]=m&255,G[1]=m>>>8&255,e.check=xn(e.check,G,2,0)),m=0,v=0,e.mode=o3;case o3:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>8&255,G[2]=m>>>16&255,G[3]=m>>>24&255,e.check=xn(e.check,G,4,0)),m=0,v=0,e.mode=s3;case s3:for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>8),e.flags&512&&e.wrap&4&&(G[0]=m&255,G[1]=m>>>8&255,e.check=xn(e.check,G,2,0)),m=0,v=0,e.mode=a3;case a3:if(e.flags&1024){for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xn(e.check,G,2,0)),m=0,v=0}else e.head&&(e.head.extra=null);e.mode=u3;case u3:if(e.flags&1024&&(w=e.length,w>l&&(w=l),w&&(e.head&&(tt=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+w),tt)),e.flags&512&&e.wrap&4&&(e.check=xn(e.check,n,w,i)),l-=w,i+=w,e.length-=w),e.length))break t;e.length=0,e.mode=f3;case f3:if(e.flags&2048){if(l===0)break t;w=0;do tt=n[i+w++],e.head&&tt&&e.length<65536&&(e.head.name+=String.fromCharCode(tt));while(tt&&w>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=es;break;case l3:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>=v&7,v-=v&7,e.mode=Ap;break}for(;v<3;){if(l===0)break t;l--,m+=n[i++]<>>=1,v-=1,m&3){case 0:e.mode=d3;break;case 1:if(GO(e),e.mode=o0,t===i0){m>>>=2,v-=2;break t}break;case 2:e.mode=m3;break;case 3:r.msg="invalid block type",e.mode=qr}m>>>=2,v-=2;break;case d3:for(m>>>=v&7,v-=v&7;v<32;){if(l===0)break t;l--,m+=n[i++]<>>16^65535)){r.msg="invalid stored block lengths",e.mode=qr;break}if(e.length=m&65535,m=0,v=0,e.mode=Ep,t===i0)break t;case Ep:e.mode=p3;case p3:if(w=e.length,w){if(w>l&&(w=l),w>p&&(w=p),w===0)break t;s.set(n.subarray(i,i+w),c),l-=w,i+=w,p-=w,c+=w,e.length-=w;break}e.mode=es;break;case m3:for(;v<14;){if(l===0)break t;l--,m+=n[i++]<>>=5,v-=5,e.ndist=(m&31)+1,m>>>=5,v-=5,e.ncode=(m&15)+4,m>>>=4,v-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=qr;break}e.have=0,e.mode=v3;case v3:for(;e.have>>=3,v-=3}for(;e.have<19;)e.lens[o[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,M={bits:e.lenbits},nt=kc(DO,e.lens,0,19,e.lencode,0,e.work,M),e.lenbits=M.bits,nt){r.msg="invalid code lengths set",e.mode=qr;break}e.have=0,e.mode=g3;case g3:for(;e.have>>24,R=B>>>16&255,C=B&65535,!(P<=v);){if(l===0)break t;l--,m+=n[i++]<>>=P,v-=P,e.lens[e.have++]=C;else{if(C===16){for(d=P+2;v>>=P,v-=P,e.have===0){r.msg="invalid bit length repeat",e.mode=qr;break}tt=e.lens[e.have-1],w=3+(m&3),m>>>=2,v-=2}else if(C===17){for(d=P+3;v>>=P,v-=P,tt=0,w=3+(m&7),m>>>=3,v-=3}else{for(d=P+7;v>>=P,v-=P,tt=0,w=11+(m&127),m>>>=7,v-=7}if(e.have+w>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=qr;break}for(;w--;)e.lens[e.have++]=tt}}if(e.mode===qr)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=qr;break}if(e.lenbits=9,M={bits:e.lenbits},nt=kc($9,e.lens,0,e.nlen,e.lencode,0,e.work,M),e.lenbits=M.bits,nt){r.msg="invalid literal/lengths set",e.mode=qr;break}if(e.distbits=6,e.distcode=e.distdyn,M={bits:e.distbits},nt=kc(H9,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,M),e.distbits=M.bits,nt){r.msg="invalid distances set",e.mode=qr;break}if(e.mode=o0,t===i0)break t;case o0:e.mode=s0;case s0:if(l>=6&&p>=258){r.next_out=c,r.avail_out=p,r.next_in=i,r.avail_in=l,e.hold=m,e.bits=v,CO(r,E),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,e.mode===es&&(e.back=-1);break}for(e.back=0;B=e.lencode[m&(1<>>24,R=B>>>16&255,C=B&65535,!(P<=v);){if(l===0)break t;l--,m+=n[i++]<>O)],P=B>>>24,R=B>>>16&255,C=B&65535,!(O+P<=v);){if(l===0)break t;l--,m+=n[i++]<>>=O,v-=O,e.back+=O}if(m>>>=P,v-=P,e.back+=P,e.length=C,R===0){e.mode=_3;break}if(R&32){e.back=-1,e.mode=es;break}if(R&64){r.msg="invalid literal/length code",e.mode=qr;break}e.extra=R&15,e.mode=y3;case y3:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=b3;case b3:for(;B=e.distcode[m&(1<>>24,R=B>>>16&255,C=B&65535,!(P<=v);){if(l===0)break t;l--,m+=n[i++]<>O)],P=B>>>24,R=B>>>16&255,C=B&65535,!(O+P<=v);){if(l===0)break t;l--,m+=n[i++]<>>=O,v-=O,e.back+=O}if(m>>>=P,v-=P,e.back+=P,R&64){r.msg="invalid distance code",e.mode=qr;break}e.offset=C,e.extra=R&15,e.mode=w3;case w3:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=qr;break}e.mode=x3;case x3:if(p===0)break t;if(w=E-p,e.offset>w){if(w=e.offset-w,w>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=qr;break}w>e.wnext?(w-=e.wnext,x=e.wsize-w):x=e.wnext-w,w>e.length&&(w=e.length),A=e.window}else A=s,x=c-e.offset,w=e.length;w>p&&(w=p),p-=w,e.length-=w;do s[c++]=A[x++];while(--w);e.length===0&&(e.mode=s0);break;case _3:if(p===0)break t;s[c++]=e.length,p--,e.mode=s0;break;case Ap:if(e.wrap){for(;v<32;){if(l===0)break t;l--,m|=n[i++]<{if(au(r))return $i;let t=r.state;return t.window&&(t.window=null),r.state=null,Ya},JO=(r,t)=>{if(au(r))return $i;const e=r.state;return e.wrap&2?(e.head=t,t.done=!1,Ya):$i},QO=(r,t)=>{const e=t.length;let n,s,i;return au(r)||(n=r.state,n.wrap!==0&&n.mode!==ll)?$i:n.mode===ll&&(s=1,s=jc(s,t,e,0),s!==n.check)?V9:(i=tM(r,t,e,e),i?(n.mode=W9,Z9):(n.havedict=1,Ya))};var tU=X9,eU=J9,rU=Y9,nU=WO,iU=Q9,oU=YO,sU=XO,aU=JO,uU=QO,fU="pako inflate (from Nodeca project)",ls={inflateReset:tU,inflateReset2:eU,inflateResetKeep:rU,inflateInit:nU,inflateInit2:iU,inflate:oU,inflateEnd:sU,inflateGetHeader:aU,inflateSetDictionary:uU,inflateInfo:fU};function cU(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var hU=cU;const eM=Object.prototype.toString,{Z_NO_FLUSH:lU,Z_FINISH:dU,Z_OK:Hc,Z_STREAM_END:Ip,Z_NEED_DICT:Bp,Z_STREAM_ERROR:pU,Z_DATA_ERROR:k3,Z_MEM_ERROR:mU}=Ih;function Ph(r){this.options=hd.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new j9,this.strm.avail_out=0;let e=ls.inflateInit2(this.strm,t.windowBits);if(e!==Hc)throw new Error(of[e]);if(this.header=new hU,ls.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=$c.string2buf(t.dictionary):eM.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ls.inflateSetDictionary(this.strm,t.dictionary),e!==Hc)))throw new Error(of[e])}Ph.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,c,l;if(this.ended)return!1;for(t===~~t?c=t:c=t===!0?dU:lU,eM.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ls.inflate(e,c),i===Bp&&s&&(i=ls.inflateSetDictionary(e,s),i===Hc?i=ls.inflate(e,c):i===k3&&(i=Bp));e.avail_in>0&&i===Ip&&e.state.wrap>0&&r[e.next_in]!==0;)ls.inflateReset(e),i=ls.inflate(e,c);switch(i){case pU:case k3:case Bp:case mU:return this.onEnd(i),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||i===Ip))if(this.options.to==="string"){let p=$c.utf8border(e.output,e.next_out),m=e.next_out-p,v=$c.buf2string(e.output,p);e.next_out=m,e.avail_out=n-m,m&&e.output.set(e.output.subarray(p,p+m),0),this.onData(v)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(i===Hc&&l===0)){if(i===Ip)return i=ls.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Ph.prototype.onData=function(r){this.chunks.push(r)};Ph.prototype.onEnd=function(r){r===Hc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=hd.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ug(r,t){const e=new Ph(t);if(e.push(r),e.err)throw e.msg||of[e.err];return e.result}function vU(r,t){return t=t||{},t.raw=!0,Ug(r,t)}var gU=Ph,yU=Ug,bU=vU,wU=Ug,xU=Ih,_U={Inflate:gU,inflate:yU,inflateRaw:bU,ungzip:wU,constants:xU};const{Inflate:WW,inflate:MU,inflateRaw:GW,ungzip:YW}=_U;var EU=MU;function AU(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const Yf=r=>"version"in r;function SU(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function kU(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?yr.Buffer.from([]):yr.Buffer.from(t.map(e=>parseInt(e,16)))}var IU=Object.freeze({__proto__:null,encode:SU,decode:kU});function rM(r){return new TextDecoder("utf-8").decode(r)}function nM(r){return new TextEncoder().encode(r)}var BU=Object.freeze({__proto__:null,decode:rM,encode:nM});function x2(r){return Ou.encode(r)}function PU(r){return Ou.decode(r)}var RU=Object.freeze({__proto__:null,encode:x2,decode:PU});function CU(r){return s2(r)}function iM(r){return yr.Buffer.from(H7(r))}var TU=Object.freeze({__proto__:null,encode:CU,decode:iM}),LU=Object.freeze({__proto__:null,hex:IU,utf8:BU,bs58:RU,base64:TU});function oM(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function sM(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function Ng(r,t={}){r.forEach(e=>{if("accounts"in e)Ng(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function si(r){return r instanceof Ne?r:new Ne(r)}class OU extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t,l=c.length===0?s:"At path: "+c.join(".")+" -- "+s;super(l),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var p;return(p=n)!=null?p:n=[t,...e()]}}}function UU(r){return Nu(r)&&typeof r[Symbol.iterator]=="function"}function Nu(r){return typeof r=="object"&&r!=null}function ra(r){return typeof r=="string"?JSON.stringify(r):""+r}function NU(r){const{done:t,value:e}=r.next();return t?void 0:e}function DU(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+ra(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*I3(r,t,e,n){UU(r)||(r=[r]);for(const s of r){const i=DU(s,t,e,n);i&&(yield i)}}function*Dg(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&Nu(t.schema)&&Nu(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=Dg(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):Nu(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class aa{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,s?this.validator=(p,m)=>{const v=s(p,m);return I3(v,m,this,p)}:this.validator=()=>[],i?this.refiner=(p,m)=>{const v=i(p,m);return I3(v,m,this,p)}:this.refiner=()=>[]}assert(t){return zU(t,this)}create(t){return zg(t,this)}is(t){return aM(t,this)}mask(t){return qU(t,this)}validate(t,e){return e===void 0&&(e={}),Rh(t,this,e)}}function zU(r,t){const e=Rh(r,t);if(e[0])throw e[0]}function zg(r,t){const e=Rh(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function qU(r,t){const e=Rh(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function aM(r,t){return!Rh(r,t)[0]}function Rh(r,t,e){e===void 0&&(e={});const n=Dg(r,t,e),s=NU(n);return s[0]?[new OU(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function Ch(r,t){return new aa({type:r,schema:null,validator:t})}function FU(){return Ch("any",()=>!0)}function Pp(r){return new aa({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ra(t)}})}function jU(){return Ch("boolean",r=>typeof r=="boolean")}function B3(r){const t=ra(r),e=typeof r;return new aa({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator(n){return n===r||"Expected the literal `"+t+"`, but received: "+ra(n)}})}function a0(r){return new aa({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function W0(){return Ch("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ra(r))}function G0(r){return new aa({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Ra(){return Ch("string",r=>typeof r=="string"||"Expected a string, but received: "+ra(r))}function Js(r){const t=Object.keys(r);return new aa({type:"type",schema:r,*entries(e){if(Nu(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return Nu(e)||"Expected an object, but received: "+ra(e)}})}function uM(r){const t=r.map(e=>e.type).join(" | ");return new aa({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[c]=i.validate(e,{coerce:!0});return!c})||qg()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...c]=Dg(e,i,n),[l]=c;if(l[0])for(const[p]of c)p&&s.push(p);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ra(e),...s]}})}function qg(){return Ch("unknown",()=>!0)}function KU(r,t,e){return new aa({...r,coercer:(n,s)=>aM(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function $U(r,t,e,n){r=si(r),n||(n=Vc());const s=new Zl;if(s.add(new gh({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])}const P3=99;async function HU(r,t,e){return(await Fg(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function Fg(r,t,e){if(t.length<=P3)return await R3(r,t,e);{const n=AU(t,P3);return(await Promise.all(n.map(i=>R3(r,i,e)))).flat()}}async function R3(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((l,p)=>l===null?null:{publicKey:t[p],account:l,context:i})}async function fM(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const c=t._compile(),l=c.serialize(),m=t._serialize(l).toString("base64"),v={encoding:"base64",commitment:n??r.commitment};if(s){const x=(Array.isArray(s)?s:c.nonProgramIds()).map(A=>A.toBase58());v.accounts={encoding:"base64",addresses:x}}e&&(v.sigVerify=!0);const _=[m,v],E=await r._rpcRequest("simulateTransaction",_),w=zg(E,GU);if("error"in w){let x;if("data"in w.error&&(x=(i=w.error.data)===null||i===void 0?void 0:i.logs,x&&Array.isArray(x))){const A=` + `,B=A+x.join(A);console.error(w.error.message,B)}throw new o2("failed to simulate transaction: "+w.error.message,x)}return w.result}function VU(r){return KU(cM(r),ZU,t=>"error"in t?t:{...t,result:zg(t.result,r)})}const ZU=cM(qg());function cM(r){return uM([Js({jsonrpc:B3("2.0"),id:Ra(),result:r}),Js({jsonrpc:B3("2.0"),id:Ra(),error:Js({code:qg(),message:Ra(),data:G0(FU())})})])}function WU(r){return VU(Js({context:Js({slot:W0()}),value:r}))}const GU=WU(Js({err:a0(uM([Js({}),Ra()])),logs:a0(Pp(Ra())),accounts:G0(a0(Pp(a0(Js({executable:jU(),owner:Ra(),lamports:W0(),data:Pp(Ra()),rentEpoch:G0(W0())}))))),unitsConsumed:G0(W0())}));var YU=Object.freeze({__proto__:null,invoke:$U,getMultipleAccounts:HU,getMultipleAccountsAndContext:Fg,simulateTransaction:fM});class hM{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,c,l;if(n===void 0&&(n=this.opts),Yf(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const m of e)t.partialSign(m);t=await this.wallet.signTransaction(t);const p=t.serialize();try{return await C3(this.connection,p,n)}catch(m){if(m instanceof _2){const v=x2(Yf(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(c=t.signature)!==null&&c!==void 0?c:new Uint8Array),_=await this.connection.getTransaction(v,{commitment:"confirmed"});if(_){const E=(l=_.meta)===null||l===void 0?void 0:l.logMessages;throw E?new o2(m.message,E):m}else throw m}else throw m}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const c=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let l=t.map(v=>{var _,E;if(Yf(v.tx)){let w=v.tx;return v.signers&&w.sign(v.signers),w}else{let w=v.tx,x=(_=v.signers)!==null&&_!==void 0?_:[];return w.feePayer=(E=w.feePayer)!==null&&E!==void 0?E:this.wallet.publicKey,w.recentBlockhash=c,x.forEach(A=>{w.partialSign(A)}),w}});const p=await this.wallet.signAllTransactions(l),m=[];for(let v=0;vE.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+11)return null;s=l[0].match(/([0-9]+)/g)[0]}let i;try{i=parseInt(s)}catch{return null}let c=e.get(i);return c!==void 0?new Wc(i,c,t.logs):(c=dM.get(i),c!==void 0?new Wc(i,c,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function Kg(r,t){jg("debug-logs")&&console.log("Translating error:",r);const e=Du.parse(r.logs);if(e)return e;const n=Wc.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,c){return c==="programErrorStack"?i.programErrorStack.stack:c==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=If.parse(r.logs),new Proxy(r,s)}return r}const ze={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},dM=new Map([[ze.InstructionMissing,"8 byte instruction identifier not provided"],[ze.InstructionFallbackNotFound,"Fallback functions are not supported"],[ze.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[ze.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[ze.IdlInstructionStub,"The program was compiled without idl instructions"],[ze.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[ze.ConstraintMut,"A mut constraint was violated"],[ze.ConstraintHasOne,"A has one constraint was violated"],[ze.ConstraintSigner,"A signer constraint was violated"],[ze.ConstraintRaw,"A raw constraint was violated"],[ze.ConstraintOwner,"An owner constraint was violated"],[ze.ConstraintRentExempt,"A rent exemption constraint was violated"],[ze.ConstraintSeeds,"A seeds constraint was violated"],[ze.ConstraintExecutable,"An executable constraint was violated"],[ze.ConstraintState,"Deprecated Error, feel free to replace with something else"],[ze.ConstraintAssociated,"An associated constraint was violated"],[ze.ConstraintAssociatedInit,"An associated init constraint was violated"],[ze.ConstraintClose,"A close constraint was violated"],[ze.ConstraintAddress,"An address constraint was violated"],[ze.ConstraintZero,"Expected zero account discriminant"],[ze.ConstraintTokenMint,"A token mint constraint was violated"],[ze.ConstraintTokenOwner,"A token owner constraint was violated"],[ze.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[ze.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[ze.ConstraintMintDecimals,"A mint decimals constraint was violated"],[ze.ConstraintSpace,"A space constraint was violated"],[ze.ConstraintAccountIsNone,"A required account for the constraint is None"],[ze.RequireViolated,"A require expression was violated"],[ze.RequireEqViolated,"A require_eq expression was violated"],[ze.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[ze.RequireNeqViolated,"A require_neq expression was violated"],[ze.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[ze.RequireGtViolated,"A require_gt expression was violated"],[ze.RequireGteViolated,"A require_gte expression was violated"],[ze.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[ze.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[ze.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[ze.AccountDidNotDeserialize,"Failed to deserialize the account"],[ze.AccountDidNotSerialize,"Failed to serialize the account"],[ze.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[ze.AccountNotMutable,"The given account is not mutable"],[ze.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[ze.InvalidProgramId,"Program ID was not as expected"],[ze.InvalidProgramExecutable,"Program account is not executable"],[ze.AccountNotSigner,"The given account did not sign"],[ze.AccountNotSystemOwned,"The given account is not owned by the system program"],[ze.AccountNotInitialized,"The program expected this account to be already initialized"],[ze.AccountNotProgramData,"The given account is not a program data account"],[ze.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[ze.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[ze.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[ze.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[ze.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[ze.Deprecated,"The API being used is deprecated and should no longer be used"]]);var E2=function(){return E2=Object.assign||function(t){for(var e,n=1,s=arguments.length;nc.name===s);if(i.length!==1)throw new Zc(`Type not found: ${JSON.stringify(t)}`);return wi.typeDefLayout(i[0],e,n)}else if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],c=wi.fieldLayout({name:void 0,type:s},e);return Ze.array(c,i,n)}else throw new Error(`Not yet implemented: ${t}`)}}}static typeDefLayout(t,e=[],n){if(t.type.kind==="struct"){const s=t.type.fields.map(i=>wi.fieldLayout(i,e));return Ze.struct(s,n)}else if(t.type.kind==="enum"){let s=t.type.variants.map(i=>{const c=Dr(i.name);if(i.fields===void 0)return Ze.struct([],c);const l=i.fields.map((p,m)=>p.hasOwnProperty("name")?wi.fieldLayout(p,e):wi.fieldLayout({type:p,name:m.toString()},e));return Ze.struct(l,c)});return n!==void 0?Ze.rustEnum(s).replicate(n):Ze.rustEnum(s,n)}else throw new Error(`Unknown type kint: ${t}`)}}const L3="global";class dd{constructor(t){this.idl=t,this.ixLayout=dd.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=O3(L3,n.name);e.set(Ou.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(L3,t,e)}_encode(t,e,n){const s=yr.Buffer.alloc(1e3),i=Dr(e),c=this.ixLayout.get(i);if(!c)throw new Error(`Unknown method: ${i}`);const l=c.encode(n,s),p=s.slice(0,l);return yr.Buffer.concat([O3(t,e),p])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(c=>{var l,p;return wi.fieldLayout(c,Array.from([...(l=t.accounts)!==null&&l!==void 0?l:[],...(p=t.types)!==null&&p!==void 0?p:[]]))});const i=Dr(n.name);return[i,Ze.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?yr.Buffer.from(t,"hex"):Ou.decode(t));let n=Ou.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return ss.format(t,e,this.idl)}}class ss{static format(t,e,n){const s=n.instructions.filter(p=>t.name===p.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(p=>({name:p.name,type:ss.formatIdlType(p.type),data:ss.formatIdlData(p,t.data[p.name],n.types)})),c=ss.flattenIdlAccounts(s.accounts),l=e.map((p,m)=>m`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return ss.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){if(t.type.kind==="struct"){const s=t.type;return"{ "+Object.keys(e).map(c=>{const l=s.fields.filter(p=>p.name===c)[0];if(l===void 0)throw new Error("Unable to find type");return c+": "+ss.formatIdlData(l,e[c],n)}).join(", ")+" }"}else{if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],c=e[i],l=Object.keys(c).map(m=>{var v;const _=c[m],E=(v=s[i])===null||v===void 0?void 0:v.filter(w=>w.name===m)[0];if(E===void 0)throw new Error("Unable to find variant");return m+": "+ss.formatIdlData(E,_,n)}).join(", "),p=Dr(i,{pascalCase:!0});return l.length===0?p:`${p} { ${l} }`}else return"Tuple formatting not yet implemented"}}static flattenIdlAccounts(t,e){return t.map(n=>{const s=uN(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return ss.flattenIdlAccounts(n.accounts,i)}else return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function uN(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function O3(r,t){let e=aN(t),n=`${r}:${e}`;return yr.Buffer.from(Vl(n).slice(0,8))}function $g(r,t){if(t.type.kind==="enum"){const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>typeof s=="object"&&"name"in s?zu(r,s.type):zu(r,s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}return t.type.fields.map(e=>zu(r,e.type)).reduce((e,n)=>e+n,0)}function zu(r,t){var e,n;switch(t){case"bool":return 1;case"u8":return 1;case"i8":return 1;case"i16":return 2;case"u16":return 2;case"u32":return 4;case"i32":return 4;case"f32":return 4;case"u64":return 8;case"i64":return 8;case"f64":return 8;case"u128":return 16;case"i128":return 16;case"u256":return 32;case"i256":return 32;case"bytes":return 1;case"string":return 1;case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+zu(r,t.option);if("coption"in t)return 4+zu(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(c=>c.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new Zc(`Type not found: ${JSON.stringify(t)}`);let i=s[0];return $g(r,i)}if("array"in t){let s=t.array[0],i=t.array[1];return zu(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const dl=8;function pM(r){return Zt.Buffer.from(Vl(r).slice(0,dl))}class Ca{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,wi.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=yr.Buffer.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let c=n.slice(0,i),l=Ca.accountDiscriminator(t);return yr.Buffer.concat([l,c])}decode(t,e){if(Ca.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>Ca.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(dl),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=Ca.accountDiscriminator(t);return{offset:0,bytes:Ou.encode(e?yr.Buffer.concat([n,e]):n)}}size(t){var e;return dl+((e=$g(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${Dr(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return pM(e)}}class mM{constructor(t){if(t.events===void 0){this.layouts=new Map;return}const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,wi.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[s2(vM(n.name)),n.name]))}decode(t){let e;try{e=yr.Buffer.from(H7(t))}catch{return null}const n=s2(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function vM(r){return pM(`event:${r}`)}class fN{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,wi.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=yr.Buffer.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class Hg{constructor(t){this.instruction=new dd(t),this.accounts=new Ca(t),this.events=new mM(t),this.types=new fN(t)}}var cN=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Zt.global<"u"?Zt.global:typeof self<"u"?self:{};function hN(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class fi{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var pd=fi;function lN(r,t){return t.property?r+"["+t.property+"]":r}class Ta extends fi{isCount(){throw new Error("ExternalLayout is abstract")}}class gM extends Ta{constructor(t,e,n){if(!(t instanceof fi))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof md||this.layout instanceof yM}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class md extends fi{constructor(t,e){if(super(t,e),6i&&c instanceof fi,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class xM{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class U3 extends xM{constructor(t,e){if(!(t instanceof Ta&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class _M extends fi{constructor(t,e,n){const s=t instanceof md||t instanceof yM;if(s)t=new U3(new gM(t));else if(t instanceof Ta&&t.isCount())t=new U3(t);else if(!(t instanceof xM))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof fi))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new vN(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class vN extends fi{constructor(t,e,n,s){if(!(t instanceof _M))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof fi))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class gN extends fi{constructor(t,e){if(!(t instanceof Ta&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof Ta||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof Ta&&(s=t.length),!(Zt.Buffer.isBuffer(t)&&s===t.length))throw new TypeError(lN("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof Ta&&this.length.encode(s,e,n),s}}var yN=(r,t,e)=>new gM(r,t,e),bN=r=>new md(1,r),ms=r=>new md(4,r),wN=r=>new dN(r),ks=r=>new pN(r),vn=(r,t,e)=>new mN(r,t,e),MM=(r,t,e)=>new _M(r,t,e),Th=(r,t)=>new gN(r,t);class xN{constructor(t){}encode(t,e){switch(Dr(t)){case"createAccount":return MN(e);case"assign":return EN(e);case"transfer":return AN(e);case"createAccountWithSeed":return SN(e);case"advanceNonceAccount":return IN(e);case"withdrawNonceAccount":return BN(e);case"initializeNonceAccount":return kN(e);case"authorizeNonceAccount":return PN(e);case"allocate":return RN(e);case"allocateWithSeed":return CN(e);case"assignWithSeed":return TN(e);case"transferWithSeed":return LN(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class _N extends pd{constructor(t){super(-1,t),this.property=t,this.layout=vn([ms("length"),ms("lengthPadding"),Th(yN(ms(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Zt.Buffer.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return ms().span+ms().span+new Jv(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function vd(r){return new _N(r)}function Hi(r){return Th(32,r)}function MN({lamports:r,space:t,owner:e}){return Gi({createAccount:{lamports:r,space:t,owner:e.toBuffer()}})}function EN({owner:r}){return Gi({assign:{owner:r.toBuffer()}})}function AN({lamports:r}){return Gi({transfer:{lamports:r}})}function SN({base:r,seed:t,lamports:e,space:n,owner:s}){return Gi({createAccountWithSeed:{base:r.toBuffer(),seed:t,lamports:e,space:n,owner:s.toBuffer()}},An.getVariant(3).span+t.length)}function kN({authorized:r}){return Gi({initializeNonceAccount:{authorized:r.toBuffer()}})}function IN({authorized:r}){return Gi({advanceNonceAccount:{authorized:r.toBuffer()}})}function BN({lamports:r}){return Gi({withdrawNonceAccount:{lamports:r}})}function PN({authorized:r}){return Gi({authorizeNonceAccount:{authorized:r.toBuffer()}})}function RN({space:r}){return Gi({allocate:{space:r}})}function CN({base:r,seed:t,space:e,owner:n}){return Gi({allocateWithSeed:{base:r.toBuffer(),seed:t,space:e,owner:n.toBuffer()}},An.getVariant(9).span+t.length)}function TN({base:r,seed:t,owner:e}){return Gi({assignWithSeed:{base:r.toBuffer(),seed:t,owner:e.toBuffer()}},An.getVariant(10).span+t.length)}function LN({lamports:r,seed:t,owner:e}){return Gi({transferWithSeed:{lamports:r,seed:t,owner:e.toBuffer()}},An.getVariant(11).span+t.length)}const An=MM(ms("instruction"));An.addVariant(0,vn([ks("lamports"),ks("space"),Hi("owner")]),"createAccount");An.addVariant(1,vn([Hi("owner")]),"assign");An.addVariant(2,vn([ks("lamports")]),"transfer");An.addVariant(3,vn([Hi("base"),vd("seed"),ks("lamports"),ks("space"),Hi("owner")]),"createAccountWithSeed");An.addVariant(4,vn([Hi("authorized")]),"advanceNonceAccount");An.addVariant(5,vn([ks("lamports")]),"withdrawNonceAccount");An.addVariant(6,vn([Hi("authorized")]),"initializeNonceAccount");An.addVariant(7,vn([Hi("authorized")]),"authorizeNonceAccount");An.addVariant(8,vn([ks("space")]),"allocate");An.addVariant(9,vn([Hi("base"),vd("seed"),ks("space"),Hi("owner")]),"allocateWithSeed");An.addVariant(10,vn([Hi("base"),vd("seed"),Hi("owner")]),"assignWithSeed");An.addVariant(11,vn([ks("lamports"),vd("seed"),Hi("owner")]),"transferWithSeed");function Gi(r,t){const e=Zt.Buffer.alloc(t??ON),n=An.encode(r,e);return t===void 0?e.slice(0,n):e}const ON=Math.max(...Object.values(An.registry).map(r=>r.span));class UN{constructor(t){this.idl=t}async encode(t,e){switch(t){case"nonce":{const n=Zt.Buffer.alloc(wb),s=EM.encode(e,n);return n.slice(0,s)}default:throw new Error(`Invalid account name: ${t}`)}}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){switch(t){case"nonce":return NN(e);default:throw new Error(`Invalid account name: ${t}`)}}memcmp(t,e){switch(t){case"nonce":return{dataSize:wb};default:throw new Error(`Invalid account name: ${t}`)}}size(t){var e;return(e=$g(this.idl,t))!==null&&e!==void 0?e:0}}function NN(r){return EM.decode(r)}class DN extends pd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function N3(r){return new DN(Th(32),t=>new Ne(t),t=>t.toBuffer(),r)}const EM=vn([ms("version"),ms("state"),N3("authorizedPubkey"),N3("nonce"),vn([wN("lamportsPerSignature")],"feeCalculator")]);class zN{constructor(t){}decode(t){throw new Error("System program does not have events")}}class qN{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class AM{constructor(t){this.instruction=new xN(t),this.accounts=new UN(t),this.events=new zN(t),this.types=new qN(t)}}function FN(r){return new TextDecoder().decode(Vl(r))}var jN=Object.freeze({__proto__:null,hash:FN});function KN(r,t,e){const n=yr.Buffer.concat([r.toBuffer(),yr.Buffer.from(t),e.toBuffer()]);return new Ne(Vl(n))}function SM(r,...t){let e=[yr.Buffer.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof yr.Buffer?s:si(s).toBuffer())});const[n]=Ne.findProgramAddressSync(e,si(r));return n}var $N=Object.freeze({__proto__:null,createWithSeedSync:KN,associated:SM});const Vg=new Ne("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Zg=new Ne("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function HN({mint:r,owner:t}){return Ne.findProgramAddressSync([t.toBuffer(),Vg.toBuffer(),r.toBuffer()],Zg)[0]}var VN=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Vg,ASSOCIATED_PROGRAM_ID:Zg,associatedAddress:HN}),k2={exports:{}};(function(r,t){var e=typeof self<"u"?self:cN,n=function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i}();(function(i){(function(c){var l={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function p(f){return f&&DataView.prototype.isPrototypeOf(f)}if(l.arrayBuffer)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=ArrayBuffer.isView||function(f){return f&&m.indexOf(Object.prototype.toString.call(f))>-1};function _(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 E(f){return typeof f!="string"&&(f=String(f)),f}function w(f){var h={next:function(){var g=f.shift();return{done:g===void 0,value:g}}};return l.iterable&&(h[Symbol.iterator]=function(){return h}),h}function x(f){this.map={},f instanceof x?f.forEach(function(h,g){this.append(g,h)},this):Array.isArray(f)?f.forEach(function(h){this.append(h[0],h[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(h){this.append(h,f[h])},this)}x.prototype.append=function(f,h){f=_(f),h=E(h);var g=this.map[f];this.map[f]=g?g+", "+h:h},x.prototype.delete=function(f){delete this.map[_(f)]},x.prototype.get=function(f){return f=_(f),this.has(f)?this.map[f]:null},x.prototype.has=function(f){return this.map.hasOwnProperty(_(f))},x.prototype.set=function(f,h){this.map[_(f)]=E(h)},x.prototype.forEach=function(f,h){for(var g in this.map)this.map.hasOwnProperty(g)&&f.call(h,this.map[g],g,this)},x.prototype.keys=function(){var f=[];return this.forEach(function(h,g){f.push(g)}),w(f)},x.prototype.values=function(){var f=[];return this.forEach(function(h){f.push(h)}),w(f)},x.prototype.entries=function(){var f=[];return this.forEach(function(h,g){f.push([g,h])}),w(f)},l.iterable&&(x.prototype[Symbol.iterator]=x.prototype.entries);function A(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function B(f){return new Promise(function(h,g){f.onload=function(){h(f.result)},f.onerror=function(){g(f.error)}})}function P(f){var h=new FileReader,g=B(h);return h.readAsArrayBuffer(f),g}function R(f){var h=new FileReader,g=B(h);return h.readAsText(f),g}function C(f){for(var h=new Uint8Array(f),g=new Array(h.length),S=0;S-1?h:f}function nt(f,h){h=h||{};var g=h.body;if(f instanceof nt){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,h.headers||(this.headers=new x(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!g&&f._bodyInit!=null&&(g=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=h.credentials||this.credentials||"same-origin",(h.headers||!this.headers)&&(this.headers=new x(h.headers)),this.method=tt(h.method||this.method||"GET"),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&g)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(g)}nt.prototype.clone=function(){return new nt(this,{body:this._bodyInit})};function G(f){var h=new FormData;return f.trim().split("&").forEach(function(g){if(g){var S=g.split("="),I=S.shift().replace(/\+/g," "),y=S.join("=").replace(/\+/g," ");h.append(decodeURIComponent(I),decodeURIComponent(y))}}),h}function M(f){var h=new x,g=f.replace(/\r?\n[\t ]+/g," ");return g.split(/\r?\n/).forEach(function(S){var I=S.split(":"),y=I.shift().trim();if(y){var u=I.join(":").trim();h.append(y,u)}}),h}z.call(nt.prototype);function d(f,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new x(h.headers),this.url=h.url||"",this._initBody(f)}z.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new x(this.headers),url:this.url})},d.error=function(){var f=new d(null,{status:0,statusText:""});return f.type="error",f};var o=[301,302,303,307,308];d.redirect=function(f,h){if(o.indexOf(h)===-1)throw new RangeError("Invalid status code");return new d(null,{status:h,headers:{location:f}})},c.DOMException=i.DOMException;try{new c.DOMException}catch{c.DOMException=function(h,g){this.message=h,this.name=g;var S=Error(h);this.stack=S.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function a(f,h){return new Promise(function(g,S){var I=new nt(f,h);if(I.signal&&I.signal.aborted)return S(new c.DOMException("Aborted","AbortError"));var y=new XMLHttpRequest;function u(){y.abort()}y.onload=function(){var b={status:y.status,statusText:y.statusText,headers:M(y.getAllResponseHeaders()||"")};b.url="responseURL"in y?y.responseURL:b.headers.get("X-Request-URL");var D="response"in y?y.response:y.responseText;g(new d(D,b))},y.onerror=function(){S(new TypeError("Network request failed"))},y.ontimeout=function(){S(new TypeError("Network request failed"))},y.onabort=function(){S(new c.DOMException("Aborted","AbortError"))},y.open(I.method,I.url,!0),I.credentials==="include"?y.withCredentials=!0:I.credentials==="omit"&&(y.withCredentials=!1),"responseType"in y&&l.blob&&(y.responseType="blob"),I.headers.forEach(function(b,D){y.setRequestHeader(D,b)}),I.signal&&(I.signal.addEventListener("abort",u),y.onreadystatechange=function(){y.readyState===4&&I.signal.removeEventListener("abort",u)}),y.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return a.polyfill=!0,i.fetch||(i.fetch=a,i.Headers=x,i.Request=nt,i.Response=d),c.Headers=x,c.Request=nt,c.Response=d,c.fetch=a,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(k2,k2.exports);var ZN=hN(k2.exports);async function WN(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([kM(r,t),ZN(n)]),c=(await i.json()).filter(p=>!p.aborted&&p.state==="Built"&&p.verified==="Verified");if(c.length===0)return null;const l=c[0];return s.slot.toNumber()!==l.verified_slot?null:l}async function kM(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=I2(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=I2(s.data);return i}const GN=Ze.rustEnum([Ze.struct([],"uninitialized"),Ze.struct([Ze.option(Ze.publicKey(),"authorityAddress")],"buffer"),Ze.struct([Ze.publicKey("programdataAddress")],"program"),Ze.struct([Ze.u64("slot"),Ze.option(Ze.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,Ze.u32());function I2(r){return GN.decode(r)}var YN=Object.freeze({__proto__:null,verifiedBuild:WN,fetchData:kM,decodeUpgradeableLoaderState:I2}),XN=Object.freeze({__proto__:null,sha256:jN,rpc:YU,publicKey:$N,bytes:LU,token:VN,features:eN,registry:YN});function JN(r){return"accounts"in r}async function QN(r){const t=(await Ne.findProgramAddress([],r))[0];return await Ne.createWithSeed(t,tD(),r)}function tD(){return"anchor:idl"}const eD=Ze.struct([Ze.publicKey("authority"),Ze.vecU8("data")]);function rD(r){return eD.decode(r)}function Lh(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(c=>c.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class pl{static build(t,e,n){if(t.name==="_inner")throw new Zc("the _inner name is reserved");const s=(...i)=>{const[c,l]=Lh(t,[...i]);Ng(t.accounts,l.accounts),nD(t,...i);const p=s.accounts(l.accounts);return l.remainingAccounts!==void 0&&p.push(...l.remainingAccounts),jg("debug-logs")&&console.log("Outgoing account metas:",p),new gh({keys:p,programId:n,data:e(t.name,sM(t,...c))})};return s.accounts=i=>pl.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const l=t[i.name];return pl.accountsArray(l,i.accounts,n,s).flat()}else{const l=i;let p;try{p=si(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const m=l.isOptional&&p.equals(n),v=l.isMut&&!m,_=l.isSigner&&!m;return{pubkey:p,isWritable:v,isSigner:_}}}).flat():[]}}function nD(r,...t){}class iD{static build(t,e){return(...s)=>{var i,c,l;const[,p]=Lh(t,[...s]),m=new Zl;if(p.preInstructions&&p.instructions)throw new Error("instructions is deprecated, use preInstructions");return(i=p.preInstructions)===null||i===void 0||i.forEach(v=>m.add(v)),(c=p.instructions)===null||c===void 0||c.forEach(v=>m.add(v)),m.add(e(...s)),(l=p.postInstructions)===null||l===void 0||l.forEach(v=>m.add(v)),m}}}class oD{static build(t,e,n,s){return async(...c)=>{var l;const p=e(...c),[,m]=Lh(t,[...c]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(p,(l=m.signers)!==null&&l!==void 0?l:[],m.options)}catch(v){throw Kg(v,n)}}}}class sD{static build(t,e,n,s){var i;const c={};return(i=t.accounts)===null||i===void 0||i.forEach(l=>{const p=Dr(l.name);c[p]=new IM(t,l,n,s,e)}),c}}class IM{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??Vc(),this._coder=i??new Hg(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(s=>s?s.data:null)}async fetchMultipleAndContext(t,e){return(await Fg(this._provider.connection,t.map(s=>si(s)),e)).map(s=>{if(s==null)return null;const{account:i,context:c}=s;return{data:this._coder.accounts.decode(this._idlAccount.name,i.data),context:c}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Zt.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:i,account:c})=>({publicKey:i,account:this._coder.accounts.decode(this._idlAccount.name,c.data)}))}subscribe(t,e){const n=Xf.get(t.toString());if(n)return n.ee;const s=new hI;t=si(t);const i=this._provider.connection.onAccountChange(t,c=>{const l=this._coder.accounts.decode(this._idlAccount.name,c.data);s.emit("change",l)},e);return Xf.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=Xf.get(t.toString());if(!e){console.warn("Address is not subscribed");return}Xf&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{Xf.delete(t.toString())}).catch(console.error)}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return Hl.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await SM(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(si(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(si(t),e)}}const Xf=new Map,B2="Program log: ",BM="Program data: ",aD=B2.length,uD=BM.length;class PM{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new Wg(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,c)=>{if(!i.err)for(const l of this._eventParser.parseLogs(i.logs)){const p=this._eventListeners.get(l.name);p&&p.forEach(m=>{const v=this._eventCallbacks.get(m);if(v){const[,_]=v;_(l.data,c.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class Wg{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new cD(t),s=new fD;let i=n.next();for(;i!==null;){let[c,l,p]=this.handleLog(s,i,e);c&&(yield c),l&&s.push(l),p&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(B2)||t.startsWith(BM)){const n=t.startsWith(B2)?t.slice(aD):t.slice(uD),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}else return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class fD{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class cD{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class hD{static build(t,e,n,s,i,c,l){return async(...m)=>{var v;const _=e(...m),[,E]=Lh(t,[...m]);let w;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{w=await s.simulate(_,E.signers,(v=E.options)===null||v===void 0?void 0:v.commitment)}catch(B){throw Kg(B,n)}if(w===void 0)throw new Error("Unable to simulate transaction");const x=w.logs;if(!x)throw new Error("Simulated logs not found");const A=[];if(l.events){let B=new Wg(c,i);for(const P of B.parseLogs(x))A.push(P)}return{events:A,raw:x}}}}function Rp(r){return new RM(Th(8),t=>Gg.fromBuffer(t),t=>t.toBuffer(),r)}function u0(r){return new RM(Th(32),t=>new Ne(t),t=>t.toBuffer(),r)}function Cp(r,t){return new lD(r,t)}class RM extends pd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class lD extends pd{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=ms()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class Gg extends Jv{toBuffer(){const t=super.toArray().reverse(),e=Zt.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Zt.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Gg([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const dD=vn([u0("mint"),u0("owner"),Rp("amount"),Cp(u0(),"delegate"),(r=>{const t=MM(bN("discriminator"),null,r);return t.addVariant(0,vn([]),"uninitialized"),t.addVariant(1,vn([]),"initialized"),t.addVariant(2,vn([]),"frozen"),t})("state"),Cp(Rp(),"isNative"),Rp("delegatedAmount"),Cp(u0(),"closeAuthority")]);function pD(r){return dD.decode(r)}class Gc{constructor(t,e,n,s,i,c,l,p){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=l,this._customResolver=p,this._args=t,this._accountStore=new mD(n,c,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,c=t[i];c!==void 0&&(TM(c)?JN(s)?n[i]=this.resolveOptionalsHelper(c,s.accounts):n[i]=LM(c,!0):c!==null?n[i]=si(c):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,p])&&await this.autoPopulatePda(l,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s!this.get([...e,Dr(E)]));if(n+=_.length,_.length>0){const E=await this._accountStore.fetchAccount({publicKey:v});await Promise.all(_.map(async w=>{const x=Dr(w);return this.set([...e,x],E[x]),E[x]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(c=>this.toBuffer(c,e)));if(n.some(c=>typeof c>"u"))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await Ne.findProgramAddress(n,s);this.set([...e,Dr(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new Ne(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(c=>c.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const i=n.type.fields.find(c=>c.name===e[0]);return this.getType(i.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(!(typeof e>"u"))return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=Dr(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,c)=>(i||{})[c],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,Dr(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const c=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(c,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[Dr(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Zt.Buffer.from([e]);case"u16":let n=Zt.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Zt.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Zt.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Zt.Buffer.from(nM(e));case"publicKey":return e.toBuffer();default:if(t.array)return Zt.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Gc.CONST_ACCOUNTS={associatedTokenProgram:Zg,rent:fI,systemProgram:Hl.programId,tokenProgram:Vg,clock:cI};class mD{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await Xa.fetchIdl(t,this._provider);if(e){const n=new Xa(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=pD(i.data);this._cache.set(s,c)}else if(e){const i=await this.ensureIdl(n);if(i){const c=i[Dr(e)];if(c){const l=await c.fetch(t);this._cache.set(s,l)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=i.data,l=await this.ensureIdl(i.owner);if(l){const p=Object.values(l)[0];if(!p)throw new Error("No accounts for this program");const m=p.coder.accounts.decodeAny(c);this._cache.set(s,m)}}return this._cache.get(s)}}class CM{static build(t,e,n,s,i,c,l,p,m,v,_){return(...E)=>new vD(E,s,i,c,l,p,t,e,n,m,v,_)}}function TM(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function LM(r,t){const e={};for(const n in r){const s=r[n];if(s===null){if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");continue}e[n]=TM(s)?LM(s,!0):si(s)}return e}class vD{constructor(t,e,n,s,i,c,l,p,m,v,_,E){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=c,this._programId=p,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new Gc(t,this._accounts,l,p,m,v,_,E)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class gD{static build(t,e,n,s){const i=e.accounts.find(p=>p.isMut),c=!!e.returns;return i||!c?void 0:async(...p)=>{var m,v;let _=await n(...p);const E=`Program return: ${t} `;let w=_.raw.find(P=>P.startsWith(E));if(!w)throw new Error("View expected return log");let x=iM(w.slice(E.length)),A=e.returns;if(!A)throw new Error("View expected return type");return wi.fieldLayout({type:A},Array.from([...(m=s.accounts)!==null&&m!==void 0?m:[],...(v=s.types)!==null&&v!==void 0?v:[]])).decode(x)}}}class yD{static build(t,e,n,s,i){const c={},l={},p={},m={},v={},_={},E=oM(t),w=t.accounts?sD.build(t,e,n,s):{};return t.instructions.forEach(x=>{const A=pl.build(x,(H,tt)=>e.instruction.encode(H,tt),n),B=iD.build(x,A),P=oD.build(x,B,E,s),R=hD.build(x,B,E,s,e,n,t),C=gD.build(n,x,R,t),O=CM.build(s,n,x,A,B,P,R,C,w,t.types||[],i&&i(x)),z=Dr(x.name);l[z]=A,p[z]=B,c[z]=P,m[z]=R,v[z]=O,C&&(_[z]=C)}),[c,l,p,w,m,v,_]}}class Xa{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=si(e),n||(n=Vc()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new Hg(t),this._events=new PM(this._programId,n,this._coder);const[c,l,p,m,v,_,E]=yD.build(t,this._coder,e,n,i??(()=>{}));this.rpc=c,this.instruction=l,this.transaction=p,this.account=m,this.simulate=v,this.methods=_,this.views=E}static async at(t,e){const n=si(t),s=await Xa.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new Xa(s,n,e)}static async fetchIdl(t,e){e=e??Vc();const n=si(t),s=await QN(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let c=rD(i.data.slice(8));const l=EU(c.data);return JSON.parse(rM(l))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const bD=new Ne("11111111111111111111111111111111");function wD(r){return new Xa(OM,bD,r,xD())}function xD(){return new AM(OM)}const OM={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class _D{static system(t){return wD(t)}}const MD=Object.freeze(Object.defineProperty({__proto__:null,AccountClient:IM,AnchorError:Du,AnchorProvider:hM,BN:Jv,BorshAccountsCoder:Ca,BorshCoder:Hg,BorshEventCoder:mM,BorshInstructionCoder:dd,DISCRIMINATOR_SIZE:dl,EventManager:PM,EventParser:Wg,IdlError:Zc,LangErrorCode:ze,LangErrorMessage:dM,MethodsBuilderFactory:CM,Native:_D,Program:Xa,ProgramError:Wc,ProgramErrorStack:If,SystemCoder:AM,eventDiscriminator:vM,getProvider:Vc,parseIdlErrors:oM,setProvider:JU,splitArgsAndCtx:Lh,toInstruction:sM,translateAddress:si,translateError:Kg,utils:XN,validateAccounts:Ng,web3:K7},Symbol.toStringTag,{value:"Module"})),UM=j7(MD);var Jf={},Qf={},D3;function ED(){if(D3)return Qf;D3=1,Object.defineProperty(Qf,"__esModule",{value:!0}),Qf.PythOracleEventCoder=void 0;var r=function(){function t(){}return t.prototype.decode=function(e){throw new Error("Pyth oracle program does not have events")},t}();return Qf.PythOracleEventCoder=r,Qf}var tc={},z3;function AD(){if(z3)return tc;z3=1;var r=Re&&Re.__awaiter||function(n,s,i,c){function l(p){return p instanceof i?p:new i(function(m){m(p)})}return new(i||(i=Promise))(function(p,m){function v(w){try{E(c.next(w))}catch(x){m(x)}}function _(w){try{E(c.throw(w))}catch(x){m(x)}}function E(w){w.done?p(w.value):l(w.value).then(v,_)}E((c=c.apply(n,s||[])).next())})},t=Re&&Re.__generator||function(n,s){var i={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},c,l,p,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(E){return function(w){return _([E,w])}}function _(E){if(c)throw new TypeError("Generator is already executing.");for(;i;)try{if(c=1,l&&(p=E[0]&2?l.return:E[0]?l.throw||((p=l.return)&&p.call(l),0):l.next)&&!(p=p.call(l,E[1])).done)return p;switch(l=0,p&&(E=[E[0]&2,p.value]),E[0]){case 0:case 1:p=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,l=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(p=i.trys,!(p=p.length>0&&p[p.length-1])&&(E[0]===6||E[0]===2)){i=0;continue}if(E[0]===3&&(!p||E[1]>p[0]&&E[1]v)throw new Error("The metadata is too long");var tt=A.subarray(0,C);return c.Buffer.concat([R,tt])}else{var nt=P.encode(x,A),tt=A.subarray(0,nt);return c.Buffer.concat([R,tt])}},E.parseIxLayout=function(w){var x=w.instructions.map(function(A){var B=A.args.map(function(R){var C,O;return m.IdlCoder.fieldLayout(R,Array.from(n(n([],(C=w.accounts)!==null&&C!==void 0?C:[]),(O=w.types)!==null&&O!==void 0?O:[])))}),P=l.default(A.name);return[P,p.struct(B,P)]});return new Map(x)},E.prototype.decode=function(w,x){x===void 0&&(x="hex"),typeof w=="string"&&(w=x==="hex"?c.Buffer.from(w,"hex"):c.Buffer.from(i.default.decode(w)));var A=i.default.encode(w.subarray(0,this.discriminatorLength)),B=w.subarray(this.discriminatorLength),P=this.discriminatorLayouts.get(A);if(!P)return null;if(P.name==="updProduct"||P.name==="addProduct"){for(var R={},C=0;Cr.MAX_SLOT_DIFFERENCE&&(pt=s.Unknown);var Ft,lt;pt===s.Trading&&(Ft=yt.price,lt=yt.confidence);for(var ct=[],Tt=240;ct.length=n;)l-=n,e[p]=c>>l&i,p+=1}),s)l>0&&(e[p]=c<=t)throw new Error("Excessive padding: ".concat(l," (max ").concat(t-1," allowed)"));if(c%(1<8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return NM(r,8,e,t,!0),e}function qD(r,t,e){if(t>8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return NM(r,t,e,8,!1),e}var mo={};Object.defineProperty(mo,"__esModule",{value:!0});mo.CHECKSUM_LENGTH=void 0;mo.createChecksum=$D;mo.decode=jM;mo.decodeWithPrefix=VD;mo.detectCase=ZD;mo.encode=HD;mo.expandPrefix=FM;mo.verifyChecksum=KD;var DM=Bf,P2="qpzry9x8gf2tvdw0s3jn54khce6mua7l",zM=734539939,G3=33,Y3=126,R2=6;mo.CHECKSUM_LENGTH=R2;var FD=function(){for(var r=new Map,t=0;t>25,s=(t&33554431)<<5^e;return jD.reduce(function(i,c,l){return n>>l&1?i^c:i},s)},1)}function FM(r,t){for(var e=0;e>5,t[e+r.length+1]=n&31}t[r.length]=0}function KD(r){switch(qM(r)){case 1:return"bech32";case zM:return"bech32m";default:return}}function $D(r,t){var e;switch(t){case"bech32":e=1;break;case"bech32m":e=zM;break;default:throw Error("Invalid encoding value: ".concat(t,"; expected bech32 or bech32m"))}for(var n=qM(r)^e,s=0;s>i&31}}function HD(r){return r.reduce(function(t,e){return t+P2[e]},"")}function jM(r,t){for(var e=t||(0,DM.createBitArray)(r.length),n=0;n1&&arguments[1]!==void 0?arguments[1]:"message",e=!1,n=!1,s=0;sY3)throw new TypeError("Invalid char in ".concat(t,": ").concat(i,"; ")+"should be in ASCII range ".concat(G3,"-").concat(Y3));n=n||i>=65&&i<=90,e=e||i>=97&&i<=122}if(e&&n)throw new TypeError("Mixed-case ".concat(t));return n?"upper":e?"lower":null}Object.defineProperty(Ps,"__esModule",{value:!0});Ps.BitcoinAddress=void 0;Ps.decode=XD;Ps.decodeTo5BitArray=ty;Ps.encode=YD;Ps.encode5BitArray=Qg;Ps.from5BitArray=Jg;Ps.to5BitArray=Xg;var Yc=Bf,Di=mo;function WD(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function X3(r,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:"bech32",s=2*r.length+1+t.length+Di.CHECKSUM_LENGTH;if(s-r.length>ml)throw new Error("Message to be produced is too long (max ".concat(ml," supported)"));var i=(e=(0,Di.detectCase)(r,"prefix"))!==null&&e!==void 0?e:"lower",c=(0,Yc.createBitArray)(s);(0,Di.expandPrefix)(r.toLowerCase(),c.subarray(0,2*r.length+1));var l=c.subarray(2*r.length+1,c.length-Di.CHECKSUM_LENGTH);l.set(t),(0,Di.createChecksum)(c,n);var p=(0,Di.encode)(c.subarray(2*r.length+1));return i==="upper"&&(p=p.toUpperCase()),"".concat(r,"1").concat(p)}function YD(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"bech32";return Qg(r,Xg(t),e)}function ty(r){if(r.length>ml)throw new TypeError("Message too long; max ".concat(ml," expected"));(0,Di.detectCase)(r);var t=r.toLowerCase(),e=t.lastIndexOf("1");if(e<0)throw new Error('No separator char ("1") found');if(e>r.length-Di.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(Di.CHECKSUM_LENGTH," chars expected)"));var n=t.substring(0,e),s=(0,Di.decodeWithPrefix)(n,t.substring(e+1)),i=(0,Di.verifyChecksum)(s);if(i===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:i,data:s.subarray(2*n.length+1,s.length-Di.CHECKSUM_LENGTH)}}function XD(r){var t=ty(r),e=t.prefix,n=t.encoding,s=t.data;return{prefix:e,encoding:n,data:Jg(s)}}var JD=function(){function r(t,e,n){if(WD(this,r),t!=="bc"&&t!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(e<0||e>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(n.length<2||n.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(e===0&&n.length!==20&&n.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=t,this.scriptVersion=e,this.data=n}return GD(r,[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var e=Math.ceil(this.data.length*8/5),n=(0,Yc.createBitArray)(e+1);n[0]=this.scriptVersion,Xg(this.data,n.subarray(1));var s=this.scriptVersion===0?"bech32":"bech32m";return Qg(this.prefix,n,s)}}],[{key:"decode",value:function(e){var n=ty(e),s=n.prefix,i=n.data,c=n.encoding;if(s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var l=i[0];if(l===0&&c!=="bech32")throw Error("Unexpected encoding ".concat(c," used for version 0 script"));if(l>0&&c!=="bech32m")throw Error("Unexpected encoding ".concat(c," used for version ").concat(l," script"));return new this(s,l,Jg(i.subarray(1)))}}]),r}();Ps.BitcoinAddress=JD;var QD={exports:{}};(function(r){(function(t){var e=function(K){var Y,V=new Float64Array(16);if(K)for(Y=0;Y>24&255,K[Y+1]=V>>16&255,K[Y+2]=V>>8&255,K[Y+3]=V&255,K[Y+4]=U>>24&255,K[Y+5]=U>>16&255,K[Y+6]=U>>8&255,K[Y+7]=U&255}function A(K,Y,V,U,W){var et,dt=0;for(et=0;et>>8)-1}function B(K,Y,V,U){return A(K,Y,V,U,16)}function P(K,Y,V,U){return A(K,Y,V,U,32)}function R(K,Y,V,U){for(var W=U[0]&255|(U[1]&255)<<8|(U[2]&255)<<16|(U[3]&255)<<24,et=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,dt=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ut=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,ht=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,zt=U[4]&255|(U[5]&255)<<8|(U[6]&255)<<16|(U[7]&255)<<24,Wt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,ye=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,Yt=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,pe=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,ve=U[8]&255|(U[9]&255)<<8|(U[10]&255)<<16|(U[11]&255)<<24,ge=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,ie=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,ue=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,fe=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ce=U[12]&255|(U[13]&255)<<8|(U[14]&255)<<16|(U[15]&255)<<24,Kt=W,oe=et,Jt=dt,le=ut,ae=ht,ne=zt,Ot=Wt,Nt=ye,he=Yt,ee=pe,re=ve,me=ge,Fe=ie,Ge=ue,Xe=fe,Ye=ce,bt,ir=0;ir<20;ir+=2)bt=Kt+Fe|0,ae^=bt<<7|bt>>>32-7,bt=ae+Kt|0,he^=bt<<9|bt>>>32-9,bt=he+ae|0,Fe^=bt<<13|bt>>>32-13,bt=Fe+he|0,Kt^=bt<<18|bt>>>32-18,bt=ne+oe|0,ee^=bt<<7|bt>>>32-7,bt=ee+ne|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+ee|0,oe^=bt<<13|bt>>>32-13,bt=oe+Ge|0,ne^=bt<<18|bt>>>32-18,bt=re+Ot|0,Xe^=bt<<7|bt>>>32-7,bt=Xe+re|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+Xe|0,Ot^=bt<<13|bt>>>32-13,bt=Ot+Jt|0,re^=bt<<18|bt>>>32-18,bt=Ye+me|0,le^=bt<<7|bt>>>32-7,bt=le+Ye|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+le|0,me^=bt<<13|bt>>>32-13,bt=me+Nt|0,Ye^=bt<<18|bt>>>32-18,bt=Kt+le|0,oe^=bt<<7|bt>>>32-7,bt=oe+Kt|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+oe|0,le^=bt<<13|bt>>>32-13,bt=le+Jt|0,Kt^=bt<<18|bt>>>32-18,bt=ne+ae|0,Ot^=bt<<7|bt>>>32-7,bt=Ot+ne|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+Ot|0,ae^=bt<<13|bt>>>32-13,bt=ae+Nt|0,ne^=bt<<18|bt>>>32-18,bt=re+ee|0,me^=bt<<7|bt>>>32-7,bt=me+re|0,he^=bt<<9|bt>>>32-9,bt=he+me|0,ee^=bt<<13|bt>>>32-13,bt=ee+he|0,re^=bt<<18|bt>>>32-18,bt=Ye+Xe|0,Fe^=bt<<7|bt>>>32-7,bt=Fe+Ye|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+Fe|0,Xe^=bt<<13|bt>>>32-13,bt=Xe+Ge|0,Ye^=bt<<18|bt>>>32-18;Kt=Kt+W|0,oe=oe+et|0,Jt=Jt+dt|0,le=le+ut|0,ae=ae+ht|0,ne=ne+zt|0,Ot=Ot+Wt|0,Nt=Nt+ye|0,he=he+Yt|0,ee=ee+pe|0,re=re+ve|0,me=me+ge|0,Fe=Fe+ie|0,Ge=Ge+ue|0,Xe=Xe+fe|0,Ye=Ye+ce|0,K[0]=Kt>>>0&255,K[1]=Kt>>>8&255,K[2]=Kt>>>16&255,K[3]=Kt>>>24&255,K[4]=oe>>>0&255,K[5]=oe>>>8&255,K[6]=oe>>>16&255,K[7]=oe>>>24&255,K[8]=Jt>>>0&255,K[9]=Jt>>>8&255,K[10]=Jt>>>16&255,K[11]=Jt>>>24&255,K[12]=le>>>0&255,K[13]=le>>>8&255,K[14]=le>>>16&255,K[15]=le>>>24&255,K[16]=ae>>>0&255,K[17]=ae>>>8&255,K[18]=ae>>>16&255,K[19]=ae>>>24&255,K[20]=ne>>>0&255,K[21]=ne>>>8&255,K[22]=ne>>>16&255,K[23]=ne>>>24&255,K[24]=Ot>>>0&255,K[25]=Ot>>>8&255,K[26]=Ot>>>16&255,K[27]=Ot>>>24&255,K[28]=Nt>>>0&255,K[29]=Nt>>>8&255,K[30]=Nt>>>16&255,K[31]=Nt>>>24&255,K[32]=he>>>0&255,K[33]=he>>>8&255,K[34]=he>>>16&255,K[35]=he>>>24&255,K[36]=ee>>>0&255,K[37]=ee>>>8&255,K[38]=ee>>>16&255,K[39]=ee>>>24&255,K[40]=re>>>0&255,K[41]=re>>>8&255,K[42]=re>>>16&255,K[43]=re>>>24&255,K[44]=me>>>0&255,K[45]=me>>>8&255,K[46]=me>>>16&255,K[47]=me>>>24&255,K[48]=Fe>>>0&255,K[49]=Fe>>>8&255,K[50]=Fe>>>16&255,K[51]=Fe>>>24&255,K[52]=Ge>>>0&255,K[53]=Ge>>>8&255,K[54]=Ge>>>16&255,K[55]=Ge>>>24&255,K[56]=Xe>>>0&255,K[57]=Xe>>>8&255,K[58]=Xe>>>16&255,K[59]=Xe>>>24&255,K[60]=Ye>>>0&255,K[61]=Ye>>>8&255,K[62]=Ye>>>16&255,K[63]=Ye>>>24&255}function C(K,Y,V,U){for(var W=U[0]&255|(U[1]&255)<<8|(U[2]&255)<<16|(U[3]&255)<<24,et=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,dt=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ut=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,ht=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,zt=U[4]&255|(U[5]&255)<<8|(U[6]&255)<<16|(U[7]&255)<<24,Wt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,ye=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,Yt=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,pe=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,ve=U[8]&255|(U[9]&255)<<8|(U[10]&255)<<16|(U[11]&255)<<24,ge=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,ie=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,ue=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,fe=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ce=U[12]&255|(U[13]&255)<<8|(U[14]&255)<<16|(U[15]&255)<<24,Kt=W,oe=et,Jt=dt,le=ut,ae=ht,ne=zt,Ot=Wt,Nt=ye,he=Yt,ee=pe,re=ve,me=ge,Fe=ie,Ge=ue,Xe=fe,Ye=ce,bt,ir=0;ir<20;ir+=2)bt=Kt+Fe|0,ae^=bt<<7|bt>>>32-7,bt=ae+Kt|0,he^=bt<<9|bt>>>32-9,bt=he+ae|0,Fe^=bt<<13|bt>>>32-13,bt=Fe+he|0,Kt^=bt<<18|bt>>>32-18,bt=ne+oe|0,ee^=bt<<7|bt>>>32-7,bt=ee+ne|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+ee|0,oe^=bt<<13|bt>>>32-13,bt=oe+Ge|0,ne^=bt<<18|bt>>>32-18,bt=re+Ot|0,Xe^=bt<<7|bt>>>32-7,bt=Xe+re|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+Xe|0,Ot^=bt<<13|bt>>>32-13,bt=Ot+Jt|0,re^=bt<<18|bt>>>32-18,bt=Ye+me|0,le^=bt<<7|bt>>>32-7,bt=le+Ye|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+le|0,me^=bt<<13|bt>>>32-13,bt=me+Nt|0,Ye^=bt<<18|bt>>>32-18,bt=Kt+le|0,oe^=bt<<7|bt>>>32-7,bt=oe+Kt|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+oe|0,le^=bt<<13|bt>>>32-13,bt=le+Jt|0,Kt^=bt<<18|bt>>>32-18,bt=ne+ae|0,Ot^=bt<<7|bt>>>32-7,bt=Ot+ne|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+Ot|0,ae^=bt<<13|bt>>>32-13,bt=ae+Nt|0,ne^=bt<<18|bt>>>32-18,bt=re+ee|0,me^=bt<<7|bt>>>32-7,bt=me+re|0,he^=bt<<9|bt>>>32-9,bt=he+me|0,ee^=bt<<13|bt>>>32-13,bt=ee+he|0,re^=bt<<18|bt>>>32-18,bt=Ye+Xe|0,Fe^=bt<<7|bt>>>32-7,bt=Fe+Ye|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+Fe|0,Xe^=bt<<13|bt>>>32-13,bt=Xe+Ge|0,Ye^=bt<<18|bt>>>32-18;K[0]=Kt>>>0&255,K[1]=Kt>>>8&255,K[2]=Kt>>>16&255,K[3]=Kt>>>24&255,K[4]=ne>>>0&255,K[5]=ne>>>8&255,K[6]=ne>>>16&255,K[7]=ne>>>24&255,K[8]=re>>>0&255,K[9]=re>>>8&255,K[10]=re>>>16&255,K[11]=re>>>24&255,K[12]=Ye>>>0&255,K[13]=Ye>>>8&255,K[14]=Ye>>>16&255,K[15]=Ye>>>24&255,K[16]=Ot>>>0&255,K[17]=Ot>>>8&255,K[18]=Ot>>>16&255,K[19]=Ot>>>24&255,K[20]=Nt>>>0&255,K[21]=Nt>>>8&255,K[22]=Nt>>>16&255,K[23]=Nt>>>24&255,K[24]=he>>>0&255,K[25]=he>>>8&255,K[26]=he>>>16&255,K[27]=he>>>24&255,K[28]=ee>>>0&255,K[29]=ee>>>8&255,K[30]=ee>>>16&255,K[31]=ee>>>24&255}function O(K,Y,V,U){R(K,Y,V,U)}function z(K,Y,V,U){C(K,Y,V,U)}var H=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function tt(K,Y,V,U,W,et,dt){var ut=new Uint8Array(16),ht=new Uint8Array(64),zt,Wt;for(Wt=0;Wt<16;Wt++)ut[Wt]=0;for(Wt=0;Wt<8;Wt++)ut[Wt]=et[Wt];for(;W>=64;){for(O(ht,ut,dt,H),Wt=0;Wt<64;Wt++)K[Y+Wt]=V[U+Wt]^ht[Wt];for(zt=1,Wt=8;Wt<16;Wt++)zt=zt+(ut[Wt]&255)|0,ut[Wt]=zt&255,zt>>>=8;W-=64,Y+=64,U+=64}if(W>0)for(O(ht,ut,dt,H),Wt=0;Wt=64;){for(O(dt,et,W,H),ht=0;ht<64;ht++)K[Y+ht]=dt[ht];for(ut=1,ht=8;ht<16;ht++)ut=ut+(et[ht]&255)|0,et[ht]=ut&255,ut>>>=8;V-=64,Y+=64}if(V>0)for(O(dt,et,W,H),ht=0;ht>>13|V<<3)&8191,U=K[4]&255|(K[5]&255)<<8,this.r[2]=(V>>>10|U<<6)&7939,W=K[6]&255|(K[7]&255)<<8,this.r[3]=(U>>>7|W<<9)&8191,et=K[8]&255|(K[9]&255)<<8,this.r[4]=(W>>>4|et<<12)&255,this.r[5]=et>>>1&8190,dt=K[10]&255|(K[11]&255)<<8,this.r[6]=(et>>>14|dt<<2)&8191,ut=K[12]&255|(K[13]&255)<<8,this.r[7]=(dt>>>11|ut<<5)&8065,ht=K[14]&255|(K[15]&255)<<8,this.r[8]=(ut>>>8|ht<<8)&8191,this.r[9]=ht>>>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};d.prototype.blocks=function(K,Y,V){for(var U=this.fin?0:2048,W,et,dt,ut,ht,zt,Wt,ye,Yt,pe,ve,ge,ie,ue,fe,ce,Kt,oe,Jt,le=this.h[0],ae=this.h[1],ne=this.h[2],Ot=this.h[3],Nt=this.h[4],he=this.h[5],ee=this.h[6],re=this.h[7],me=this.h[8],Fe=this.h[9],Ge=this.r[0],Xe=this.r[1],Ye=this.r[2],bt=this.r[3],ir=this.r[4],mr=this.r[5],vr=this.r[6],Qe=this.r[7],dr=this.r[8],pr=this.r[9];V>=16;)W=K[Y+0]&255|(K[Y+1]&255)<<8,le+=W&8191,et=K[Y+2]&255|(K[Y+3]&255)<<8,ae+=(W>>>13|et<<3)&8191,dt=K[Y+4]&255|(K[Y+5]&255)<<8,ne+=(et>>>10|dt<<6)&8191,ut=K[Y+6]&255|(K[Y+7]&255)<<8,Ot+=(dt>>>7|ut<<9)&8191,ht=K[Y+8]&255|(K[Y+9]&255)<<8,Nt+=(ut>>>4|ht<<12)&8191,he+=ht>>>1&8191,zt=K[Y+10]&255|(K[Y+11]&255)<<8,ee+=(ht>>>14|zt<<2)&8191,Wt=K[Y+12]&255|(K[Y+13]&255)<<8,re+=(zt>>>11|Wt<<5)&8191,ye=K[Y+14]&255|(K[Y+15]&255)<<8,me+=(Wt>>>8|ye<<8)&8191,Fe+=ye>>>5|U,Yt=0,pe=Yt,pe+=le*Ge,pe+=ae*(5*pr),pe+=ne*(5*dr),pe+=Ot*(5*Qe),pe+=Nt*(5*vr),Yt=pe>>>13,pe&=8191,pe+=he*(5*mr),pe+=ee*(5*ir),pe+=re*(5*bt),pe+=me*(5*Ye),pe+=Fe*(5*Xe),Yt+=pe>>>13,pe&=8191,ve=Yt,ve+=le*Xe,ve+=ae*Ge,ve+=ne*(5*pr),ve+=Ot*(5*dr),ve+=Nt*(5*Qe),Yt=ve>>>13,ve&=8191,ve+=he*(5*vr),ve+=ee*(5*mr),ve+=re*(5*ir),ve+=me*(5*bt),ve+=Fe*(5*Ye),Yt+=ve>>>13,ve&=8191,ge=Yt,ge+=le*Ye,ge+=ae*Xe,ge+=ne*Ge,ge+=Ot*(5*pr),ge+=Nt*(5*dr),Yt=ge>>>13,ge&=8191,ge+=he*(5*Qe),ge+=ee*(5*vr),ge+=re*(5*mr),ge+=me*(5*ir),ge+=Fe*(5*bt),Yt+=ge>>>13,ge&=8191,ie=Yt,ie+=le*bt,ie+=ae*Ye,ie+=ne*Xe,ie+=Ot*Ge,ie+=Nt*(5*pr),Yt=ie>>>13,ie&=8191,ie+=he*(5*dr),ie+=ee*(5*Qe),ie+=re*(5*vr),ie+=me*(5*mr),ie+=Fe*(5*ir),Yt+=ie>>>13,ie&=8191,ue=Yt,ue+=le*ir,ue+=ae*bt,ue+=ne*Ye,ue+=Ot*Xe,ue+=Nt*Ge,Yt=ue>>>13,ue&=8191,ue+=he*(5*pr),ue+=ee*(5*dr),ue+=re*(5*Qe),ue+=me*(5*vr),ue+=Fe*(5*mr),Yt+=ue>>>13,ue&=8191,fe=Yt,fe+=le*mr,fe+=ae*ir,fe+=ne*bt,fe+=Ot*Ye,fe+=Nt*Xe,Yt=fe>>>13,fe&=8191,fe+=he*Ge,fe+=ee*(5*pr),fe+=re*(5*dr),fe+=me*(5*Qe),fe+=Fe*(5*vr),Yt+=fe>>>13,fe&=8191,ce=Yt,ce+=le*vr,ce+=ae*mr,ce+=ne*ir,ce+=Ot*bt,ce+=Nt*Ye,Yt=ce>>>13,ce&=8191,ce+=he*Xe,ce+=ee*Ge,ce+=re*(5*pr),ce+=me*(5*dr),ce+=Fe*(5*Qe),Yt+=ce>>>13,ce&=8191,Kt=Yt,Kt+=le*Qe,Kt+=ae*vr,Kt+=ne*mr,Kt+=Ot*ir,Kt+=Nt*bt,Yt=Kt>>>13,Kt&=8191,Kt+=he*Ye,Kt+=ee*Xe,Kt+=re*Ge,Kt+=me*(5*pr),Kt+=Fe*(5*dr),Yt+=Kt>>>13,Kt&=8191,oe=Yt,oe+=le*dr,oe+=ae*Qe,oe+=ne*vr,oe+=Ot*mr,oe+=Nt*ir,Yt=oe>>>13,oe&=8191,oe+=he*bt,oe+=ee*Ye,oe+=re*Xe,oe+=me*Ge,oe+=Fe*(5*pr),Yt+=oe>>>13,oe&=8191,Jt=Yt,Jt+=le*pr,Jt+=ae*dr,Jt+=ne*Qe,Jt+=Ot*vr,Jt+=Nt*mr,Yt=Jt>>>13,Jt&=8191,Jt+=he*ir,Jt+=ee*bt,Jt+=re*Ye,Jt+=me*Xe,Jt+=Fe*Ge,Yt+=Jt>>>13,Jt&=8191,Yt=(Yt<<2)+Yt|0,Yt=Yt+pe|0,pe=Yt&8191,Yt=Yt>>>13,ve+=Yt,le=pe,ae=ve,ne=ge,Ot=ie,Nt=ue,he=fe,ee=ce,re=Kt,me=oe,Fe=Jt,Y+=16,V-=16;this.h[0]=le,this.h[1]=ae,this.h[2]=ne,this.h[3]=Ot,this.h[4]=Nt,this.h[5]=he,this.h[6]=ee,this.h[7]=re,this.h[8]=me,this.h[9]=Fe},d.prototype.finish=function(K,Y){var V=new Uint16Array(10),U,W,et,dt;if(this.leftover){for(dt=this.leftover,this.buffer[dt++]=1;dt<16;dt++)this.buffer[dt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(U=this.h[1]>>>13,this.h[1]&=8191,dt=2;dt<10;dt++)this.h[dt]+=U,U=this.h[dt]>>>13,this.h[dt]&=8191;for(this.h[0]+=U*5,U=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=U,U=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=U,V[0]=this.h[0]+5,U=V[0]>>>13,V[0]&=8191,dt=1;dt<10;dt++)V[dt]=this.h[dt]+U,U=V[dt]>>>13,V[dt]&=8191;for(V[9]-=8192,W=(U^1)-1,dt=0;dt<10;dt++)V[dt]&=W;for(W=~W,dt=0;dt<10;dt++)this.h[dt]=this.h[dt]&W|V[dt];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,et=this.h[0]+this.pad[0],this.h[0]=et&65535,dt=1;dt<8;dt++)et=(this.h[dt]+this.pad[dt]|0)+(et>>>16)|0,this.h[dt]=et&65535;K[Y+0]=this.h[0]>>>0&255,K[Y+1]=this.h[0]>>>8&255,K[Y+2]=this.h[1]>>>0&255,K[Y+3]=this.h[1]>>>8&255,K[Y+4]=this.h[2]>>>0&255,K[Y+5]=this.h[2]>>>8&255,K[Y+6]=this.h[3]>>>0&255,K[Y+7]=this.h[3]>>>8&255,K[Y+8]=this.h[4]>>>0&255,K[Y+9]=this.h[4]>>>8&255,K[Y+10]=this.h[5]>>>0&255,K[Y+11]=this.h[5]>>>8&255,K[Y+12]=this.h[6]>>>0&255,K[Y+13]=this.h[6]>>>8&255,K[Y+14]=this.h[7]>>>0&255,K[Y+15]=this.h[7]>>>8&255},d.prototype.update=function(K,Y,V){var U,W;if(this.leftover){for(W=16-this.leftover,W>V&&(W=V),U=0;U=16&&(W=V-V%16,this.blocks(K,Y,W),Y+=W,V-=W),V){for(U=0;U>16&1),et[V-1]&=65535;et[15]=dt[15]-32767-(et[14]>>16&1),W=et[15]>>16&1,et[14]&=65535,I(dt,et,1-W)}for(V=0;V<16;V++)K[2*V]=dt[V]&255,K[2*V+1]=dt[V]>>8}function u(K,Y){var V=new Uint8Array(32),U=new Uint8Array(32);return y(V,K),y(U,Y),P(V,0,U,0)}function b(K){var Y=new Uint8Array(32);return y(Y,K),Y[0]&1}function D(K,Y){var V;for(V=0;V<16;V++)K[V]=Y[2*V]+(Y[2*V+1]<<8);K[15]&=32767}function Z(K,Y,V){for(var U=0;U<16;U++)K[U]=Y[U]+V[U]}function F(K,Y,V){for(var U=0;U<16;U++)K[U]=Y[U]-V[U]}function q(K,Y,V){var U,W,et=0,dt=0,ut=0,ht=0,zt=0,Wt=0,ye=0,Yt=0,pe=0,ve=0,ge=0,ie=0,ue=0,fe=0,ce=0,Kt=0,oe=0,Jt=0,le=0,ae=0,ne=0,Ot=0,Nt=0,he=0,ee=0,re=0,me=0,Fe=0,Ge=0,Xe=0,Ye=0,bt=V[0],ir=V[1],mr=V[2],vr=V[3],Qe=V[4],dr=V[5],pr=V[6],on=V[7],Pr=V[8],Yr=V[9],Xr=V[10],Jr=V[11],ln=V[12],Un=V[13],Nn=V[14],Dn=V[15];U=Y[0],et+=U*bt,dt+=U*ir,ut+=U*mr,ht+=U*vr,zt+=U*Qe,Wt+=U*dr,ye+=U*pr,Yt+=U*on,pe+=U*Pr,ve+=U*Yr,ge+=U*Xr,ie+=U*Jr,ue+=U*ln,fe+=U*Un,ce+=U*Nn,Kt+=U*Dn,U=Y[1],dt+=U*bt,ut+=U*ir,ht+=U*mr,zt+=U*vr,Wt+=U*Qe,ye+=U*dr,Yt+=U*pr,pe+=U*on,ve+=U*Pr,ge+=U*Yr,ie+=U*Xr,ue+=U*Jr,fe+=U*ln,ce+=U*Un,Kt+=U*Nn,oe+=U*Dn,U=Y[2],ut+=U*bt,ht+=U*ir,zt+=U*mr,Wt+=U*vr,ye+=U*Qe,Yt+=U*dr,pe+=U*pr,ve+=U*on,ge+=U*Pr,ie+=U*Yr,ue+=U*Xr,fe+=U*Jr,ce+=U*ln,Kt+=U*Un,oe+=U*Nn,Jt+=U*Dn,U=Y[3],ht+=U*bt,zt+=U*ir,Wt+=U*mr,ye+=U*vr,Yt+=U*Qe,pe+=U*dr,ve+=U*pr,ge+=U*on,ie+=U*Pr,ue+=U*Yr,fe+=U*Xr,ce+=U*Jr,Kt+=U*ln,oe+=U*Un,Jt+=U*Nn,le+=U*Dn,U=Y[4],zt+=U*bt,Wt+=U*ir,ye+=U*mr,Yt+=U*vr,pe+=U*Qe,ve+=U*dr,ge+=U*pr,ie+=U*on,ue+=U*Pr,fe+=U*Yr,ce+=U*Xr,Kt+=U*Jr,oe+=U*ln,Jt+=U*Un,le+=U*Nn,ae+=U*Dn,U=Y[5],Wt+=U*bt,ye+=U*ir,Yt+=U*mr,pe+=U*vr,ve+=U*Qe,ge+=U*dr,ie+=U*pr,ue+=U*on,fe+=U*Pr,ce+=U*Yr,Kt+=U*Xr,oe+=U*Jr,Jt+=U*ln,le+=U*Un,ae+=U*Nn,ne+=U*Dn,U=Y[6],ye+=U*bt,Yt+=U*ir,pe+=U*mr,ve+=U*vr,ge+=U*Qe,ie+=U*dr,ue+=U*pr,fe+=U*on,ce+=U*Pr,Kt+=U*Yr,oe+=U*Xr,Jt+=U*Jr,le+=U*ln,ae+=U*Un,ne+=U*Nn,Ot+=U*Dn,U=Y[7],Yt+=U*bt,pe+=U*ir,ve+=U*mr,ge+=U*vr,ie+=U*Qe,ue+=U*dr,fe+=U*pr,ce+=U*on,Kt+=U*Pr,oe+=U*Yr,Jt+=U*Xr,le+=U*Jr,ae+=U*ln,ne+=U*Un,Ot+=U*Nn,Nt+=U*Dn,U=Y[8],pe+=U*bt,ve+=U*ir,ge+=U*mr,ie+=U*vr,ue+=U*Qe,fe+=U*dr,ce+=U*pr,Kt+=U*on,oe+=U*Pr,Jt+=U*Yr,le+=U*Xr,ae+=U*Jr,ne+=U*ln,Ot+=U*Un,Nt+=U*Nn,he+=U*Dn,U=Y[9],ve+=U*bt,ge+=U*ir,ie+=U*mr,ue+=U*vr,fe+=U*Qe,ce+=U*dr,Kt+=U*pr,oe+=U*on,Jt+=U*Pr,le+=U*Yr,ae+=U*Xr,ne+=U*Jr,Ot+=U*ln,Nt+=U*Un,he+=U*Nn,ee+=U*Dn,U=Y[10],ge+=U*bt,ie+=U*ir,ue+=U*mr,fe+=U*vr,ce+=U*Qe,Kt+=U*dr,oe+=U*pr,Jt+=U*on,le+=U*Pr,ae+=U*Yr,ne+=U*Xr,Ot+=U*Jr,Nt+=U*ln,he+=U*Un,ee+=U*Nn,re+=U*Dn,U=Y[11],ie+=U*bt,ue+=U*ir,fe+=U*mr,ce+=U*vr,Kt+=U*Qe,oe+=U*dr,Jt+=U*pr,le+=U*on,ae+=U*Pr,ne+=U*Yr,Ot+=U*Xr,Nt+=U*Jr,he+=U*ln,ee+=U*Un,re+=U*Nn,me+=U*Dn,U=Y[12],ue+=U*bt,fe+=U*ir,ce+=U*mr,Kt+=U*vr,oe+=U*Qe,Jt+=U*dr,le+=U*pr,ae+=U*on,ne+=U*Pr,Ot+=U*Yr,Nt+=U*Xr,he+=U*Jr,ee+=U*ln,re+=U*Un,me+=U*Nn,Fe+=U*Dn,U=Y[13],fe+=U*bt,ce+=U*ir,Kt+=U*mr,oe+=U*vr,Jt+=U*Qe,le+=U*dr,ae+=U*pr,ne+=U*on,Ot+=U*Pr,Nt+=U*Yr,he+=U*Xr,ee+=U*Jr,re+=U*ln,me+=U*Un,Fe+=U*Nn,Ge+=U*Dn,U=Y[14],ce+=U*bt,Kt+=U*ir,oe+=U*mr,Jt+=U*vr,le+=U*Qe,ae+=U*dr,ne+=U*pr,Ot+=U*on,Nt+=U*Pr,he+=U*Yr,ee+=U*Xr,re+=U*Jr,me+=U*ln,Fe+=U*Un,Ge+=U*Nn,Xe+=U*Dn,U=Y[15],Kt+=U*bt,oe+=U*ir,Jt+=U*mr,le+=U*vr,ae+=U*Qe,ne+=U*dr,Ot+=U*pr,Nt+=U*on,he+=U*Pr,ee+=U*Yr,re+=U*Xr,me+=U*Jr,Fe+=U*ln,Ge+=U*Un,Xe+=U*Nn,Ye+=U*Dn,et+=38*oe,dt+=38*Jt,ut+=38*le,ht+=38*ae,zt+=38*ne,Wt+=38*Ot,ye+=38*Nt,Yt+=38*he,pe+=38*ee,ve+=38*re,ge+=38*me,ie+=38*Fe,ue+=38*Ge,fe+=38*Xe,ce+=38*Ye,W=1,U=et+W+65535,W=Math.floor(U/65536),et=U-W*65536,U=dt+W+65535,W=Math.floor(U/65536),dt=U-W*65536,U=ut+W+65535,W=Math.floor(U/65536),ut=U-W*65536,U=ht+W+65535,W=Math.floor(U/65536),ht=U-W*65536,U=zt+W+65535,W=Math.floor(U/65536),zt=U-W*65536,U=Wt+W+65535,W=Math.floor(U/65536),Wt=U-W*65536,U=ye+W+65535,W=Math.floor(U/65536),ye=U-W*65536,U=Yt+W+65535,W=Math.floor(U/65536),Yt=U-W*65536,U=pe+W+65535,W=Math.floor(U/65536),pe=U-W*65536,U=ve+W+65535,W=Math.floor(U/65536),ve=U-W*65536,U=ge+W+65535,W=Math.floor(U/65536),ge=U-W*65536,U=ie+W+65535,W=Math.floor(U/65536),ie=U-W*65536,U=ue+W+65535,W=Math.floor(U/65536),ue=U-W*65536,U=fe+W+65535,W=Math.floor(U/65536),fe=U-W*65536,U=ce+W+65535,W=Math.floor(U/65536),ce=U-W*65536,U=Kt+W+65535,W=Math.floor(U/65536),Kt=U-W*65536,et+=W-1+37*(W-1),W=1,U=et+W+65535,W=Math.floor(U/65536),et=U-W*65536,U=dt+W+65535,W=Math.floor(U/65536),dt=U-W*65536,U=ut+W+65535,W=Math.floor(U/65536),ut=U-W*65536,U=ht+W+65535,W=Math.floor(U/65536),ht=U-W*65536,U=zt+W+65535,W=Math.floor(U/65536),zt=U-W*65536,U=Wt+W+65535,W=Math.floor(U/65536),Wt=U-W*65536,U=ye+W+65535,W=Math.floor(U/65536),ye=U-W*65536,U=Yt+W+65535,W=Math.floor(U/65536),Yt=U-W*65536,U=pe+W+65535,W=Math.floor(U/65536),pe=U-W*65536,U=ve+W+65535,W=Math.floor(U/65536),ve=U-W*65536,U=ge+W+65535,W=Math.floor(U/65536),ge=U-W*65536,U=ie+W+65535,W=Math.floor(U/65536),ie=U-W*65536,U=ue+W+65535,W=Math.floor(U/65536),ue=U-W*65536,U=fe+W+65535,W=Math.floor(U/65536),fe=U-W*65536,U=ce+W+65535,W=Math.floor(U/65536),ce=U-W*65536,U=Kt+W+65535,W=Math.floor(U/65536),Kt=U-W*65536,et+=W-1+37*(W-1),K[0]=et,K[1]=dt,K[2]=ut,K[3]=ht,K[4]=zt,K[5]=Wt,K[6]=ye,K[7]=Yt,K[8]=pe,K[9]=ve,K[10]=ge,K[11]=ie,K[12]=ue,K[13]=fe,K[14]=ce,K[15]=Kt}function it(K,Y){q(K,Y,Y)}function at(K,Y){var V=e(),U;for(U=0;U<16;U++)V[U]=Y[U];for(U=253;U>=0;U--)it(V,V),U!==2&&U!==4&&q(V,V,Y);for(U=0;U<16;U++)K[U]=V[U]}function Bt(K,Y){var V=e(),U;for(U=0;U<16;U++)V[U]=Y[U];for(U=250;U>=0;U--)it(V,V),U!==1&&q(V,V,Y);for(U=0;U<16;U++)K[U]=V[U]}function yt(K,Y,V){var U=new Uint8Array(32),W=new Float64Array(80),et,dt,ut=e(),ht=e(),zt=e(),Wt=e(),ye=e(),Yt=e();for(dt=0;dt<31;dt++)U[dt]=Y[dt];for(U[31]=Y[31]&127|64,U[0]&=248,D(W,V),dt=0;dt<16;dt++)ht[dt]=W[dt],Wt[dt]=ut[dt]=zt[dt]=0;for(ut[0]=Wt[0]=1,dt=254;dt>=0;--dt)et=U[dt>>>3]>>>(dt&7)&1,I(ut,ht,et),I(zt,Wt,et),Z(ye,ut,zt),F(ut,ut,zt),Z(zt,ht,Wt),F(ht,ht,Wt),it(Wt,ye),it(Yt,ut),q(ut,zt,ut),q(zt,ht,ye),Z(ye,ut,zt),F(ut,ut,zt),it(ht,ut),F(zt,Wt,Yt),q(ut,zt,p),Z(ut,ut,Wt),q(zt,zt,ut),q(ut,Wt,Yt),q(Wt,ht,W),it(ht,ye),I(ut,ht,et),I(zt,Wt,et);for(dt=0;dt<16;dt++)W[dt+16]=ut[dt],W[dt+32]=zt[dt],W[dt+48]=ht[dt],W[dt+64]=Wt[dt];var pe=W.subarray(32),ve=W.subarray(16);return at(pe,pe),q(ve,ve,pe),y(K,ve),0}function pt(K,Y){return yt(K,Y,i)}function Ft(K,Y){return n(Y,32),pt(K,Y)}function lt(K,Y,V){var U=new Uint8Array(32);return yt(U,V,Y),z(K,s,U,H)}var ct=f,Tt=h;function kt(K,Y,V,U,W,et){var dt=new Uint8Array(32);return lt(dt,W,et),ct(K,Y,V,U,dt)}function k(K,Y,V,U,W,et){var dt=new Uint8Array(32);return lt(dt,W,et),Tt(K,Y,V,U,dt)}var T=[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 L(K,Y,V,U){for(var W=new Int32Array(16),et=new Int32Array(16),dt,ut,ht,zt,Wt,ye,Yt,pe,ve,ge,ie,ue,fe,ce,Kt,oe,Jt,le,ae,ne,Ot,Nt,he,ee,re,me,Fe=K[0],Ge=K[1],Xe=K[2],Ye=K[3],bt=K[4],ir=K[5],mr=K[6],vr=K[7],Qe=Y[0],dr=Y[1],pr=Y[2],on=Y[3],Pr=Y[4],Yr=Y[5],Xr=Y[6],Jr=Y[7],ln=0;U>=128;){for(ae=0;ae<16;ae++)ne=8*ae+ln,W[ae]=V[ne+0]<<24|V[ne+1]<<16|V[ne+2]<<8|V[ne+3],et[ae]=V[ne+4]<<24|V[ne+5]<<16|V[ne+6]<<8|V[ne+7];for(ae=0;ae<80;ae++)if(dt=Fe,ut=Ge,ht=Xe,zt=Ye,Wt=bt,ye=ir,Yt=mr,pe=vr,ve=Qe,ge=dr,ie=pr,ue=on,fe=Pr,ce=Yr,Kt=Xr,oe=Jr,Ot=vr,Nt=Jr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=(bt>>>14|Pr<<32-14)^(bt>>>18|Pr<<32-18)^(Pr>>>41-32|bt<<32-(41-32)),Nt=(Pr>>>14|bt<<32-14)^(Pr>>>18|bt<<32-18)^(bt>>>41-32|Pr<<32-(41-32)),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=bt&ir^~bt&mr,Nt=Pr&Yr^~Pr&Xr,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=T[ae*2],Nt=T[ae*2+1],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=W[ae%16],Nt=et[ae%16],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,Jt=re&65535|me<<16,le=he&65535|ee<<16,Ot=Jt,Nt=le,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=(Fe>>>28|Qe<<32-28)^(Qe>>>34-32|Fe<<32-(34-32))^(Qe>>>39-32|Fe<<32-(39-32)),Nt=(Qe>>>28|Fe<<32-28)^(Fe>>>34-32|Qe<<32-(34-32))^(Fe>>>39-32|Qe<<32-(39-32)),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=Fe&Ge^Fe&Xe^Ge&Xe,Nt=Qe&dr^Qe&pr^dr&pr,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,pe=re&65535|me<<16,oe=he&65535|ee<<16,Ot=zt,Nt=ue,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=Jt,Nt=le,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,zt=re&65535|me<<16,ue=he&65535|ee<<16,Ge=dt,Xe=ut,Ye=ht,bt=zt,ir=Wt,mr=ye,vr=Yt,Fe=pe,dr=ve,pr=ge,on=ie,Pr=ue,Yr=fe,Xr=ce,Jr=Kt,Qe=oe,ae%16===15)for(ne=0;ne<16;ne++)Ot=W[ne],Nt=et[ne],he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=W[(ne+9)%16],Nt=et[(ne+9)%16],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Jt=W[(ne+1)%16],le=et[(ne+1)%16],Ot=(Jt>>>1|le<<32-1)^(Jt>>>8|le<<32-8)^Jt>>>7,Nt=(le>>>1|Jt<<32-1)^(le>>>8|Jt<<32-8)^(le>>>7|Jt<<32-7),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Jt=W[(ne+14)%16],le=et[(ne+14)%16],Ot=(Jt>>>19|le<<32-19)^(le>>>61-32|Jt<<32-(61-32))^Jt>>>6,Nt=(le>>>19|Jt<<32-19)^(Jt>>>61-32|le<<32-(61-32))^(le>>>6|Jt<<32-6),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,W[ne]=re&65535|me<<16,et[ne]=he&65535|ee<<16;Ot=Fe,Nt=Qe,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[0],Nt=Y[0],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[0]=Fe=re&65535|me<<16,Y[0]=Qe=he&65535|ee<<16,Ot=Ge,Nt=dr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[1],Nt=Y[1],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[1]=Ge=re&65535|me<<16,Y[1]=dr=he&65535|ee<<16,Ot=Xe,Nt=pr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[2],Nt=Y[2],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[2]=Xe=re&65535|me<<16,Y[2]=pr=he&65535|ee<<16,Ot=Ye,Nt=on,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[3],Nt=Y[3],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[3]=Ye=re&65535|me<<16,Y[3]=on=he&65535|ee<<16,Ot=bt,Nt=Pr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[4],Nt=Y[4],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[4]=bt=re&65535|me<<16,Y[4]=Pr=he&65535|ee<<16,Ot=ir,Nt=Yr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[5],Nt=Y[5],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[5]=ir=re&65535|me<<16,Y[5]=Yr=he&65535|ee<<16,Ot=mr,Nt=Xr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[6],Nt=Y[6],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[6]=mr=re&65535|me<<16,Y[6]=Xr=he&65535|ee<<16,Ot=vr,Nt=Jr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[7],Nt=Y[7],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[7]=vr=re&65535|me<<16,Y[7]=Jr=he&65535|ee<<16,ln+=128,U-=128}return U}function j(K,Y,V){var U=new Int32Array(8),W=new Int32Array(8),et=new Uint8Array(256),dt,ut=V;for(U[0]=1779033703,U[1]=3144134277,U[2]=1013904242,U[3]=2773480762,U[4]=1359893119,U[5]=2600822924,U[6]=528734635,U[7]=1541459225,W[0]=4089235720,W[1]=2227873595,W[2]=4271175723,W[3]=1595750129,W[4]=2917565137,W[5]=725511199,W[6]=4215389547,W[7]=327033209,L(U,W,Y,V),V%=128,dt=0;dt=0;--W)U=V[W/8|0]>>(W&7)&1,Q(K,Y,U),rt(Y,K),rt(K,K),Q(K,Y,U)}function It(K,Y){var V=[e(),e(),e(),e()];g(V[0],_),g(V[1],E),g(V[2],l),q(V[3],_,E),qt(K,V,Y)}function xt(K,Y,V){var U=new Uint8Array(64),W=[e(),e(),e(),e()],et;for(V||n(Y,32),j(U,Y,32),U[0]&=248,U[31]&=127,U[31]|=64,It(W,U),ot(K,W),et=0;et<32;et++)Y[et+32]=K[et];return 0}var Qt=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 Ct(K,Y){var V,U,W,et;for(U=63;U>=32;--U){for(V=0,W=U-32,et=U-12;W>4)*Qt[W],V=Y[W]>>8,Y[W]&=255;for(W=0;W<32;W++)Y[W]-=V*Qt[W];for(U=0;U<32;U++)Y[U+1]+=Y[U]>>8,K[U]=Y[U]&255}function Dt(K){var Y=new Float64Array(64),V;for(V=0;V<64;V++)Y[V]=K[V];for(V=0;V<64;V++)K[V]=0;Ct(K,Y)}function Se(K,Y,V,U){var W=new Uint8Array(64),et=new Uint8Array(64),dt=new Uint8Array(64),ut,ht,zt=new Float64Array(64),Wt=[e(),e(),e(),e()];j(W,U,32),W[0]&=248,W[31]&=127,W[31]|=64;var ye=V+64;for(ut=0;ut>7&&F(K[0],c,K[0]),q(K[3],K[0],K[1]),0)}function Ut(K,Y,V,U){var W,et=new Uint8Array(32),dt=new Uint8Array(64),ut=[e(),e(),e(),e()],ht=[e(),e(),e(),e()];if(V<64||te(ht,U))return-1;for(W=0;W=0},t.sign.keyPair=function(){var K=new Uint8Array(Rt),Y=new Uint8Array(wt);return xt(K,Y),{publicKey:K,secretKey:Y}},t.sign.keyPair.fromSecretKey=function(K){if(Pt(K),K.length!==wt)throw new Error("bad secret key size");for(var Y=new Uint8Array(Rt),V=0;V=0;)B++;if(x.substr(0,2)==="::"&&B--,x.substr(-2,2)==="::"&&B--,B>A)return null;for(O=A-B,C=":";O--;)C+="0:";return x=x.replace("::",C),x[0]===":"&&(x=x.slice(1)),x[x.length-1]===":"&&(x=x.slice(0,-1)),A=function(){const z=x.split(":"),H=[];for(let tt=0;tt0;){if(C=B-P,C<0&&(C=0),x[R]>>C!==A[R]>>C)return!1;P-=B,R+=1}return!0}function _(x){if(i.test(x))return parseInt(x,16);if(x[0]==="0"&&!isNaN(parseInt(x[1],10))){if(s.test(x))return parseInt(x,8);throw new Error(`ipaddr: cannot parse ${x} as octal`)}return parseInt(x,10)}function E(x,A){for(;x.length=0;R-=1)if(C=this.octets[R],C in P){if(O=P[C],B&&O!==0)return null;O!==8&&(B=!0),A+=O}else return null;return 32-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){return this.octets.slice(0)},x.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},x.prototype.toNormalizedString=function(){return this.toString()},x.prototype.toString=function(){return this.octets.join(".")},x}(),w.IPv4.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<4;)R.push(parseInt(B[C],10)|parseInt(P[C],10)^255),C++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(x){return this.parser(x)!==null},w.IPv4.isValid=function(x){try{return new this(this.parser(x)),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(x){return!!(w.IPv4.isValid(x)&&x.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(x){const A=this.parser(x);if(A===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(A)},w.IPv4.parseCIDR=function(x){let A;if(A=x.match(/^(.+)\/(\d+)$/)){const B=parseInt(A[2]);if(B>=0&&B<=32){const P=[this.parse(A[1]),B];return Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(x){let A,B,P;if(A=x.match(n.fourOctet))return function(){const R=A.slice(1,6),C=[];for(let O=0;O4294967295||P<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let C;for(C=0;C<=24;C+=8)R.push(P>>C&255);return R}().reverse()}else return(A=x.match(n.twoOctet))?function(){const R=A.slice(1,4),C=[];if(P=_(R[1]),P>16777215||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(P>>16&255),C.push(P>>8&255),C.push(P&255),C}():(A=x.match(n.threeOctet))?function(){const R=A.slice(1,5),C=[];if(P=_(R[2]),P>65535||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(_(R[1])),C.push(P>>8&255),C.push(P&255),C}():null},w.IPv4.subnetMaskFromPrefixLength=function(x){if(x=parseInt(x),x<0||x>32)throw new Error("ipaddr: invalid IPv4 prefix length");const A=[0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B=0;O-=1)if(R=this.parts[O],R in P){if(C=P[R],B&&C!==0)return null;C!==16&&(B=!0),A+=C}else return null;return 128-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){let A;const B=[],P=this.parts;for(let R=0;R>8),B.push(A&255);return B},x.prototype.toFixedLengthString=function(){const A=(function(){const P=[];for(let R=0;R>8,B&255,P>>8,P&255])},x.prototype.toNormalizedString=function(){const A=(function(){const P=[];for(let R=0;RR&&(P=C.index,R=C[0].length);return R<0?B:`${B.substring(0,P)}::${B.substring(P+R)}`},x.prototype.toString=function(){return this.toRFC5952String()},x}(),w.IPv6.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<16;)R.push(parseInt(B[C],10)|parseInt(P[C],10)^255),C++;return new this(R)}catch(A){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${A})`)}},w.IPv6.isIPv6=function(x){return this.parser(x)!==null},w.IPv6.isValid=function(x){if(typeof x=="string"&&x.indexOf(":")===-1)return!1;try{const A=this.parser(x);return new this(A.parts,A.zoneId),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch(O){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${O})`)}},w.IPv6.parse=function(x){const A=this.parser(x);if(A.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(A.parts,A.zoneId)},w.IPv6.parseCIDR=function(x){let A,B,P;if((B=x.match(/^(.+)\/(\d+)$/))&&(A=parseInt(B[2]),A>=0&&A<=128))return P=[this.parse(B[1]),A],Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(x){let A,B,P,R,C,O;if(P=x.match(p.deprecatedTransitional))return this.parser(`::ffff:${P[1]}`);if(p.native.test(x))return m(x,8);if((P=x.match(p.transitional))&&(O=P[6]||"",A=m(P[1].slice(0,-1)+O,6),A.parts)){for(C=[parseInt(P[2]),parseInt(P[3]),parseInt(P[4]),parseInt(P[5])],B=0;B128)throw new Error("ipaddr: invalid IPv6 prefix length");const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B{const t=nz+r,e=kT(yr.Buffer.from(t,"utf8")).slice(2);return yr.Buffer.from(e,"hex")},oz=(r,t,e)=>{const n=[r];t?n.push(t.toBuffer()):n.push(yr.Buffer.alloc(32)),e?n.push(e.toBuffer()):n.push(yr.Buffer.alloc(32));const[s]=Ne.findProgramAddressSync(n,rz);return s},vu=(r,t=$M)=>{let e=iz(r);return{pubkey:oz(e,void 0,t),hashed:e}},T2=(r,t=!1)=>{r.endsWith(".sol")&&(r=r.slice(0,-4));const e=r.split(".");if(e.length===2){const n=yr.Buffer.from([t?1:0]).toString().concat(e[0]),{pubkey:s}=vu(e[1]);return{...vu(n,s),isSub:!0,parent:s}}if(e.length===3&&t){const{pubkey:n}=vu(e[2]),{pubkey:s}=vu("\0".concat(e[1]),n),i=yr.Buffer.from([1]).toString();return{...vu(i.concat(e[0]),s),isSub:!0,parent:n,isSubRecord:!0}}if(e.length>=3)throw new ez(C2.InvalidInput);return{...vu(r,$M),isSub:!1,parent:void 0}};var as;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(as||(as={}));as.SOL,as.ETH,as.BSC,as.Injective,as.A,as.AAAA,as.Background;new Ne("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var Q3;(function(r){r.DegenPoet1="DegenPoet#1",r.Rgb0x001="rgb0x00#1"})(Q3||(Q3={}));new Ne("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");new Ne("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g");const sz=["-","_"],az=()=>{const r=Math.floor(2*Math.random());return sz[r]},HM=(r,t=4)=>{const e=[];for(let n=0;n{const e=t.map(s=>T2(s).pubkey),n=await(r==null?void 0:r.getMultipleAccountsInfo(e));return n?t.map((s,i)=>{var c;return{domain:s,available:!((c=n[i])!=null&&c.data)}}):[]},uz=({connection:r,domain:t})=>yg(async()=>{if(!t||!r)return[];const e=t.split(".");if(e.length===2){const n=e[1],s=T2(t).pubkey,i=await(r==null?void 0:r.getAccountInfo(s)),c=HM(n,10),l=await L2(r,c);if(i!=null&&i.data)return[{domain:t,available:!i.data},...l];{const p=T2(n).pubkey,m=await(r==null?void 0:r.getAccountInfo(p));return[{domain:n,available:!(m!=null&&m.data)},...l]}}return L2(r,[t])},[!!r,t]),fz=({connection:r,domain:t})=>yg(async()=>{if(!t||t==="")return[];if(t.split(".").length===2)return[];const e=await(await fetch(`https://sns-api.bonfida.com/v2/suggestion/search/${t}`)).json();if(!e||e.length<5){if(!r)return[];const n=HM(t,10);return L2(r,n)}return e.map(n=>({domain:n,available:!0}))},[t,!!r]),cz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.56 3.06a3.092 3.092 0 0 0-.56.206c-.266.13-.398.244-1.17 1.008l-.87.86.184.343c1.138 2.12 2.165 3.161 4.24 4.3l.476.261.823-.822c.478-.477.879-.913.955-1.039.337-.556.438-1.178.288-1.772-.149-.588-.273-.758-1.342-1.838-1.043-1.054-1.36-1.307-1.816-1.448a2.668 2.668 0 0 0-1.208-.059M9.873 9.233c-3.16 3.169-3.114 3.117-3.29 3.667-.068.213-.583 3.732-.583 3.986C6 17.435 6.565 18 7.114 18c.254 0 3.773-.515 3.986-.583.55-.176.498-.13 3.667-3.29l2.986-2.979-.478-.274c-1.888-1.082-3.003-2.19-4.104-4.081l-.319-.547-2.979 2.987M3.394 19.601c-.284.15-.426.445-.376.779.035.236.278.518.497.579.201.056 16.769.056 16.97 0 .219-.061.462-.343.497-.579.051-.339-.094-.633-.384-.781-.153-.078-.272-.079-8.606-.077-8.276.001-8.455.003-8.598.079"})),VM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M19.748 9.058a.75.75 0 0 0-1.496-.116l1.496.116Zm-1.464 9.249.748.057-.748-.057Zm-12.568 0-.748.057.748-.057Zm.032-9.365a.75.75 0 1 0-1.496.116l1.496-.116ZM20.67 7.674a.75.75 0 0 0 .658-1.348l-.658 1.348Zm-18-1.348a.75.75 0 1 0 .658 1.348L2.67 6.326ZM9.25 5a.75.75 0 0 0 1.5 0h-1.5Zm4 0a.75.75 0 0 0 1.5 0h-1.5Zm-2.5 6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.5-6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.002-8.058-.716 9.307 1.496.115.716-9.306-1.496-.116ZM14.296 21.25H9.704v1.5h4.592v-1.5Zm-7.832-3-.716-9.308-1.496.116.716 9.306 1.496-.115Zm3.24 3a3.25 3.25 0 0 1-3.24-3l-1.496.114a4.75 4.75 0 0 0 4.736 4.386v-1.5Zm7.832-3a3.25 3.25 0 0 1-3.24 3v1.5a4.75 4.75 0 0 0 4.736-4.386l-1.496-.115ZM12 5.75c3.204 0 6.18.71 8.671 1.924l.658-1.348C18.624 5.008 15.423 4.25 12 4.25v1.5ZM3.329 7.674C5.82 6.46 8.796 5.75 12 5.75v-1.5c-3.423 0-6.624.758-9.329 2.076l.658 1.348ZM10.75 5V4h-1.5v1h1.5Zm2.5-1v1h1.5V4h-1.5ZM12 2.75c.69 0 1.25.56 1.25 1.25h1.5A2.75 2.75 0 0 0 12 1.25v1.5ZM10.75 4c0-.69.56-1.25 1.25-1.25v-1.5A2.75 2.75 0 0 0 9.25 4h1.5Zm-1.5 7v6h1.5v-6h-1.5Zm4 0v6h1.5v-6h-1.5Z"})),ZM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M22 7a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v10a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V7Z"}),xe.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12a3 3 0 0 0-3-3H2v6h3a3 3 0 0 0 3-3Z"})),hz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M2.587 9.25a.75.75 0 1 0 0 1.5v-1.5Zm18.826 1.5a.75.75 0 0 0 0-1.5v1.5ZM18.035 6v.75V6Zm3.882 4.808.735.15-.735-.15Zm-19.834 0 .735-.15-.735.15ZM5.965 6v-.75V6ZM7.6 22v-.75.75Zm-3.882-3.192.735-.15-.735.15ZM16.4 22v.75V22Zm3.882-3.192-.735-.15.735.15ZM8 13.25a.75.75 0 0 0 0 1.5v-1.5Zm8 1.5a.75.75 0 0 0 0-1.5v1.5Zm-7 2.5a.75.75 0 0 0 0 1.5v-1.5Zm6 1.5a.75.75 0 0 0 0-1.5v1.5ZM9.6 2.45a.75.75 0 1 0-1.2-.9l1.2.9Zm-4.2 3.1a.75.75 0 1 0 1.2.9l-1.2-.9Zm10.2-4a.75.75 0 1 0-1.2.9l1.2-.9Zm1.8 4.9a.75.75 0 1 0 1.2-.9l-1.2.9Zm-1 14.8H7.6v1.5h8.8v-1.5ZM4.453 18.658l-1.635-8-1.47.3 1.635 8 1.47-.3ZM5.965 6.75h12.07v-1.5H5.965v1.5Zm15.217 3.908-1.635 8 1.47.3 1.635-8-1.47-.3Zm-18.595.092h18.826v-1.5H2.587v1.5Zm15.448-4c2.028 0 3.56 1.883 3.147 3.908l1.47.3c.6-2.938-1.623-5.708-4.617-5.708v1.5ZM2.818 10.658C2.404 8.633 3.938 6.75 5.965 6.75v-1.5c-2.994 0-5.217 2.77-4.617 5.708l1.47-.3ZM7.6 21.25a3.222 3.222 0 0 1-3.147-2.592l-1.47.3c.45 2.203 2.375 3.792 4.617 3.792v-1.5Zm8.8 1.5c2.242 0 4.167-1.589 4.617-3.792l-1.47-.3A3.223 3.223 0 0 1 16.4 21.25v1.5Zm-8.4-8h8v-1.5H8v1.5Zm1 4h6v-1.5H9v1.5Zm-.6-17.2-3 4 1.2.9 3-4-1.2-.9Zm6 .9 3 4 1.2-.9-3-4-1.2.9Z"})),lz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M5.469 12.414a.75.75 0 0 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM4.53 13.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),WM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.12 2.039c-2.479.248-4.706 1.323-6.359 3.068a9.985 9.985 0 0 0-1.624 11.516 9.432 9.432 0 0 0 1.801 2.438c.992.99 2.1 1.728 3.334 2.217 3.362 1.332 7.041.802 9.928-1.433.437-.338 1.307-1.208 1.645-1.645C21.256 16.378 22 14.236 22 12c0-4.568-3.158-8.613-7.57-9.697-.984-.241-2.402-.355-3.31-.264m1.285 5.342c.08.051.188.162.24.246.091.146.095.184.095.88v.726l-.121.172c-.166.236-.346.334-.619.334s-.453-.098-.619-.334l-.121-.172v-.726c0-.691.005-.734.093-.876.233-.375.691-.484 1.052-.25m-.113 3.433c.155.065.375.305.417.457.017.06.031 1.201.031 2.536v2.426l-.121.172c-.166.237-.346.334-.619.334s-.453-.097-.619-.334l-.121-.172v-2.426c0-1.335.014-2.476.031-2.536.041-.147.259-.39.408-.455a.881.881 0 0 1 .593-.002"})),GM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M16.773 8.288a.75.75 0 0 0-1.06-1.061l1.06 1.06Zm-9.546 7.424a.75.75 0 0 0 1.06 1.061l-1.06-1.06Zm8.485 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM8.288 7.228a.75.75 0 0 0-1.061 1.06l1.06-1.06Zm7.424 0-8.485 8.485 1.06 1.061 8.486-8.485-1.06-1.061Zm1.06 8.485L8.289 7.227l-1.061 1.06 8.485 8.486 1.06-1.06Z"})),dz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"m18.63 21.422.53-.53-.53.53Zm2.792-2.793.53-.53-.53.53Zm-1.392-2.452a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm-2.792 2.793a.75.75 0 0 0-1.06 1.06l1.06-1.06ZM2.75 10.5a7.75 7.75 0 0 1 7.75-7.75v-1.5a9.25 9.25 0 0 0-9.25 9.25h1.5Zm7.75-7.75a7.75 7.75 0 0 1 7.75 7.75h1.5a9.25 9.25 0 0 0-9.25-9.25v1.5Zm7.75 7.75a7.75 7.75 0 0 1-7.75 7.75v1.5a9.25 9.25 0 0 0 9.25-9.25h-1.5Zm-7.75 7.75a7.75 7.75 0 0 1-7.75-7.75h-1.5a9.25 9.25 0 0 0 9.25 9.25v-1.5Zm10.391 2.641a1.224 1.224 0 0 1-1.731 0l-1.061 1.061a2.725 2.725 0 0 0 3.853 0l-1.06-1.06Zm0-1.731a1.224 1.224 0 0 1 0 1.731l1.061 1.061a2.725 2.725 0 0 0 0-3.853l-1.06 1.06Zm-1.921-1.922 1.921 1.922 1.061-1.061-1.922-1.922-1.06 1.06Zm.19 3.653-1.922-1.921-1.06 1.06 1.92 1.922 1.062-1.06Z"})),pz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M16.625 3.987a.75.75 0 1 0 .75-1.298l-.75 1.298Zm5.448 4.25a.75.75 0 1 0-1.405.526l1.405-.526ZM7.469 9.414a.75.75 0 1 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM21.25 12A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75c1.686 0 3.265.45 4.625 1.237l.75-1.298A10.704 10.704 0 0 0 12 1.25v1.5Zm8.668 6.013A9.228 9.228 0 0 1 21.25 12h1.5c0-1.322-.24-2.59-.677-3.763l-1.405.526ZM6.53 10.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),mz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m10 8-4 4m0 0 4 4m-4-4h12"})),vz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("circle",{cx:12,cy:7,r:1,fill:"currentColor"}),xe.createElement("path",{fill:"currentColor",d:"M11 9.25a.75.75 0 0 0 0 1.5v-1.5Zm1 .75h.75a.75.75 0 0 0-.75-.75V10Zm-.75 7a.75.75 0 0 0 1.5 0h-1.5Zm10-5A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75A9.25 9.25 0 0 1 21.25 12h1.5c0-5.937-4.813-10.75-10.75-10.75v1.5Zm-1 8h1v-1.5h-1v1.5Zm.25-.75v7h1.5v-7h-1.5Z"})),gz=r=>St.jsx("svg",{width:r.width||20,height:r.height||20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:St.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29279 7.29302C5.48031 7.10555 5.73462 7.00023 5.99979 7.00023C6.26495 7.00023 6.51926 7.10555 6.70679 7.29302L9.99979 10.586L13.2928 7.29302C13.385 7.19751 13.4954 7.12133 13.6174 7.06892C13.7394 7.01651 13.8706 6.98892 14.0034 6.98777C14.1362 6.98662 14.2678 7.01192 14.3907 7.0622C14.5136 7.11248 14.6253 7.18673 14.7192 7.28062C14.8131 7.37452 14.8873 7.48617 14.9376 7.60907C14.9879 7.73196 15.0132 7.86364 15.012 7.99642C15.0109 8.1292 14.9833 8.26042 14.9309 8.38242C14.8785 8.50443 14.8023 8.61477 14.7068 8.70702L10.7068 12.707C10.5193 12.8945 10.265 12.9998 9.99979 12.9998C9.73462 12.9998 9.48031 12.8945 9.29279 12.707L5.29279 8.70702C5.10532 8.51949 5 8.26518 5 8.00002C5 7.73486 5.10532 7.48055 5.29279 7.29302Z",fill:"currentColor"})}),yz=r=>St.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",...r,children:St.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 4.5h-3A1.5 1.5 0 0 0 3 6v7.5A1.5 1.5 0 0 0 4.5 15H12a1.5 1.5 0 0 0 1.5-1.5v-3m-3-7.5H15m0 0v4.5M15 3l-7.5 7.5"})}),bz=r=>St.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...r,children:St.jsx("path",{fill:"currentColor",d:"M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.09.09 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.09 16.09 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09-.01-.02-.04-.03-.07-.03-1.5.26-2.93.71-4.27 1.33-.01 0-.02.01-.03.02-2.72 4.07-3.47 8.03-3.1 11.95 0 .02.01.04.03.05 1.8 1.32 3.53 2.12 5.24 2.65.03.01.06 0 .07-.02.4-.55.76-1.13 1.07-1.74.02-.04 0-.08-.04-.09-.57-.22-1.11-.48-1.64-.78-.04-.02-.04-.08-.01-.11.11-.08.22-.17.33-.25.02-.02.05-.02.07-.01 3.44 1.57 7.15 1.57 10.55 0 .02-.01.05-.01.07.01.11.09.22.17.33.26.04.03.04.09-.01.11-.52.31-1.07.56-1.64.78-.04.01-.05.06-.04.09.32.61.68 1.19 1.07 1.74.03.01.06.02.09.01 1.72-.53 3.45-1.33 5.25-2.65.02-.01.03-.03.03-.05.44-4.53-.73-8.46-3.1-11.95-.01-.01-.02-.02-.04-.02ZM8.52 14.91c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.84 2.12-1.89 2.12Zm6.97 0c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.83 2.12-1.89 2.12Z"})}),wz=({type:r="text",value:t,className:e,errorMessage:n,...s}={})=>{const i=xe.useRef(null);return St.jsxs("div",{className:sn("flex-grow",r==="search"&&"relative"),children:[St.jsx("input",{...s,ref:i,value:t,className:sn("w-full h-full px-3 py-4 text-sm border border-opacity-25 rounded-xl border-field-border dark:border-interactive-border bg-background-secondary text-ellipsis",e,r==="search"&&"pr-8"),type:r==="search"?"text":r}),r==="search"&&t&&St.jsx("button",{type:"button",className:"absolute p-1 top-3 right-1","aria-label":"Clear",tabIndex:0,onClick:()=>{i.current&&(i.current.value="")},children:St.jsx(GM,{width:24,height:24})}),n&&St.jsx("p",{className:"absolute top-[calc(100%+4px)] text-error font-medium tracking-widest pl-3 text-xs animate-[fade-in_300ms_ease-out]",children:n})]})};var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Zt.global<"u"?Zt.global:typeof self<"u"?self:{};function Yi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Oh(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),e}for(var Ae={},O2={byteLength:function(r){var t=e5(r),e=t[0],n=t[1];return 3*(e+n)/4-n}},YM=O2.toByteArray=function(r){var t,e,n=e5(r),s=n[0],i=n[1],c=new xz(function(m,v,_){return 3*(v+_)/4-_}(0,s,i)),l=0,p=i>0?s-4:s;for(e=0;e>16&255,c[l++]=t>>8&255,c[l++]=255&t;return i===2&&(t=Li[r.charCodeAt(e)]<<2|Li[r.charCodeAt(e+1)]>>4,c[l++]=255&t),i===1&&(t=Li[r.charCodeAt(e)]<<10|Li[r.charCodeAt(e+1)]<<4|Li[r.charCodeAt(e+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},U2=O2.fromByteArray=function(r){for(var t,e=r.length,n=e%3,s=[],i=16383,c=0,l=e-n;cl?l:c+i));return n===1?(t=r[e-1],s.push(To[t>>2]+To[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],s.push(To[t>>10]+To[t>>4&63]+To[t<<2&63]+"=")),s.join("")},To=[],Li=[],xz=typeof Uint8Array<"u"?Uint8Array:Array,t5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gu=0;gu<64;++gu)To[gu]=t5[gu],Li[t5.charCodeAt(gu)]=gu;function e5(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return e===-1&&(e=t),[e,e===t?0:4-e%4]}function _z(r,t,e){for(var n,s,i=[],c=t;c>18&63]+To[s>>12&63]+To[s>>6&63]+To[63&s]);return i.join("")}Li["-".charCodeAt(0)]=62,Li["_".charCodeAt(0)]=63;var Tp={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function vl(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function ey(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function uf(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function XM(r,t){ey(r);const e=t.outputLen;if(r.length>1,v=-7,_=e?s-1:0,E=e?-1:1,w=r[t+_];for(_+=E,i=w&(1<<-v)-1,w>>=-v,v+=l;v>0;i=256*i+r[t+_],_+=E,v-=8);for(c=i&(1<<-v)-1,i>>=-v,v+=n;v>0;c=256*c+r[t+_],_+=E,v-=8);if(i===0)i=1-m;else{if(i===p)return c?NaN:1/0*(w?-1:1);c+=Math.pow(2,n),i-=m}return(w?-1:1)*c*Math.pow(2,i-n)},Tp.write=function(r,t,e,n,s,i){var c,l,p,m=8*i-s-1,v=(1<>1,E=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,x=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,c=v):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),(t+=c+_>=1?E/p:E*Math.pow(2,1-_))*p>=2&&(c++,p/=2),c+_>=v?(l=0,c=v):c+_>=1?(l=(t*p-1)*Math.pow(2,s),c+=_):(l=t*Math.pow(2,_-1)*Math.pow(2,s),c=0));s>=8;r[e+w]=255&l,w+=x,l/=256,s-=8);for(c=c<0;r[e+w]=255&c,w+=x,c/=256,m-=8);r[e+w-x]|=128*A},function(r){const t=O2,e=Tp,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(k){return+k!=k&&(k=0),c.alloc(+k)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function i(k){if(k>s)throw new RangeError('The value "'+k+'" is invalid for option "size"');const T=new Uint8Array(k);return Object.setPrototypeOf(T,c.prototype),T}function c(k,T,L){if(typeof k=="number"){if(typeof T=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return l(k,T,L)}function l(k,T,L){if(typeof k=="string")return function(Q,ot){if(typeof ot=="string"&&ot!==""||(ot="utf8"),!c.isEncoding(ot))throw new TypeError("Unknown encoding: "+ot);const qt=0|w(Q,ot);let It=i(qt);const xt=It.write(Q,ot);return xt!==qt&&(It=It.slice(0,xt)),It}(k,T);if(ArrayBuffer.isView(k))return function(Q){if(Ft(Q,Uint8Array)){const ot=new Uint8Array(Q);return _(ot.buffer,ot.byteOffset,ot.byteLength)}return v(Q)}(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(Ft(k,ArrayBuffer)||k&&Ft(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ft(k,SharedArrayBuffer)||k&&Ft(k.buffer,SharedArrayBuffer)))return _(k,T,L);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=k.valueOf&&k.valueOf();if(j!=null&&j!==k)return c.from(j,T,L);const rt=function(Q){if(c.isBuffer(Q)){const ot=0|E(Q.length),qt=i(ot);return qt.length===0||Q.copy(qt,0,0,ot),qt}if(Q.length!==void 0)return typeof Q.length!="number"||lt(Q.length)?i(0):v(Q);if(Q.type==="Buffer"&&Array.isArray(Q.data))return v(Q.data)}(k);if(rt)return rt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return c.from(k[Symbol.toPrimitive]("string"),T,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function m(k){return p(k),i(k<0?0:0|E(k))}function v(k){const T=k.length<0?0:0|E(k.length),L=i(T);for(let j=0;j=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|k}function w(k,T){if(c.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||Ft(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const L=k.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&L===0)return 0;let rt=!1;for(;;)switch(T){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return Bt(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*L;case"hex":return L>>>1;case"base64":return yt(k).length;default:if(rt)return j?-1:Bt(k).length;T=(""+T).toLowerCase(),rt=!0}}function x(k,T,L){let j=!1;if((T===void 0||T<0)&&(T=0),T>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0)<=(T>>>=0))return"";for(k||(k="utf8");;)switch(k){case"hex":return o(this,T,L);case"utf8":case"utf-8":return nt(this,T,L);case"ascii":return M(this,T,L);case"latin1":case"binary":return d(this,T,L);case"base64":return tt(this,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,T,L);default:if(j)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),j=!0}}function A(k,T,L){const j=k[T];k[T]=k[L],k[L]=j}function B(k,T,L,j,rt){if(k.length===0)return-1;if(typeof L=="string"?(j=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),lt(L=+L)&&(L=rt?0:k.length-1),L<0&&(L=k.length+L),L>=k.length){if(rt)return-1;L=k.length-1}else if(L<0){if(!rt)return-1;L=0}if(typeof T=="string"&&(T=c.from(T,j)),c.isBuffer(T))return T.length===0?-1:P(k,T,L,j,rt);if(typeof T=="number")return T&=255,typeof Uint8Array.prototype.indexOf=="function"?rt?Uint8Array.prototype.indexOf.call(k,T,L):Uint8Array.prototype.lastIndexOf.call(k,T,L):P(k,[T],L,j,rt);throw new TypeError("val must be string, number or Buffer")}function P(k,T,L,j,rt){let Q,ot=1,qt=k.length,It=T.length;if(j!==void 0&&((j=String(j).toLowerCase())==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(k.length<2||T.length<2)return-1;ot=2,qt/=2,It/=2,L/=2}function xt(Qt,Ct){return ot===1?Qt[Ct]:Qt.readUInt16BE(Ct*ot)}if(rt){let Qt=-1;for(Q=L;Qqt&&(L=qt-It),Q=L;Q>=0;Q--){let Qt=!0;for(let Ct=0;Ctrt&&(j=rt):j=rt;const Q=T.length;let ot;for(j>Q/2&&(j=Q/2),ot=0;ot>8,It=ot%256,xt.push(It),xt.push(qt);return xt}(T,k.length-L),k,L,j)}function tt(k,T,L){return T===0&&L===k.length?t.fromByteArray(k):t.fromByteArray(k.slice(T,L))}function nt(k,T,L){L=Math.min(k.length,L);const j=[];let rt=T;for(;rt239?4:Q>223?3:Q>191?2:1;if(rt+qt<=L){let It,xt,Qt,Ct;switch(qt){case 1:Q<128&&(ot=Q);break;case 2:It=k[rt+1],(192&It)==128&&(Ct=(31&Q)<<6|63&It,Ct>127&&(ot=Ct));break;case 3:It=k[rt+1],xt=k[rt+2],(192&It)==128&&(192&xt)==128&&(Ct=(15&Q)<<12|(63&It)<<6|63&xt,Ct>2047&&(Ct<55296||Ct>57343)&&(ot=Ct));break;case 4:It=k[rt+1],xt=k[rt+2],Qt=k[rt+3],(192&It)==128&&(192&xt)==128&&(192&Qt)==128&&(Ct=(15&Q)<<18|(63&It)<<12|(63&xt)<<6|63&Qt,Ct>65535&&Ct<1114112&&(ot=Ct))}}ot===null?(ot=65533,qt=1):ot>65535&&(ot-=65536,j.push(ot>>>10&1023|55296),ot=56320|1023&ot),j.push(ot),rt+=qt}return function(Q){const ot=Q.length;if(ot<=G)return String.fromCharCode.apply(String,Q);let qt="",It=0;for(;It"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(k,T,L){return l(k,T,L)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(k,T,L){return function(j,rt,Q){return p(j),j<=0?i(j):rt!==void 0?typeof Q=="string"?i(j).fill(rt,Q):i(j).fill(rt):i(j)}(k,T,L)},c.allocUnsafe=function(k){return m(k)},c.allocUnsafeSlow=function(k){return m(k)},c.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==c.prototype},c.compare=function(k,T){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),Ft(T,Uint8Array)&&(T=c.from(T,T.offset,T.byteLength)),!c.isBuffer(k)||!c.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===T)return 0;let L=k.length,j=T.length;for(let rt=0,Q=Math.min(L,j);rtj.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(j,rt)):Uint8Array.prototype.set.call(j,Q,rt);else{if(!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(j,rt)}rt+=Q.length}return j},c.byteLength=w,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const k=this.length;if(k%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let T=0;TT&&(k+=" ... "),""},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(k,T,L,j,rt){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),!c.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(T===void 0&&(T=0),L===void 0&&(L=k?k.length:0),j===void 0&&(j=0),rt===void 0&&(rt=this.length),T<0||L>k.length||j<0||rt>this.length)throw new RangeError("out of range index");if(j>=rt&&T>=L)return 0;if(j>=rt)return-1;if(T>=L)return 1;if(this===k)return 0;let Q=(rt>>>=0)-(j>>>=0),ot=(L>>>=0)-(T>>>=0);const qt=Math.min(Q,ot),It=this.slice(j,rt),xt=k.slice(T,L);for(let Qt=0;Qt>>=0,isFinite(L)?(L>>>=0,j===void 0&&(j="utf8")):(j=L,L=void 0)}const rt=this.length-T;if((L===void 0||L>rt)&&(L=rt),k.length>0&&(L<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");let Q=!1;for(;;)switch(j){case"hex":return R(this,k,T,L);case"utf8":case"utf-8":return C(this,k,T,L);case"ascii":case"latin1":case"binary":return O(this,k,T,L);case"base64":return z(this,k,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,k,T,L);default:if(Q)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const G=4096;function M(k,T,L){let j="";L=Math.min(k.length,L);for(let rt=T;rtj)&&(L=j);let rt="";for(let Q=T;QL)throw new RangeError("Trying to access beyond buffer length")}function h(k,T,L,j,rt,Q){if(!c.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(T>rt||Tk.length)throw new RangeError("Index out of range")}function g(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,L}function S(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L+7]=Q,Q>>=8,k[L+6]=Q,Q>>=8,k[L+5]=Q,Q>>=8,k[L+4]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L+3]=ot,ot>>=8,k[L+2]=ot,ot>>=8,k[L+1]=ot,ot>>=8,k[L]=ot,L+8}function I(k,T,L,j,rt,Q){if(L+j>k.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function y(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,4),e.write(k,T,L,j,23,4),L+4}function u(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,8),e.write(k,T,L,j,52,8),L+8}c.prototype.slice=function(k,T){const L=this.length;(k=~~k)<0?(k+=L)<0&&(k=0):k>L&&(k=L),(T=T===void 0?L:~~T)<0?(T+=L)<0&&(T=0):T>L&&(T=L),T>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k+--T],rt=1;for(;T>0&&(rt*=256);)j+=this[k+--T]*rt;return j},c.prototype.readUint8=c.prototype.readUInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),this[k]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]|this[k+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]<<8|this[k+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+16777216*this[k+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),16777216*this[k]+(this[k+1]<<16|this[k+2]<<8|this[k+3])},c.prototype.readBigUInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T+256*this[++k]+65536*this[++k]+this[++k]*2**24,rt=this[++k]+256*this[++k]+65536*this[++k]+L*2**24;return BigInt(j)+(BigInt(rt)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T*2**24+65536*this[++k]+256*this[++k]+this[++k],rt=this[++k]*2**24+65536*this[++k]+256*this[++k]+L;return(BigInt(j)<>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q=rt&&(j-=Math.pow(2,8*T)),j},c.prototype.readIntBE=function(k,T,L){k>>>=0,T>>>=0,L||f(k,T,this.length);let j=T,rt=1,Q=this[k+--j];for(;j>0&&(rt*=256);)Q+=this[k+--j]*rt;return rt*=128,Q>=rt&&(Q-=Math.pow(2,8*T)),Q},c.prototype.readInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),128&this[k]?-1*(255-this[k]+1):this[k]},c.prototype.readInt16LE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k]|this[k+1]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt16BE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k+1]|this[k]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},c.prototype.readInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},c.prototype.readBigInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=this[k+4]+256*this[k+5]+65536*this[k+6]+(L<<24);return(BigInt(j)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=(T<<24)+65536*this[++k]+256*this[++k]+this[++k];return(BigInt(j)<>>=0,T||f(k,4,this.length),e.read(this,k,!0,23,4)},c.prototype.readFloatBE=function(k,T){return k>>>=0,T||f(k,4,this.length),e.read(this,k,!1,23,4)},c.prototype.readDoubleLE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!0,52,8)},c.prototype.readDoubleBE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(k,T,L,j){k=+k,T>>>=0,L>>>=0,!j&&h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=1,Q=0;for(this[T]=255&k;++Q>>=0,L>>>=0,!j&&h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=L-1,Q=1;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)this[T+rt]=k/Q&255;return T+L},c.prototype.writeUint8=c.prototype.writeUInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,255,0),this[T]=255&k,T+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T+3]=k>>>24,this[T+2]=k>>>16,this[T+1]=k>>>8,this[T]=255&k,T+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigUInt64LE=Tt(function(k,T=0){return g(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Tt(function(k,T=0){return S(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=0,Q=1,ot=0;for(this[T]=255&k;++rt>0)-ot&255;return T+L},c.prototype.writeIntBE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=L-1,Q=1,ot=0;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)k<0&&ot===0&&this[T+rt+1]!==0&&(ot=1),this[T+rt]=(k/Q>>0)-ot&255;return T+L},c.prototype.writeInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,127,-128),k<0&&(k=255+k+1),this[T]=255&k,T+1},c.prototype.writeInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),this[T]=255&k,this[T+1]=k>>>8,this[T+2]=k>>>16,this[T+3]=k>>>24,T+4},c.prototype.writeInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigInt64LE=Tt(function(k,T=0){return g(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Tt(function(k,T=0){return S(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(k,T,L){return y(this,k,T,!0,L)},c.prototype.writeFloatBE=function(k,T,L){return y(this,k,T,!1,L)},c.prototype.writeDoubleLE=function(k,T,L){return u(this,k,T,!0,L)},c.prototype.writeDoubleBE=function(k,T,L){return u(this,k,T,!1,L)},c.prototype.copy=function(k,T,L,j){if(!c.isBuffer(k))throw new TypeError("argument should be a Buffer");if(L||(L=0),j||j===0||(j=this.length),T>=k.length&&(T=k.length),T||(T=0),j>0&&j=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),k.length-T>>=0,L=L===void 0?this.length:L>>>0,k||(k=0),typeof k=="number")for(rt=T;rt=j+4;L-=3)T=`_${k.slice(L-3,L)}${T}`;return`${k.slice(0,L)}${T}`}function F(k,T,L,j,rt,Q){if(k>L||k3?T===0||T===BigInt(0)?`>= 0${ot} and < 2${ot} ** ${8*(Q+1)}${ot}`:`>= -(2${ot} ** ${8*(Q+1)-1}${ot}) and < 2 ** ${8*(Q+1)-1}${ot}`:`>= ${T}${ot} and <= ${L}${ot}`,new b.ERR_OUT_OF_RANGE("value",qt,k)}(function(ot,qt,It){q(qt,"offset"),ot[qt]!==void 0&&ot[qt+It]!==void 0||it(qt,ot.length-(It+1))})(j,rt,Q)}function q(k,T){if(typeof k!="number")throw new b.ERR_INVALID_ARG_TYPE(T,"number",k)}function it(k,T,L){throw Math.floor(k)!==k?(q(k,L),new b.ERR_OUT_OF_RANGE(L||"offset","an integer",k)):T<0?new b.ERR_BUFFER_OUT_OF_BOUNDS:new b.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${T}`,k)}D("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),D("ERR_INVALID_ARG_TYPE",function(k,T){return`The "${k}" argument must be of type number. Received type ${typeof T}`},TypeError),D("ERR_OUT_OF_RANGE",function(k,T,L){let j=`The value of "${k}" is out of range.`,rt=L;return Number.isInteger(L)&&Math.abs(L)>2**32?rt=Z(String(L)):typeof L=="bigint"&&(rt=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(rt=Z(rt)),rt+="n"),j+=` It must be ${T}. Received ${rt}`,j},RangeError);const at=/[^+/0-9A-Za-z-_]/g;function Bt(k,T){let L;T=T||1/0;const j=k.length;let rt=null;const Q=[];for(let ot=0;ot55295&&L<57344){if(!rt){if(L>56319){(T-=3)>-1&&Q.push(239,191,189);continue}if(ot+1===j){(T-=3)>-1&&Q.push(239,191,189);continue}rt=L;continue}if(L<56320){(T-=3)>-1&&Q.push(239,191,189),rt=L;continue}L=65536+(rt-55296<<10|L-56320)}else rt&&(T-=3)>-1&&Q.push(239,191,189);if(rt=null,L<128){if((T-=1)<0)break;Q.push(L)}else if(L<2048){if((T-=2)<0)break;Q.push(L>>6|192,63&L|128)}else if(L<65536){if((T-=3)<0)break;Q.push(L>>12|224,L>>6&63|128,63&L|128)}else{if(!(L<1114112))throw new Error("Invalid code point");if((T-=4)<0)break;Q.push(L>>18|240,L>>12&63|128,L>>6&63|128,63&L|128)}}return Q}function yt(k){return t.toByteArray(function(T){if((T=(T=T.split("=")[0]).trim().replace(at,"")).length<2)return"";for(;T.length%4!=0;)T+="=";return T}(k))}function pt(k,T,L,j){let rt;for(rt=0;rt=T.length||rt>=k.length);++rt)T[rt+L]=k[rt];return rt}function Ft(k,T){return k instanceof T||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===T.name}function lt(k){return k!=k}const ct=function(){const k="0123456789abcdef",T=new Array(256);for(let L=0;L<16;++L){const j=16*L;for(let rt=0;rt<16;++rt)T[j+rt]=k[L]+k[rt]}return T}();function Tt(k){return typeof BigInt>"u"?kt:k}function kt(){throw new Error("BigInt not supported")}}(Ae);const Lp=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,JM=r=>r instanceof Uint8Array,Op=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),go=(r,t)=>r<<32-t|r>>>t;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function Mz(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function gd(r){if(typeof r=="string"&&(r=Mz(r)),!JM(r))throw new Error("expected Uint8Array, got "+typeof r);return r}function Ez(...r){const t=new Uint8Array(r.reduce((n,s)=>n+s.length,0));let e=0;return r.forEach(n=>{if(!JM(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}let ry=class{clone(){return this._cloneInto()}};function ny(r){const t=n=>r().update(gd(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function QM(r=32){if(Lp&&typeof Lp.getRandomValues=="function")return Lp.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}let tE=class extends ry{constructor(t,e,n,s){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Op(this.buffer)}update(t){uf(this);const{view:e,buffer:n,blockLen:s}=this,i=(t=gd(t)).length;for(let c=0;cs-c&&(this.process(n,0),c=0);for(let _=c;_>A&B),R=Number(w&B),C=x?4:0,O=x?0:4;_.setUint32(E+C,P,x),_.setUint32(E+O,R,x)})(n,s-8,BigInt(8*this.length),i),this.process(n,0);const l=Op(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const m=p/4,v=this.get();if(m>v.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_>N2&f0)}:{h:0|Number(r>>N2&f0),l:0|Number(r&f0)}}function rE(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;sr<>>32-e,iE=(r,t,e)=>t<>>32-e,oE=(r,t,e)=>t<>>64-e,sE=(r,t,e)=>r<>>64-e,Az={fromBig:eE,split:rE,toBig:(r,t)=>BigInt(r>>>0)<>>0),shrSH:(r,t,e)=>r>>>e,shrSL:(r,t,e)=>r<<32-e|t>>>e,rotrSH:(r,t,e)=>r>>>e|t<<32-e,rotrSL:(r,t,e)=>r<<32-e|t>>>e,rotrBH:(r,t,e)=>r<<64-e|t>>>e-32,rotrBL:(r,t,e)=>r>>>e-32|t<<64-e,rotr32H:(r,t)=>t,rotr32L:(r,t)=>r,rotlSH:nE,rotlSL:iE,rotlBH:oE,rotlBL:sE,add:function(r,t,e,n){const s=(t>>>0)+(n>>>0);return{h:r+e+(s/2**32|0)|0,l:0|s}},add3L:(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H:(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L:(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H:(r,t,e,n,s)=>t+e+n+s+(r/2**32|0)|0,add5H:(r,t,e,n,s,i)=>t+e+n+s+i+(r/2**32|0)|0,add5L:(r,t,e,n,s)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)};var tr=Az;const[Sz,kz]=(()=>tr.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),Ts=new Uint32Array(80),Ls=new Uint32Array(80);let Iz=class extends tE{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:s,Ch:i,Cl:c,Dh:l,Dl:p,Eh:m,El:v,Fh:_,Fl:E,Gh:w,Gl:x,Hh:A,Hl:B}=this;return[t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B]}set(t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|s,this.Ch=0|i,this.Cl=0|c,this.Dh=0|l,this.Dl=0|p,this.Eh=0|m,this.El=0|v,this.Fh=0|_,this.Fl=0|E,this.Gh=0|w,this.Gl=0|x,this.Hh=0|A,this.Hl=0|B}process(t,e){for(let C=0;C<16;C++,e+=4)Ts[C]=t.getUint32(e),Ls[C]=t.getUint32(e+=4);for(let C=16;C<80;C++){const O=0|Ts[C-15],z=0|Ls[C-15],H=tr.rotrSH(O,z,1)^tr.rotrSH(O,z,8)^tr.shrSH(O,z,7),tt=tr.rotrSL(O,z,1)^tr.rotrSL(O,z,8)^tr.shrSL(O,z,7),nt=0|Ts[C-2],G=0|Ls[C-2],M=tr.rotrSH(nt,G,19)^tr.rotrBH(nt,G,61)^tr.shrSH(nt,G,6),d=tr.rotrSL(nt,G,19)^tr.rotrBL(nt,G,61)^tr.shrSL(nt,G,6),o=tr.add4L(tt,d,Ls[C-7],Ls[C-16]),a=tr.add4H(o,H,M,Ts[C-7],Ts[C-16]);Ts[C]=0|a,Ls[C]=0|o}let{Ah:n,Al:s,Bh:i,Bl:c,Ch:l,Cl:p,Dh:m,Dl:v,Eh:_,El:E,Fh:w,Fl:x,Gh:A,Gl:B,Hh:P,Hl:R}=this;for(let C=0;C<80;C++){const O=tr.rotrSH(_,E,14)^tr.rotrSH(_,E,18)^tr.rotrBH(_,E,41),z=tr.rotrSL(_,E,14)^tr.rotrSL(_,E,18)^tr.rotrBL(_,E,41),H=_&w^~_&A,tt=E&x^~E&B,nt=tr.add5L(R,z,tt,kz[C],Ls[C]),G=tr.add5H(nt,P,O,H,Sz[C],Ts[C]),M=0|nt,d=tr.rotrSH(n,s,28)^tr.rotrBH(n,s,34)^tr.rotrBH(n,s,39),o=tr.rotrSL(n,s,28)^tr.rotrBL(n,s,34)^tr.rotrBL(n,s,39),a=n&i^n&l^i&l,f=s&c^s&p^c&p;P=0|A,R=0|B,A=0|w,B=0|x,w=0|_,x=0|E,{h:_,l:E}=tr.add(0|m,0|v,0|G,0|M),m=0|l,v=0|p,l=0|i,p=0|c,i=0|n,c=0|s;const h=tr.add3L(M,o,f);n=tr.add3H(h,G,d,a),s=0|h}({h:n,l:s}=tr.add(0|this.Ah,0|this.Al,0|n,0|s)),{h:i,l:c}=tr.add(0|this.Bh,0|this.Bl,0|i,0|c),{h:l,l:p}=tr.add(0|this.Ch,0|this.Cl,0|l,0|p),{h:m,l:v}=tr.add(0|this.Dh,0|this.Dl,0|m,0|v),{h:_,l:E}=tr.add(0|this.Eh,0|this.El,0|_,0|E),{h:w,l:x}=tr.add(0|this.Fh,0|this.Fl,0|w,0|x),{h:A,l:B}=tr.add(0|this.Gh,0|this.Gl,0|A,0|B),{h:P,l:R}=tr.add(0|this.Hh,0|this.Hl,0|P,0|R),this.set(n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R)}roundClean(){Ts.fill(0),Ls.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const Bz=ny(()=>new Iz),r5=BigInt(0),Y0=BigInt(1),Pz=BigInt(2),yd=r=>r instanceof Uint8Array,Rz=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ja(r){if(!yd(r))throw new Error("Uint8Array expected");let t="";for(let e=0;en+s.length,0));let e=0;return r.forEach(n=>{if(!yd(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}const oy=r=>(Pz<new Uint8Array(r),i5=r=>Uint8Array.from(r);function aE(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Up(r),s=Up(r),i=0;const c=()=>{n.fill(1),s.fill(0),i=0},l=(...v)=>e(s,n,...v),p=(v=Up())=>{s=l(i5([0]),v),n=l(),v.length!==0&&(s=l(i5([1]),v),n=l())},m=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let v=0;const _=[];for(;v{let E;for(c(),p(v);!(E=_(m()));)p();return c(),E}}const Cz={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function cf(r,t,e={}){const n=(s,i,c)=>{const l=Cz[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const p=r[s];if(!(c&&p===void 0||l(p,r)))throw new Error(`Invalid param ${String(s)}=${p} (${typeof p}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(e))n(s,i,!0);return r}var Tz=Object.freeze({__proto__:null,bytesToHex:Ja,numberToHexUnpadded:n5,hexToNumber:iy,hexToBytes:ff,bytesToNumberBE:La,bytesToNumberLE:qu,numberToBytesBE:Fu,numberToBytesLE:Xc,numberToVarBytesBE:function(r){return ff(n5(r))},ensureBytes:mn,concatBytes:Qa,equalBytes:function(r,t){if(r.length!==t.length)return!1;for(let e=0;er5;r>>=Y0,t+=1);return t},bitGet:function(r,t){return r>>BigInt(t)&Y0},bitSet:(r,t,e)=>r|(e?Y0:r5)<=En?e:t+e}function Oz(r,t,e){if(e<=En||t 0");if(e===Zr)return En;let n=Zr;for(;t>En;)t&Zr&&(n=n*r%e),r=r*r%e,t>>=Zr;return n}function en(r,t,e){let n=r;for(;t-- >En;)n*=n,n%=e;return n}function D2(r,t){if(r===En||t<=En)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Kr(r,t),n=t,s=En,i=Zr;for(;e!==En;){const c=n%e,l=s-i*(n/e);n=e,e=c,s=i,i=l}if(n!==Zr)throw new Error("invert: does not exist");return Kr(s,t)}function Uz(r){if(r%Np===Lz){const t=(r+Zr)/Np;return function(e,n){const s=e.pow(n,t);if(!e.eql(e.sqr(s),n))throw new Error("Cannot find square root");return s}}if(r%s5===o5){const t=(r-o5)/s5;return function(e,n){const s=e.mul(n,pa),i=e.pow(s,t),c=e.mul(n,i),l=e.mul(e.mul(c,pa),i),p=e.mul(c,e.sub(l,e.ONE));if(!e.eql(e.sqr(p),n))throw new Error("Cannot find square root");return p}}return function(t){const e=(t-Zr)/pa;let n,s,i;for(n=t-Zr,s=0;n%pa===En;n/=pa,s++);for(i=pa;i 0, got ${r}`);const{nBitLength:s,nByteLength:i}=uE(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=Uz(r),l=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:oy(s),ZERO:En,ONE:Zr,create:p=>Kr(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof p);return En<=p&&pp===En,isOdd:p=>(p&Zr)===Zr,neg:p=>Kr(-p,r),eql:(p,m)=>p===m,sqr:p=>Kr(p*p,r),add:(p,m)=>Kr(p+m,r),sub:(p,m)=>Kr(p-m,r),mul:(p,m)=>Kr(p*m,r),pow:(p,m)=>function(v,_,E){if(E 0");if(E===En)return v.ONE;if(E===Zr)return _;let w=v.ONE,x=_;for(;E>En;)E&Zr&&(w=v.mul(w,x)),x=v.sqr(x),E>>=Zr;return w}(l,p,m),div:(p,m)=>Kr(p*D2(m,r),r),sqrN:p=>p*p,addN:(p,m)=>p+m,subN:(p,m)=>p-m,mulN:(p,m)=>p*m,inv:p=>D2(p,r),sqrt:n.sqrt||(p=>c(l,p)),invertBatch:p=>function(m,v){const _=new Array(v.length),E=v.reduce((x,A,B)=>m.is0(A)?x:(_[B]=x,m.mul(x,A)),m.ONE),w=m.inv(E);return v.reduceRight((x,A,B)=>m.is0(A)?x:(_[B]=m.mul(x,_[B]),m.mul(x,A)),w),_}(l,p),cmov:(p,m,v)=>v?m:p,toBytes:p=>e?Xc(p,i):Fu(p,i),fromBytes:p=>{if(p.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${p.length}`);return e?qu(p):La(p)}});return Object.freeze(l)}function cE(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function a5(r){const t=cE(r);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Dz=BigInt(0),Dp=BigInt(1);function hE(r,t){const e=(s,i)=>{const c=i.negate();return s?c:i},n=s=>({windows:Math.ceil(t/s)+1,windowSize:2**(s-1)});return{constTimeNegate:e,unsafeLadder(s,i){let c=r.ZERO,l=s;for(;i>Dz;)i&Dp&&(c=c.add(l)),l=l.double(),i>>=Dp;return c},precomputeWindow(s,i){const{windows:c,windowSize:l}=n(i),p=[];let m=s,v=m;for(let _=0;_>=w,B>p&&(B-=E,c+=Dp);const P=A,R=A+Math.abs(B)-1,C=x%2!=0,O=B<0;B===0?v=v.add(e(C,i[P])):m=m.add(e(O,i[R]))}return{p:m,f:v}},wNAFCached(s,i,c,l){const p=s._WINDOW_SIZE||1;let m=i.get(s);return m||(m=this.precomputeWindow(s,p),p!==1&&i.set(s,l(m))),this.wNAF(p,m,c)}}}function sy(r){return cf(r.Fp,Nz.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),cf(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...uE(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ji=BigInt(0),mi=BigInt(1),c0=BigInt(2),zz=BigInt(8),qz={zip215:!0};function Fz(r){const t=function(f){const h=sy(f);return cf(f,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...h})}(r),{Fp:e,n,prehash:s,hash:i,randomBytes:c,nByteLength:l,h:p}=t,m=c0<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:Ji}}}),E=t.adjustScalarBytes||(f=>f),w=t.domain||((f,h,g)=>{if(h.length||g)throw new Error("Contexts/pre-hash are not supported");return f}),x=f=>typeof f=="bigint"&&Jix(f)&&x(h)&&ff===Ji||A(f,m);function P(f,h){if(A(f,h))return f;throw new Error(`Expected valid scalar < ${h}, got ${typeof f} ${f}`)}function R(f){return f===Ji?f:P(f,n)}const C=new Map;function O(f){if(!(f instanceof z))throw new Error("ExtendedPoint expected")}class z{constructor(h,g,S,I){if(this.ex=h,this.ey=g,this.ez=S,this.et=I,!B(h))throw new Error("x required");if(!B(g))throw new Error("y required");if(!B(S))throw new Error("z required");if(!B(I))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof z)throw new Error("extended point not allowed");const{x:g,y:S}=h||{};if(!B(g)||!B(S))throw new Error("invalid affine point");return new z(g,S,mi,v(g*S))}static normalizeZ(h){const g=e.invertBatch(h.map(S=>S.ez));return h.map((S,I)=>S.toAffine(g[I])).map(z.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,C.delete(this)}assertValidity(){const{a:h,d:g}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:S,ey:I,ez:y,et:u}=this,b=v(S*S),D=v(I*I),Z=v(y*y),F=v(Z*Z),q=v(b*h);if(v(Z*v(q+D))!==v(F+v(g*v(b*D))))throw new Error("bad point: equation left != right (1)");if(v(S*I)!==v(y*u))throw new Error("bad point: equation left != right (2)")}equals(h){O(h);const{ex:g,ey:S,ez:I}=this,{ex:y,ey:u,ez:b}=h,D=v(g*b),Z=v(y*I),F=v(S*b),q=v(u*I);return D===Z&&F===q}is0(){return this.equals(z.ZERO)}negate(){return new z(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){const{a:h}=t,{ex:g,ey:S,ez:I}=this,y=v(g*g),u=v(S*S),b=v(c0*v(I*I)),D=v(h*y),Z=g+S,F=v(v(Z*Z)-y-u),q=D+u,it=q-b,at=D-u,Bt=v(F*it),yt=v(q*at),pt=v(F*at),Ft=v(it*q);return new z(Bt,yt,Ft,pt)}add(h){O(h);const{a:g,d:S}=t,{ex:I,ey:y,ez:u,et:b}=this,{ex:D,ey:Z,ez:F,et:q}=h;if(g===BigInt(-1)){const L=v((y-I)*(Z+D)),j=v((y+I)*(Z-D)),rt=v(j-L);if(rt===Ji)return this.double();const Q=v(u*c0*q),ot=v(b*c0*F),qt=ot+Q,It=j+L,xt=ot-Q,Qt=v(qt*rt),Ct=v(It*xt),Dt=v(qt*xt),Se=v(rt*It);return new z(Qt,Ct,Se,Dt)}const it=v(I*D),at=v(y*Z),Bt=v(b*S*q),yt=v(u*F),pt=v((I+y)*(D+Z)-it-at),Ft=yt-Bt,lt=yt+Bt,ct=v(at-g*it),Tt=v(pt*Ft),kt=v(lt*ct),k=v(pt*ct),T=v(Ft*lt);return new z(Tt,kt,T,k)}subtract(h){return this.add(h.negate())}wNAF(h){return nt.wNAFCached(this,C,h,z.normalizeZ)}multiply(h){const{p:g,f:S}=this.wNAF(P(h,n));return z.normalizeZ([g,S])[0]}multiplyUnsafe(h){let g=R(h);return g===Ji?tt:this.equals(tt)||g===mi?this:this.equals(H)?this.wNAF(g).p:nt.unsafeLadder(this,g)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return nt.unsafeLadder(this,n).is0()}toAffine(h){const{ex:g,ey:S,ez:I}=this,y=this.is0();h==null&&(h=y?zz:e.inv(I));const u=v(g*h),b=v(S*h),D=v(I*h);if(y)return{x:Ji,y:mi};if(D!==mi)throw new Error("invZ was invalid");return{x:u,y:b}}clearCofactor(){const{h}=t;return h===mi?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){const{d:S,a:I}=t,y=e.BYTES,u=(h=mn("pointHex",h,y)).slice(),b=h[y-1];u[y-1]=-129&b;const D=qu(u);D===Ji||P(D,g?m:e.ORDER);const Z=v(D*D),F=v(Z-mi),q=v(S*Z-I);let{isValid:it,value:at}=_(F,q);if(!it)throw new Error("Point.fromHex: invalid y coordinate");const Bt=(at&mi)===mi,yt=(128&b)!=0;if(!g&&at===Ji&&yt)throw new Error("Point.fromHex: x=0 and x_0=1");return yt!==Bt&&(at=v(-at)),z.fromAffine({x:at,y:D})}static fromPrivateKey(h){return d(h).point}toRawBytes(){const{x:h,y:g}=this.toAffine(),S=Xc(g,e.BYTES);return S[S.length-1]|=h&mi?128:0,S}toHex(){return Ja(this.toRawBytes())}}z.BASE=new z(t.Gx,t.Gy,mi,v(t.Gx*t.Gy)),z.ZERO=new z(Ji,mi,mi,Ji);const{BASE:H,ZERO:tt}=z,nt=hE(z,8*l);function G(f){return Kr(f,n)}function M(f){return G(qu(f))}function d(f){const h=l;f=mn("private key",f,h);const g=mn("hashed private key",i(f),2*h),S=E(g.slice(0,h)),I=g.slice(h,2*h),y=M(S),u=H.multiply(y),b=u.toRawBytes();return{head:S,prefix:I,scalar:y,point:u,pointBytes:b}}function o(f=new Uint8Array,...h){const g=Qa(...h);return M(i(w(g,mn("context",f),!!s)))}const a=qz;return H._setWindowSize(8),{CURVE:t,getPublicKey:function(f){return d(f).pointBytes},sign:function(f,h,g={}){f=mn("message",f),s&&(f=s(f));const{prefix:S,scalar:I,pointBytes:y}=d(h),u=o(g.context,S,f),b=H.multiply(u).toRawBytes(),D=G(u+o(g.context,b,y,f)*I);return R(D),mn("result",Qa(b,Xc(D,e.BYTES)),2*l)},verify:function(f,h,g,S=a){const{context:I,zip215:y}=S,u=e.BYTES;f=mn("signature",f,2*u),h=mn("message",h),s&&(h=s(h));const b=qu(f.slice(u,2*u));let D,Z,F;try{D=z.fromHex(g,y),Z=z.fromHex(f.slice(0,u),y),F=H.multiplyUnsafe(b)}catch{return!1}if(!y&&D.isSmallOrder())return!1;const q=o(I,Z.toRawBytes(),D.toRawBytes(),h);return Z.add(D.multiplyUnsafe(q)).subtract(F).clearCofactor().equals(z.ZERO)},ExtendedPoint:z,utils:{getExtendedPublicKey:d,randomPrivateKey:()=>c(e.BYTES),precompute:(f=8,h=z.BASE)=>(h._setWindowSize(f),h.multiply(BigInt(3)),h)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z2=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),u5=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const jz=BigInt(1),q2=BigInt(2),Kz=BigInt(5),f5=BigInt(10),$z=BigInt(20),Hz=BigInt(40),c5=BigInt(80),us=fE(z2,void 0,!0),Vz={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:us,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Bz,randomBytes:QM,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,t){const e=z2,n=Kr(t*t*t,e),s=function(E){const w=z2,x=E*E%w*E%w,A=en(x,q2,w)*x%w,B=en(A,jz,w)*E%w,P=en(B,Kz,w)*B%w,R=en(P,f5,w)*P%w,C=en(R,$z,w)*R%w,O=en(C,Hz,w)*C%w,z=en(O,c5,w)*O%w,H=en(z,c5,w)*O%w,tt=en(H,f5,w)*P%w;return{pow_p_5_8:en(tt,q2,w)*E%w,b2:x}}(r*Kr(n*n*t,e)).pow_p_5_8;let i=Kr(r*n*s,e);const c=Kr(t*i*i,e),l=i,p=Kr(i*u5,e),m=c===r,v=c===Kr(-r,e),_=c===Kr(-r*u5,e);return m&&(i=l),(v||_)&&(i=p),(Kr(i,e)&Zr)===Zr&&(i=Kr(-i,e)),{isValid:m||v,value:i}}},Pf=Fz(Vz),Zz=(us.ORDER+BigInt(3))/BigInt(8);us.pow(q2,Zz),us.sqrt(us.neg(us.ONE)),us.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,t){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const e=r.sqrt(t);r.isOdd(e)&&r.neg(e)}(us,us.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var lE={exports:{}},dE=Oh(Object.freeze({__proto__:null,default:{}}));(function(r,t){function e(M,d){if(!M)throw new Error(d||"Assertion failed")}function n(M,d){M.super_=d;var o=function(){};o.prototype=d.prototype,M.prototype=new o,M.prototype.constructor=M}function s(M,d,o){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&(d!=="le"&&d!=="be"||(o=d,d=10),this._init(M||0,d||10,o||"be"))}var i;typeof r=="object"?r.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{i=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:dE.Buffer}catch{}function c(M,d){var o=M.charCodeAt(d);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void e(!1,"Invalid character in "+M)}function l(M,d,o){var a=c(M,o);return o-1>=d&&(a|=c(M,o-1)<<4),a}function p(M,d,o,a){for(var f=0,h=0,g=Math.min(M.length,o),S=d;S=49?I-49+10:I>=17?I-17+10:I,e(I>=0&&h0?M:d},s.min=function(M,d){return M.cmp(d)<0?M:d},s.prototype._init=function(M,d,o){if(typeof M=="number")return this._initNumber(M,d,o);if(typeof M=="object")return this._initArray(M,d,o);d==="hex"&&(d=16),e(d===(0|d)&&d>=2&&d<=36);var a=0;(M=M.toString().replace(/\s+/g,""))[0]==="-"&&(a++,this.negative=1),a=0;a-=3)h=M[a]|M[a-1]<<8|M[a-2]<<16,this.words[f]|=h<>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);else if(o==="le")for(a=0,f=0;a>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);return this._strip()},s.prototype._parseHex=function(M,d,o){this.length=Math.ceil((M.length-d)/6),this.words=new Array(this.length);for(var a=0;a=d;a-=2)f=l(M,d,a)<=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;else for(a=(M.length-d)%2==0?d+1:d;a=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;this._strip()},s.prototype._parseBase=function(M,d,o){this.words=[0],this.length=1;for(var a=0,f=1;f<=67108863;f*=d)a++;a--,f=f/d|0;for(var h=M.length-o,g=h%a,S=Math.min(h,h-g)+o,I=0,y=o;y1&&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")]=v}catch{s.prototype.inspect=v}else s.prototype.inspect=v;function v(){return(this.red?""}var _=["","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"],E=[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];function x(M,d,o){o.negative=d.negative^M.negative;var a=M.length+d.length|0;o.length=a,a=a-1|0;var f=0|M.words[0],h=0|d.words[0],g=f*h,S=67108863&g,I=g/67108864|0;o.words[0]=S;for(var y=1;y>>26,b=67108863&I,D=Math.min(y,d.length-1),Z=Math.max(0,y-M.length+1);Z<=D;Z++){var F=y-Z|0;u+=(g=(f=0|M.words[F])*(h=0|d.words[Z])+b)/67108864|0,b=67108863&g}o.words[y]=0|b,I=0|u}return I!==0?o.words[y]=0|I:o.length--,o._strip()}s.prototype.toString=function(M,d){var o;if(d=0|d||1,(M=M||10)===16||M==="hex"){o="";for(var a=0,f=0,h=0;h>>24-a&16777215,(a+=2)>=26&&(a-=26,h--),o=f!==0||h!==this.length-1?_[6-S.length]+S+o:S+o}for(f!==0&&(o=f.toString(16)+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(M===(0|M)&&M>=2&&M<=36){var I=E[M],y=w[M];o="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(y).toString(M);o=(u=u.idivn(y)).isZero()?b+o:_[I-b.length]+b+o}for(this.isZero()&&(o="0"+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}e(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var M=this.words[0];return this.length===2?M+=67108864*this.words[1]:this.length===3&&this.words[2]===1?M+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-M:M},s.prototype.toJSON=function(){return this.toString(16,2)},i&&(s.prototype.toBuffer=function(M,d){return this.toArrayLike(i,M,d)}),s.prototype.toArray=function(M,d){return this.toArrayLike(Array,M,d)},s.prototype.toArrayLike=function(M,d,o){this._strip();var a=this.byteLength(),f=o||Math.max(1,a);e(a<=f,"byte array longer than desired length"),e(f>0,"Requested array length <= 0");var h=function(g,S){return g.allocUnsafe?g.allocUnsafe(S):new g(S)}(M,f);return this["_toArrayLike"+(d==="le"?"LE":"BE")](h,a),h},s.prototype._toArrayLikeLE=function(M,d){for(var o=0,a=0,f=0,h=0;f>8&255),o>16&255),h===6?(o>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o=0&&(M[o--]=g>>8&255),o>=0&&(M[o--]=g>>16&255),h===6?(o>=0&&(M[o--]=g>>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o>=0)for(M[o--]=a;o>=0;)M[o--]=0},Math.clz32?s.prototype._countBits=function(M){return 32-Math.clz32(M)}:s.prototype._countBits=function(M){var d=M,o=0;return d>=4096&&(o+=13,d>>>=13),d>=64&&(o+=7,d>>>=7),d>=8&&(o+=4,d>>>=4),d>=2&&(o+=2,d>>>=2),o+d},s.prototype._zeroBits=function(M){if(M===0)return 26;var d=M,o=0;return!(8191&d)&&(o+=13,d>>>=13),!(127&d)&&(o+=7,d>>>=7),!(15&d)&&(o+=4,d>>>=4),!(3&d)&&(o+=2,d>>>=2),!(1&d)&&o++,o},s.prototype.bitLength=function(){var M=this.words[this.length-1],d=this._countBits(M);return 26*(this.length-1)+d},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var M=0,d=0;dM.length?this.clone().ior(M):M.clone().ior(this)},s.prototype.uor=function(M){return this.length>M.length?this.clone().iuor(M):M.clone().iuor(this)},s.prototype.iuand=function(M){var d;d=this.length>M.length?M:this;for(var o=0;oM.length?this.clone().iand(M):M.clone().iand(this)},s.prototype.uand=function(M){return this.length>M.length?this.clone().iuand(M):M.clone().iuand(this)},s.prototype.iuxor=function(M){var d,o;this.length>M.length?(d=this,o=M):(d=M,o=this);for(var a=0;aM.length?this.clone().ixor(M):M.clone().ixor(this)},s.prototype.uxor=function(M){return this.length>M.length?this.clone().iuxor(M):M.clone().iuxor(this)},s.prototype.inotn=function(M){e(typeof M=="number"&&M>=0);var d=0|Math.ceil(M/26),o=M%26;this._expand(d),o>0&&d--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},s.prototype.notn=function(M){return this.clone().inotn(M)},s.prototype.setn=function(M,d){e(typeof M=="number"&&M>=0);var o=M/26|0,a=M%26;return this._expand(o+1),this.words[o]=d?this.words[o]|1<M.length?(o=this,a=M):(o=M,a=this);for(var f=0,h=0;h>>26;for(;f!==0&&h>>26;if(this.length=o.length,f!==0)this.words[this.length]=f,this.length++;else if(o!==this)for(;hM.length?this.clone().iadd(M):M.clone().iadd(this)},s.prototype.isub=function(M){if(M.negative!==0){M.negative=0;var d=this.iadd(M);return M.negative=1,d._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(M),this.negative=1,this._normSign();var o,a,f=this.cmp(M);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(o=this,a=M):(o=M,a=this);for(var h=0,g=0;g>26,this.words[g]=67108863&d;for(;h!==0&&g>26,this.words[g]=67108863&d;if(h===0&&g>>13,Z=0|g[1],F=8191&Z,q=Z>>>13,it=0|g[2],at=8191&it,Bt=it>>>13,yt=0|g[3],pt=8191&yt,Ft=yt>>>13,lt=0|g[4],ct=8191<,Tt=lt>>>13,kt=0|g[5],k=8191&kt,T=kt>>>13,L=0|g[6],j=8191&L,rt=L>>>13,Q=0|g[7],ot=8191&Q,qt=Q>>>13,It=0|g[8],xt=8191&It,Qt=It>>>13,Ct=0|g[9],Dt=8191&Ct,Se=Ct>>>13,te=0|S[0],Ut=8191&te,Te=te>>>13,J=0|S[1],X=8191&J,st=J>>>13,N=0|S[2],$=8191&N,gt=N>>>13,ft=0|S[3],mt=8191&ft,vt=ft>>>13,At=0|S[4],_t=8191&At,Gt=At>>>13,Rt=0|S[5],wt=8191&Rt,se=Rt>>>13,Lt=0|S[6],Et=8191&Lt,de=Lt>>>13,Pt=0|S[7],Mt=8191&Pt,K=Pt>>>13,Y=0|S[8],V=8191&Y,U=Y>>>13,W=0|S[9],et=8191&W,dt=W>>>13;o.negative=M.negative^d.negative,o.length=19;var ut=(y+(a=Math.imul(b,Ut))|0)+((8191&(f=(f=Math.imul(b,Te))+Math.imul(D,Ut)|0))<<13)|0;y=((h=Math.imul(D,Te))+(f>>>13)|0)+(ut>>>26)|0,ut&=67108863,a=Math.imul(F,Ut),f=(f=Math.imul(F,Te))+Math.imul(q,Ut)|0,h=Math.imul(q,Te);var ht=(y+(a=a+Math.imul(b,X)|0)|0)+((8191&(f=(f=f+Math.imul(b,st)|0)+Math.imul(D,X)|0))<<13)|0;y=((h=h+Math.imul(D,st)|0)+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,a=Math.imul(at,Ut),f=(f=Math.imul(at,Te))+Math.imul(Bt,Ut)|0,h=Math.imul(Bt,Te),a=a+Math.imul(F,X)|0,f=(f=f+Math.imul(F,st)|0)+Math.imul(q,X)|0,h=h+Math.imul(q,st)|0;var zt=(y+(a=a+Math.imul(b,$)|0)|0)+((8191&(f=(f=f+Math.imul(b,gt)|0)+Math.imul(D,$)|0))<<13)|0;y=((h=h+Math.imul(D,gt)|0)+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,a=Math.imul(pt,Ut),f=(f=Math.imul(pt,Te))+Math.imul(Ft,Ut)|0,h=Math.imul(Ft,Te),a=a+Math.imul(at,X)|0,f=(f=f+Math.imul(at,st)|0)+Math.imul(Bt,X)|0,h=h+Math.imul(Bt,st)|0,a=a+Math.imul(F,$)|0,f=(f=f+Math.imul(F,gt)|0)+Math.imul(q,$)|0,h=h+Math.imul(q,gt)|0;var Wt=(y+(a=a+Math.imul(b,mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,vt)|0)+Math.imul(D,mt)|0))<<13)|0;y=((h=h+Math.imul(D,vt)|0)+(f>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,a=Math.imul(ct,Ut),f=(f=Math.imul(ct,Te))+Math.imul(Tt,Ut)|0,h=Math.imul(Tt,Te),a=a+Math.imul(pt,X)|0,f=(f=f+Math.imul(pt,st)|0)+Math.imul(Ft,X)|0,h=h+Math.imul(Ft,st)|0,a=a+Math.imul(at,$)|0,f=(f=f+Math.imul(at,gt)|0)+Math.imul(Bt,$)|0,h=h+Math.imul(Bt,gt)|0,a=a+Math.imul(F,mt)|0,f=(f=f+Math.imul(F,vt)|0)+Math.imul(q,mt)|0,h=h+Math.imul(q,vt)|0;var ye=(y+(a=a+Math.imul(b,_t)|0)|0)+((8191&(f=(f=f+Math.imul(b,Gt)|0)+Math.imul(D,_t)|0))<<13)|0;y=((h=h+Math.imul(D,Gt)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(k,Ut),f=(f=Math.imul(k,Te))+Math.imul(T,Ut)|0,h=Math.imul(T,Te),a=a+Math.imul(ct,X)|0,f=(f=f+Math.imul(ct,st)|0)+Math.imul(Tt,X)|0,h=h+Math.imul(Tt,st)|0,a=a+Math.imul(pt,$)|0,f=(f=f+Math.imul(pt,gt)|0)+Math.imul(Ft,$)|0,h=h+Math.imul(Ft,gt)|0,a=a+Math.imul(at,mt)|0,f=(f=f+Math.imul(at,vt)|0)+Math.imul(Bt,mt)|0,h=h+Math.imul(Bt,vt)|0,a=a+Math.imul(F,_t)|0,f=(f=f+Math.imul(F,Gt)|0)+Math.imul(q,_t)|0,h=h+Math.imul(q,Gt)|0;var Yt=(y+(a=a+Math.imul(b,wt)|0)|0)+((8191&(f=(f=f+Math.imul(b,se)|0)+Math.imul(D,wt)|0))<<13)|0;y=((h=h+Math.imul(D,se)|0)+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Ut),f=(f=Math.imul(j,Te))+Math.imul(rt,Ut)|0,h=Math.imul(rt,Te),a=a+Math.imul(k,X)|0,f=(f=f+Math.imul(k,st)|0)+Math.imul(T,X)|0,h=h+Math.imul(T,st)|0,a=a+Math.imul(ct,$)|0,f=(f=f+Math.imul(ct,gt)|0)+Math.imul(Tt,$)|0,h=h+Math.imul(Tt,gt)|0,a=a+Math.imul(pt,mt)|0,f=(f=f+Math.imul(pt,vt)|0)+Math.imul(Ft,mt)|0,h=h+Math.imul(Ft,vt)|0,a=a+Math.imul(at,_t)|0,f=(f=f+Math.imul(at,Gt)|0)+Math.imul(Bt,_t)|0,h=h+Math.imul(Bt,Gt)|0,a=a+Math.imul(F,wt)|0,f=(f=f+Math.imul(F,se)|0)+Math.imul(q,wt)|0,h=h+Math.imul(q,se)|0;var pe=(y+(a=a+Math.imul(b,Et)|0)|0)+((8191&(f=(f=f+Math.imul(b,de)|0)+Math.imul(D,Et)|0))<<13)|0;y=((h=h+Math.imul(D,de)|0)+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,a=Math.imul(ot,Ut),f=(f=Math.imul(ot,Te))+Math.imul(qt,Ut)|0,h=Math.imul(qt,Te),a=a+Math.imul(j,X)|0,f=(f=f+Math.imul(j,st)|0)+Math.imul(rt,X)|0,h=h+Math.imul(rt,st)|0,a=a+Math.imul(k,$)|0,f=(f=f+Math.imul(k,gt)|0)+Math.imul(T,$)|0,h=h+Math.imul(T,gt)|0,a=a+Math.imul(ct,mt)|0,f=(f=f+Math.imul(ct,vt)|0)+Math.imul(Tt,mt)|0,h=h+Math.imul(Tt,vt)|0,a=a+Math.imul(pt,_t)|0,f=(f=f+Math.imul(pt,Gt)|0)+Math.imul(Ft,_t)|0,h=h+Math.imul(Ft,Gt)|0,a=a+Math.imul(at,wt)|0,f=(f=f+Math.imul(at,se)|0)+Math.imul(Bt,wt)|0,h=h+Math.imul(Bt,se)|0,a=a+Math.imul(F,Et)|0,f=(f=f+Math.imul(F,de)|0)+Math.imul(q,Et)|0,h=h+Math.imul(q,de)|0;var ve=(y+(a=a+Math.imul(b,Mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,K)|0)+Math.imul(D,Mt)|0))<<13)|0;y=((h=h+Math.imul(D,K)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(xt,Ut),f=(f=Math.imul(xt,Te))+Math.imul(Qt,Ut)|0,h=Math.imul(Qt,Te),a=a+Math.imul(ot,X)|0,f=(f=f+Math.imul(ot,st)|0)+Math.imul(qt,X)|0,h=h+Math.imul(qt,st)|0,a=a+Math.imul(j,$)|0,f=(f=f+Math.imul(j,gt)|0)+Math.imul(rt,$)|0,h=h+Math.imul(rt,gt)|0,a=a+Math.imul(k,mt)|0,f=(f=f+Math.imul(k,vt)|0)+Math.imul(T,mt)|0,h=h+Math.imul(T,vt)|0,a=a+Math.imul(ct,_t)|0,f=(f=f+Math.imul(ct,Gt)|0)+Math.imul(Tt,_t)|0,h=h+Math.imul(Tt,Gt)|0,a=a+Math.imul(pt,wt)|0,f=(f=f+Math.imul(pt,se)|0)+Math.imul(Ft,wt)|0,h=h+Math.imul(Ft,se)|0,a=a+Math.imul(at,Et)|0,f=(f=f+Math.imul(at,de)|0)+Math.imul(Bt,Et)|0,h=h+Math.imul(Bt,de)|0,a=a+Math.imul(F,Mt)|0,f=(f=f+Math.imul(F,K)|0)+Math.imul(q,Mt)|0,h=h+Math.imul(q,K)|0;var ge=(y+(a=a+Math.imul(b,V)|0)|0)+((8191&(f=(f=f+Math.imul(b,U)|0)+Math.imul(D,V)|0))<<13)|0;y=((h=h+Math.imul(D,U)|0)+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,a=Math.imul(Dt,Ut),f=(f=Math.imul(Dt,Te))+Math.imul(Se,Ut)|0,h=Math.imul(Se,Te),a=a+Math.imul(xt,X)|0,f=(f=f+Math.imul(xt,st)|0)+Math.imul(Qt,X)|0,h=h+Math.imul(Qt,st)|0,a=a+Math.imul(ot,$)|0,f=(f=f+Math.imul(ot,gt)|0)+Math.imul(qt,$)|0,h=h+Math.imul(qt,gt)|0,a=a+Math.imul(j,mt)|0,f=(f=f+Math.imul(j,vt)|0)+Math.imul(rt,mt)|0,h=h+Math.imul(rt,vt)|0,a=a+Math.imul(k,_t)|0,f=(f=f+Math.imul(k,Gt)|0)+Math.imul(T,_t)|0,h=h+Math.imul(T,Gt)|0,a=a+Math.imul(ct,wt)|0,f=(f=f+Math.imul(ct,se)|0)+Math.imul(Tt,wt)|0,h=h+Math.imul(Tt,se)|0,a=a+Math.imul(pt,Et)|0,f=(f=f+Math.imul(pt,de)|0)+Math.imul(Ft,Et)|0,h=h+Math.imul(Ft,de)|0,a=a+Math.imul(at,Mt)|0,f=(f=f+Math.imul(at,K)|0)+Math.imul(Bt,Mt)|0,h=h+Math.imul(Bt,K)|0,a=a+Math.imul(F,V)|0,f=(f=f+Math.imul(F,U)|0)+Math.imul(q,V)|0,h=h+Math.imul(q,U)|0;var ie=(y+(a=a+Math.imul(b,et)|0)|0)+((8191&(f=(f=f+Math.imul(b,dt)|0)+Math.imul(D,et)|0))<<13)|0;y=((h=h+Math.imul(D,dt)|0)+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,a=Math.imul(Dt,X),f=(f=Math.imul(Dt,st))+Math.imul(Se,X)|0,h=Math.imul(Se,st),a=a+Math.imul(xt,$)|0,f=(f=f+Math.imul(xt,gt)|0)+Math.imul(Qt,$)|0,h=h+Math.imul(Qt,gt)|0,a=a+Math.imul(ot,mt)|0,f=(f=f+Math.imul(ot,vt)|0)+Math.imul(qt,mt)|0,h=h+Math.imul(qt,vt)|0,a=a+Math.imul(j,_t)|0,f=(f=f+Math.imul(j,Gt)|0)+Math.imul(rt,_t)|0,h=h+Math.imul(rt,Gt)|0,a=a+Math.imul(k,wt)|0,f=(f=f+Math.imul(k,se)|0)+Math.imul(T,wt)|0,h=h+Math.imul(T,se)|0,a=a+Math.imul(ct,Et)|0,f=(f=f+Math.imul(ct,de)|0)+Math.imul(Tt,Et)|0,h=h+Math.imul(Tt,de)|0,a=a+Math.imul(pt,Mt)|0,f=(f=f+Math.imul(pt,K)|0)+Math.imul(Ft,Mt)|0,h=h+Math.imul(Ft,K)|0,a=a+Math.imul(at,V)|0,f=(f=f+Math.imul(at,U)|0)+Math.imul(Bt,V)|0,h=h+Math.imul(Bt,U)|0;var ue=(y+(a=a+Math.imul(F,et)|0)|0)+((8191&(f=(f=f+Math.imul(F,dt)|0)+Math.imul(q,et)|0))<<13)|0;y=((h=h+Math.imul(q,dt)|0)+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,a=Math.imul(Dt,$),f=(f=Math.imul(Dt,gt))+Math.imul(Se,$)|0,h=Math.imul(Se,gt),a=a+Math.imul(xt,mt)|0,f=(f=f+Math.imul(xt,vt)|0)+Math.imul(Qt,mt)|0,h=h+Math.imul(Qt,vt)|0,a=a+Math.imul(ot,_t)|0,f=(f=f+Math.imul(ot,Gt)|0)+Math.imul(qt,_t)|0,h=h+Math.imul(qt,Gt)|0,a=a+Math.imul(j,wt)|0,f=(f=f+Math.imul(j,se)|0)+Math.imul(rt,wt)|0,h=h+Math.imul(rt,se)|0,a=a+Math.imul(k,Et)|0,f=(f=f+Math.imul(k,de)|0)+Math.imul(T,Et)|0,h=h+Math.imul(T,de)|0,a=a+Math.imul(ct,Mt)|0,f=(f=f+Math.imul(ct,K)|0)+Math.imul(Tt,Mt)|0,h=h+Math.imul(Tt,K)|0,a=a+Math.imul(pt,V)|0,f=(f=f+Math.imul(pt,U)|0)+Math.imul(Ft,V)|0,h=h+Math.imul(Ft,U)|0;var fe=(y+(a=a+Math.imul(at,et)|0)|0)+((8191&(f=(f=f+Math.imul(at,dt)|0)+Math.imul(Bt,et)|0))<<13)|0;y=((h=h+Math.imul(Bt,dt)|0)+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,a=Math.imul(Dt,mt),f=(f=Math.imul(Dt,vt))+Math.imul(Se,mt)|0,h=Math.imul(Se,vt),a=a+Math.imul(xt,_t)|0,f=(f=f+Math.imul(xt,Gt)|0)+Math.imul(Qt,_t)|0,h=h+Math.imul(Qt,Gt)|0,a=a+Math.imul(ot,wt)|0,f=(f=f+Math.imul(ot,se)|0)+Math.imul(qt,wt)|0,h=h+Math.imul(qt,se)|0,a=a+Math.imul(j,Et)|0,f=(f=f+Math.imul(j,de)|0)+Math.imul(rt,Et)|0,h=h+Math.imul(rt,de)|0,a=a+Math.imul(k,Mt)|0,f=(f=f+Math.imul(k,K)|0)+Math.imul(T,Mt)|0,h=h+Math.imul(T,K)|0,a=a+Math.imul(ct,V)|0,f=(f=f+Math.imul(ct,U)|0)+Math.imul(Tt,V)|0,h=h+Math.imul(Tt,U)|0;var ce=(y+(a=a+Math.imul(pt,et)|0)|0)+((8191&(f=(f=f+Math.imul(pt,dt)|0)+Math.imul(Ft,et)|0))<<13)|0;y=((h=h+Math.imul(Ft,dt)|0)+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,a=Math.imul(Dt,_t),f=(f=Math.imul(Dt,Gt))+Math.imul(Se,_t)|0,h=Math.imul(Se,Gt),a=a+Math.imul(xt,wt)|0,f=(f=f+Math.imul(xt,se)|0)+Math.imul(Qt,wt)|0,h=h+Math.imul(Qt,se)|0,a=a+Math.imul(ot,Et)|0,f=(f=f+Math.imul(ot,de)|0)+Math.imul(qt,Et)|0,h=h+Math.imul(qt,de)|0,a=a+Math.imul(j,Mt)|0,f=(f=f+Math.imul(j,K)|0)+Math.imul(rt,Mt)|0,h=h+Math.imul(rt,K)|0,a=a+Math.imul(k,V)|0,f=(f=f+Math.imul(k,U)|0)+Math.imul(T,V)|0,h=h+Math.imul(T,U)|0;var Kt=(y+(a=a+Math.imul(ct,et)|0)|0)+((8191&(f=(f=f+Math.imul(ct,dt)|0)+Math.imul(Tt,et)|0))<<13)|0;y=((h=h+Math.imul(Tt,dt)|0)+(f>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,a=Math.imul(Dt,wt),f=(f=Math.imul(Dt,se))+Math.imul(Se,wt)|0,h=Math.imul(Se,se),a=a+Math.imul(xt,Et)|0,f=(f=f+Math.imul(xt,de)|0)+Math.imul(Qt,Et)|0,h=h+Math.imul(Qt,de)|0,a=a+Math.imul(ot,Mt)|0,f=(f=f+Math.imul(ot,K)|0)+Math.imul(qt,Mt)|0,h=h+Math.imul(qt,K)|0,a=a+Math.imul(j,V)|0,f=(f=f+Math.imul(j,U)|0)+Math.imul(rt,V)|0,h=h+Math.imul(rt,U)|0;var oe=(y+(a=a+Math.imul(k,et)|0)|0)+((8191&(f=(f=f+Math.imul(k,dt)|0)+Math.imul(T,et)|0))<<13)|0;y=((h=h+Math.imul(T,dt)|0)+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,a=Math.imul(Dt,Et),f=(f=Math.imul(Dt,de))+Math.imul(Se,Et)|0,h=Math.imul(Se,de),a=a+Math.imul(xt,Mt)|0,f=(f=f+Math.imul(xt,K)|0)+Math.imul(Qt,Mt)|0,h=h+Math.imul(Qt,K)|0,a=a+Math.imul(ot,V)|0,f=(f=f+Math.imul(ot,U)|0)+Math.imul(qt,V)|0,h=h+Math.imul(qt,U)|0;var Jt=(y+(a=a+Math.imul(j,et)|0)|0)+((8191&(f=(f=f+Math.imul(j,dt)|0)+Math.imul(rt,et)|0))<<13)|0;y=((h=h+Math.imul(rt,dt)|0)+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(Dt,Mt),f=(f=Math.imul(Dt,K))+Math.imul(Se,Mt)|0,h=Math.imul(Se,K),a=a+Math.imul(xt,V)|0,f=(f=f+Math.imul(xt,U)|0)+Math.imul(Qt,V)|0,h=h+Math.imul(Qt,U)|0;var le=(y+(a=a+Math.imul(ot,et)|0)|0)+((8191&(f=(f=f+Math.imul(ot,dt)|0)+Math.imul(qt,et)|0))<<13)|0;y=((h=h+Math.imul(qt,dt)|0)+(f>>>13)|0)+(le>>>26)|0,le&=67108863,a=Math.imul(Dt,V),f=(f=Math.imul(Dt,U))+Math.imul(Se,V)|0,h=Math.imul(Se,U);var ae=(y+(a=a+Math.imul(xt,et)|0)|0)+((8191&(f=(f=f+Math.imul(xt,dt)|0)+Math.imul(Qt,et)|0))<<13)|0;y=((h=h+Math.imul(Qt,dt)|0)+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863;var ne=(y+(a=Math.imul(Dt,et))|0)+((8191&(f=(f=Math.imul(Dt,dt))+Math.imul(Se,et)|0))<<13)|0;return y=((h=Math.imul(Se,dt))+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,I[0]=ut,I[1]=ht,I[2]=zt,I[3]=Wt,I[4]=ye,I[5]=Yt,I[6]=pe,I[7]=ve,I[8]=ge,I[9]=ie,I[10]=ue,I[11]=fe,I[12]=ce,I[13]=Kt,I[14]=oe,I[15]=Jt,I[16]=le,I[17]=ae,I[18]=ne,y!==0&&(I[19]=y,o.length++),o};function B(M,d,o){o.negative=d.negative^M.negative,o.length=M.length+d.length;for(var a=0,f=0,h=0;h>>26)|0)>>>26,g&=67108863}o.words[h]=S,a=g,g=f}return a!==0?o.words[h]=a:o.length--,o._strip()}function P(M,d,o){return B(M,d,o)}Math.imul||(A=x),s.prototype.mulTo=function(M,d){var o=this.length+M.length;return this.length===10&&M.length===10?A(this,M,d):o<63?x(this,M,d):o<1024?B(this,M,d):P(this,M,d)},s.prototype.mul=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),this.mulTo(M,d)},s.prototype.mulf=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),P(this,M,d)},s.prototype.imul=function(M){return this.clone().mulTo(M,this)},s.prototype.imuln=function(M){var d=M<0;d&&(M=-M),e(typeof M=="number"),e(M<67108864);for(var o=0,a=0;a>=26,o+=f/67108864|0,o+=h>>>26,this.words[a]=67108863&h}return o!==0&&(this.words[a]=o,this.length++),d?this.ineg():this},s.prototype.muln=function(M){return this.clone().imuln(M)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(M){var d=function(h){for(var g=new Array(h.bitLength()),S=0;S>>y&1}return g}(M);if(d.length===0)return new s(1);for(var o=this,a=0;a=0);var d,o=M%26,a=(M-o)/26,f=67108863>>>26-o<<26-o;if(o!==0){var h=0;for(d=0;d>>26-o}h&&(this.words[d]=h,this.length++)}if(a!==0){for(d=this.length-1;d>=0;d--)this.words[d+a]=this.words[d];for(d=0;d=0),a=d?(d-d%26)/26:0;var f=M%26,h=Math.min((M-f)/26,this.length),g=67108863^67108863>>>f<h)for(this.length-=h,I=0;I=0&&(y!==0||I>=a);I--){var u=0|this.words[I];this.words[I]=y<<26-f|u>>>f,y=u&g}return S&&y!==0&&(S.words[S.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(M,d,o){return e(this.negative===0),this.iushrn(M,d,o)},s.prototype.shln=function(M){return this.clone().ishln(M)},s.prototype.ushln=function(M){return this.clone().iushln(M)},s.prototype.shrn=function(M){return this.clone().ishrn(M)},s.prototype.ushrn=function(M){return this.clone().iushrn(M)},s.prototype.testn=function(M){e(typeof M=="number"&&M>=0);var d=M%26,o=(M-d)/26,a=1<=0);var d=M%26,o=(M-d)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=o)return this;if(d!==0&&o++,this.length=Math.min(o,this.length),d!==0){var a=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(M){if(e(typeof M=="number"),e(M<67108864),M<0)return this.iaddn(-M);if(this.negative!==0)return this.negative=0,this.iaddn(M),this.negative=1,this;if(this.words[0]-=M,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(S/67108864|0),this.words[a+o]=67108863&f}for(;a>26,this.words[a+o]=67108863&f;if(g===0)return this._strip();for(e(g===-1),g=0,a=0;a>26,this.words[a]=67108863&f;return this.negative=1,this._strip()},s.prototype._wordDiv=function(M,d){var o=(this.length,M.length),a=this.clone(),f=M,h=0|f.words[f.length-1];(o=26-this._countBits(h))!=0&&(f=f.ushln(o),a.iushln(o),h=0|f.words[f.length-1]);var g,S=a.length-f.length;if(d!=="mod"){(g=new s(null)).length=S+1,g.words=new Array(g.length);for(var I=0;I=0;u--){var b=67108864*(0|a.words[f.length+u])+(0|a.words[f.length+u-1]);for(b=Math.min(b/h|0,67108863),a._ishlnsubmul(f,b,u);a.negative!==0;)b--,a.negative=0,a._ishlnsubmul(f,1,u),a.isZero()||(a.negative^=1);g&&(g.words[u]=b)}return g&&g._strip(),a._strip(),d!=="div"&&o!==0&&a.iushrn(o),{div:g||null,mod:a}},s.prototype.divmod=function(M,d,o){return e(!M.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:this.negative!==0&&M.negative===0?(h=this.neg().divmod(M,d),d!=="mod"&&(a=h.div.neg()),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.iadd(M)),{div:a,mod:f}):this.negative===0&&M.negative!==0?(h=this.divmod(M.neg(),d),d!=="mod"&&(a=h.div.neg()),{div:a,mod:h.mod}):this.negative&M.negative?(h=this.neg().divmod(M.neg(),d),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.isub(M)),{div:h.div,mod:f}):M.length>this.length||this.cmp(M)<0?{div:new s(0),mod:this}:M.length===1?d==="div"?{div:this.divn(M.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(M.words[0]))}:{div:this.divn(M.words[0]),mod:new s(this.modrn(M.words[0]))}:this._wordDiv(M,d);var a,f,h},s.prototype.div=function(M){return this.divmod(M,"div",!1).div},s.prototype.mod=function(M){return this.divmod(M,"mod",!1).mod},s.prototype.umod=function(M){return this.divmod(M,"mod",!0).mod},s.prototype.divRound=function(M){var d=this.divmod(M);if(d.mod.isZero())return d.div;var o=d.div.negative!==0?d.mod.isub(M):d.mod,a=M.ushrn(1),f=M.andln(1),h=o.cmp(a);return h<0||f===1&&h===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=(1<<26)%M,a=0,f=this.length-1;f>=0;f--)a=(o*a+(0|this.words[f]))%M;return d?-a:a},s.prototype.modn=function(M){return this.modrn(M)},s.prototype.idivn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var f=(0|this.words[a])+67108864*o;this.words[a]=f/M|0,o=f%M}return this._strip(),d?this.ineg():this},s.prototype.divn=function(M){return this.clone().idivn(M)},s.prototype.egcd=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a=new s(1),f=new s(0),h=new s(0),g=new s(1),S=0;d.isEven()&&o.isEven();)d.iushrn(1),o.iushrn(1),++S;for(var I=o.clone(),y=d.clone();!d.isZero();){for(var u=0,b=1;!(d.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(d.iushrn(u);u-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(I),f.isub(y)),a.iushrn(1),f.iushrn(1);for(var D=0,Z=1;!(o.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(o.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(I),g.isub(y)),h.iushrn(1),g.iushrn(1);d.cmp(o)>=0?(d.isub(o),a.isub(h),f.isub(g)):(o.isub(d),h.isub(a),g.isub(f))}return{a:h,b:g,gcd:o.iushln(S)}},s.prototype._invmp=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a,f=new s(1),h=new s(0),g=o.clone();d.cmpn(1)>0&&o.cmpn(1)>0;){for(var S=0,I=1;!(d.words[0]&I)&&S<26;++S,I<<=1);if(S>0)for(d.iushrn(S);S-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var y=0,u=1;!(o.words[0]&u)&&y<26;++y,u<<=1);if(y>0)for(o.iushrn(y);y-- >0;)h.isOdd()&&h.iadd(g),h.iushrn(1);d.cmp(o)>=0?(d.isub(o),f.isub(h)):(o.isub(d),h.isub(f))}return(a=d.cmpn(1)===0?f:h).cmpn(0)<0&&a.iadd(M),a},s.prototype.gcd=function(M){if(this.isZero())return M.abs();if(M.isZero())return this.abs();var d=this.clone(),o=M.clone();d.negative=0,o.negative=0;for(var a=0;d.isEven()&&o.isEven();a++)d.iushrn(1),o.iushrn(1);for(;;){for(;d.isEven();)d.iushrn(1);for(;o.isEven();)o.iushrn(1);var f=d.cmp(o);if(f<0){var h=d;d=o,o=h}else if(f===0||o.cmpn(1)===0)break;d.isub(o)}return o.iushln(a)},s.prototype.invm=function(M){return this.egcd(M).a.umod(M)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(M){return this.words[0]&M},s.prototype.bincn=function(M){e(typeof M=="number");var d=M%26,o=(M-d)/26,a=1<>>26,g&=67108863,this.words[h]=g}return f!==0&&(this.words[h]=f,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(M){var d,o=M<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;if(this._strip(),this.length>1)d=1;else{o&&(M=-M),e(M<=67108863,"Number is too big");var a=0|this.words[0];d=a===M?0:aM.length)return 1;if(this.length=0;o--){var a=0|this.words[o],f=0|M.words[o];if(a!==f){af&&(d=1);break}}return d},s.prototype.gtn=function(M){return this.cmpn(M)===1},s.prototype.gt=function(M){return this.cmp(M)===1},s.prototype.gten=function(M){return this.cmpn(M)>=0},s.prototype.gte=function(M){return this.cmp(M)>=0},s.prototype.ltn=function(M){return this.cmpn(M)===-1},s.prototype.lt=function(M){return this.cmp(M)===-1},s.prototype.lten=function(M){return this.cmpn(M)<=0},s.prototype.lte=function(M){return this.cmp(M)<=0},s.prototype.eqn=function(M){return this.cmpn(M)===0},s.prototype.eq=function(M){return this.cmp(M)===0},s.red=function(M){return new nt(M)},s.prototype.toRed=function(M){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),M.convertTo(this)._forceRed(M)},s.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(M){return this.red=M,this},s.prototype.forceRed=function(M){return e(!this.red,"Already a number in reduction context"),this._forceRed(M)},s.prototype.redAdd=function(M){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,M)},s.prototype.redIAdd=function(M){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,M)},s.prototype.redSub=function(M){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,M)},s.prototype.redISub=function(M){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,M)},s.prototype.redShl=function(M){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,M)},s.prototype.redMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.mul(this,M)},s.prototype.redIMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.imul(this,M)},s.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(M){return e(this.red&&!M.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,M)};var R={k256:null,p224:null,p192:null,p25519:null};function C(M,d){this.name=M,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function O(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function z(){C.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function H(){C.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function tt(){C.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function nt(M){if(typeof M=="string"){var d=s._prime(M);this.m=d.p,this.prime=d}else e(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}function G(M){nt.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)}C.prototype._tmp=function(){var M=new s(null);return M.words=new Array(Math.ceil(this.n/13)),M},C.prototype.ireduce=function(M){var d,o=M;do this.split(o,this.tmp),d=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength();while(d>this.n);var a=d0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},C.prototype.split=function(M,d){M.iushrn(this.n,0,d)},C.prototype.imulK=function(M){return M.imul(this.k)},n(O,C),O.prototype.split=function(M,d){for(var o=4194303,a=Math.min(M.length,9),f=0;f>>22,h=g}h>>>=22,M.words[f-10]=h,h===0&&M.length>10?M.length-=10:M.length-=9},O.prototype.imulK=function(M){M.words[M.length]=0,M.words[M.length+1]=0,M.length+=2;for(var d=0,o=0;o>>=26,M.words[o]=f,d=a}return d!==0&&(M.words[M.length++]=d),M},s._prime=function(M){if(R[M])return R[M];var d;if(M==="k256")d=new O;else if(M==="p224")d=new z;else if(M==="p192")d=new H;else{if(M!=="p25519")throw new Error("Unknown prime "+M);d=new tt}return R[M]=d,d},nt.prototype._verify1=function(M){e(M.negative===0,"red works only with positives"),e(M.red,"red works only with red numbers")},nt.prototype._verify2=function(M,d){e((M.negative|d.negative)==0,"red works only with positives"),e(M.red&&M.red===d.red,"red works only with red numbers")},nt.prototype.imod=function(M){return this.prime?this.prime.ireduce(M)._forceRed(this):(m(M,M.umod(this.m)._forceRed(this)),M)},nt.prototype.neg=function(M){return M.isZero()?M.clone():this.m.sub(M)._forceRed(this)},nt.prototype.add=function(M,d){this._verify2(M,d);var o=M.add(d);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},nt.prototype.iadd=function(M,d){this._verify2(M,d);var o=M.iadd(d);return o.cmp(this.m)>=0&&o.isub(this.m),o},nt.prototype.sub=function(M,d){this._verify2(M,d);var o=M.sub(d);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},nt.prototype.isub=function(M,d){this._verify2(M,d);var o=M.isub(d);return o.cmpn(0)<0&&o.iadd(this.m),o},nt.prototype.shl=function(M,d){return this._verify1(M),this.imod(M.ushln(d))},nt.prototype.imul=function(M,d){return this._verify2(M,d),this.imod(M.imul(d))},nt.prototype.mul=function(M,d){return this._verify2(M,d),this.imod(M.mul(d))},nt.prototype.isqr=function(M){return this.imul(M,M.clone())},nt.prototype.sqr=function(M){return this.mul(M,M)},nt.prototype.sqrt=function(M){if(M.isZero())return M.clone();var d=this.m.andln(3);if(e(d%2==1),d===3){var o=this.m.add(new s(1)).iushrn(2);return this.pow(M,o)}for(var a=this.m.subn(1),f=0;!a.isZero()&&a.andln(1)===0;)f++,a.iushrn(1);e(!a.isZero());var h=new s(1).toRed(this),g=h.redNeg(),S=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,S).cmp(g)!==0;)I.redIAdd(g);for(var y=this.pow(I,a),u=this.pow(M,a.addn(1).iushrn(1)),b=this.pow(M,a),D=f;b.cmp(h)!==0;){for(var Z=b,F=0;Z.cmp(h)!==0;F++)Z=Z.redSqr();e(F=0;a--){for(var I=d.words[a],y=S-1;y>=0;y--){var u=I>>y&1;f!==o[0]&&(f=this.sqr(f)),u!==0||h!==0?(h<<=1,h|=u,(++g==4||a===0&&y===0)&&(f=this.mul(f,o[h]),g=0,h=0)):g=0}S=26}return f},nt.prototype.convertTo=function(M){var d=M.umod(this.m);return d===M?d.clone():d},nt.prototype.convertFrom=function(M){var d=M.clone();return d.red=null,d},s.mont=function(M){return new G(M)},n(G,nt),G.prototype.convertTo=function(M){return this.imod(M.ushln(this.shift))},G.prototype.convertFrom=function(M){var d=this.imod(M.mul(this.rinv));return d.red=null,d},G.prototype.imul=function(M,d){if(M.isZero()||d.isZero())return M.words[0]=0,M.length=1,M;var o=M.imul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.mul=function(M,d){if(M.isZero()||d.isZero())return new s(0)._forceRed(this);var o=M.mul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.invm=function(M){return this.imod(M._invmp(this.m).mul(this.r2))._forceRed(this)}})(lE,$e);var ay=lE.exports,Jc=Yi(ay),F2={exports:{}};(function(r,t){var e=Ae,n=e.Buffer;function s(c,l){for(var p in c)l[p]=c[p]}function i(c,l,p){return n(c,l,p)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=e:(s(e,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(c,l,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,p)},i.alloc=function(c,l,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var m=n(c);return l!==void 0?typeof p=="string"?m.fill(l,p):m.fill(l):m.fill(0),m},i.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},i.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(c)}})(F2,F2.exports);var h0=F2.exports.Buffer,uy=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(A);_[E];){var P=t[_.charCodeAt(E)];if(P===255)return;for(var R=0,C=A-1;(P!==0||R>>0,B[C]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=R,E++}for(var O=A-x;O!==A&&B[O]===0;)O++;var z=h0.allocUnsafe(w+(A-O));z.fill(0,0,w);for(var H=w;O!==A;)z[H++]=B[O++];return z}return{encode:function(_){if((Array.isArray(_)||_ instanceof Uint8Array)&&(_=h0.from(_)),!h0.isBuffer(_))throw new TypeError("Expected Buffer");if(_.length===0)return"";for(var E=0,w=0,x=0,A=_.length;x!==A&&_[x]===0;)x++,E++;for(var B=(A-x)*m+1>>>0,P=new Uint8Array(B);x!==A;){for(var R=_[x],C=0,O=B-1;(R!==0||C>>0,P[O]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=C,x++}for(var z=B-w;z!==B&&P[z]===0;)z++;for(var H=l.repeat(E);zr&t^~r&e,Gz=(r,t,e)=>r&t^r&e^t&e,Yz=new Uint32Array([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]),Os=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Us=new Uint32Array(64);let Xz=class extends tE{constructor(){super(64,32,8,!1),this.A=0|Os[0],this.B=0|Os[1],this.C=0|Os[2],this.D=0|Os[3],this.E=0|Os[4],this.F=0|Os[5],this.G=0|Os[6],this.H=0|Os[7]}get(){const{A:t,B:e,C:n,D:s,E:i,F:c,G:l,H:p}=this;return[t,e,n,s,i,c,l,p]}set(t,e,n,s,i,c,l,p){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|s,this.E=0|i,this.F=0|c,this.G=0|l,this.H=0|p}process(t,e){for(let _=0;_<16;_++,e+=4)Us[_]=t.getUint32(e,!1);for(let _=16;_<64;_++){const E=Us[_-15],w=Us[_-2],x=go(E,7)^go(E,18)^E>>>3,A=go(w,17)^go(w,19)^w>>>10;Us[_]=A+Us[_-7]+x+Us[_-16]|0}let{A:n,B:s,C:i,D:c,E:l,F:p,G:m,H:v}=this;for(let _=0;_<64;_++){const E=v+(go(l,6)^go(l,11)^go(l,25))+Wz(l,p,m)+Yz[_]+Us[_]|0,w=(go(n,2)^go(n,13)^go(n,22))+Gz(n,s,i)|0;v=m,m=p,p=l,l=c+E|0,c=i,i=s,s=n,n=E+w|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,c=c+this.D|0,l=l+this.E|0,p=p+this.F|0,m=m+this.G|0,v=v+this.H|0,this.set(n,s,i,c,l,p,m,v)}roundClean(){Us.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const tu=ny(()=>new Xz);var Cn={},Jz=uy("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function vs(r,t,e){return t<=r&&r<=e}function gl(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function j2(r){this.tokens=[].slice.call(r)}j2.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var Ru=-1;function zp(r,t){if(r)throw TypeError("Decoder error");return t||65533}var yl="utf-8";function bl(r,t){if(!(this instanceof bl))return new bl(r,t);if((r=r!==void 0?String(r).toLowerCase():yl)!==yl)throw new Error("Encoding not supported. Only utf-8 is supported");t=gl(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function wl(r,t){if(!(this instanceof wl))return new wl(r,t);if((r=r!==void 0?String(r).toLowerCase():yl)!==yl)throw new Error("Encoding not supported. Only utf-8 is supported");t=gl(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function Qz(r){var t=r.fatal,e=0,n=0,s=0,i=128,c=191;this.handler=function(l,p){if(p===-1&&s!==0)return s=0,zp(t);if(p===-1)return Ru;if(s===0){if(vs(p,0,127))return p;if(vs(p,194,223))s=1,e=p-192;else if(vs(p,224,239))p===224&&(i=160),p===237&&(c=159),s=2,e=p-224;else{if(!vs(p,240,244))return zp(t);p===240&&(i=144),p===244&&(c=143),s=3,e=p-240}return e<<=6*s,null}if(!vs(p,i,c))return e=s=n=0,i=128,c=191,l.prepend(p),zp(t);if(i=128,c=191,e+=p-128<<6*(s-(n+=1)),n!==s)return null;var m=e;return e=s=n=0,m}}function tq(r){r.fatal,this.handler=function(t,e){if(e===-1)return Ru;if(vs(e,0,127))return e;var n,s;vs(e,128,2047)?(n=1,s=192):vs(e,2048,65535)?(n=2,s=224):vs(e,65536,1114111)&&(n=3,s=240);for(var i=[(e>>6*n)+s];n>0;){var c=e>>6*(n-1);i.push(128|63&c),n-=1}return i}}bl.prototype={decode:function(r,t){var e;e=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),t=gl(t),this._streaming||(this._decoder=new Qz({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var n,s=new j2(e),i=[];!s.endOfStream()&&(n=this._decoder.handler(s,s.read()))!==Ru;)n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n));if(!this._streaming){do{if((n=this._decoder.handler(s,s.read()))===Ru)break;n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n))}while(!s.endOfStream());this._decoder=null}return i.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0)),function(c){for(var l="",p=0;p>10),56320+(1023&m)))}return l}(i)}},wl.prototype={encode:function(r,t){r=r?String(r):"",t=gl(t),this._streaming||(this._encoder=new tq(this._options)),this._streaming=!!t.stream;for(var e,n=[],s=new j2(function(i){for(var c=String(i),l=c.length,p=0,m=[];p57343)m.push(v);else if(56320<=v&&v<=57343)m.push(65533);else if(55296<=v&&v<=56319)if(p===l-1)m.push(65533);else{var _=i.charCodeAt(p+1);if(56320<=_&&_<=57343){var E=1023&v,w=1023&_;m.push(65536+(E<<10)+w),p+=1}else m.push(65533)}p+=1}return m}(r));!s.endOfStream()&&(e=this._encoder.handler(s,s.read()))!==Ru;)Array.isArray(e)?n.push.apply(n,e):n.push(e);if(!this._streaming){for(;(e=this._encoder.handler(s,s.read()))!==Ru;)Array.isArray(e)?n.push.apply(n,e):n.push(e);this._encoder=null}return new Uint8Array(n)}};var eq=Oh(Object.freeze({__proto__:null,TextEncoder:wl,TextDecoder:bl})),rq=$e&&$e.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),nq=$e&&$e.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),yo=$e&&$e.__decorate||function(r,t,e,n){var s,i=arguments.length,c=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,t,e,n);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(c=(i<3?s(c):i>3?s(t,e,c):s(t,e))||c);return i>3&&c&&Object.defineProperty(t,e,c),c},iq=$e&&$e.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&rq(t,r,e);return nq(t,r),t},pE=$e&&$e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Cn,"__esModule",{value:!0});var mE=Cn.deserializeUnchecked=bE=Cn.deserialize=fy=Cn.serialize=Cn.BinaryReader=Cn.BinaryWriter=Cn.BorshError=Cn.baseDecode=Cn.baseEncode=void 0;const Hs=pE(ay),h5=pE(Jz),oq=iq(eq),sq=new(typeof TextDecoder!="function"?oq.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Cn.baseEncode=function(r){return typeof r=="string"&&(r=Zt.Buffer.from(r,"utf8")),h5.default.encode(Zt.Buffer.from(r))},Cn.baseDecode=function(r){return Zt.Buffer.from(h5.default.decode(r))};const qp=1024;let Jn=class extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Cn.BorshError=Jn;let vE=class{constructor(){this.buf=Zt.Buffer.alloc(qp),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Zt.Buffer.concat([this.buf,Zt.Buffer.alloc(qp)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Zt.Buffer.concat([Zt.Buffer.from(this.buf.subarray(0,this.length)),t,Zt.Buffer.alloc(qp)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Zt.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Zt.Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}};function bo(r,t,e){const n=e.value;e.value=function(...s){try{return n.apply(this,s)}catch(i){if(i instanceof RangeError){const c=i.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new Jn("Reached the end of buffer when deserializing")}throw i}}}Cn.BinaryWriter=vE;let gi=class{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new Hs.default(t,"le")}readU128(){const t=this.readBuffer(16);return new Hs.default(t,"le")}readU256(){const t=this.readBuffer(32);return new Hs.default(t,"le")}readU512(){const t=this.readBuffer(64);return new Hs.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Jn(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return sq.decode(e)}catch(n){throw new Jn(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let s=0;s{Ma(r,t,i,n[0],s)});else if(n.kind!==void 0)switch(n.kind){case"option":e==null?s.writeU8(0):(s.writeU8(1),Ma(r,t,e,n.type,s));break;case"map":s.writeU32(e.size),e.forEach((i,c)=>{Ma(r,t,c,n.key,s),Ma(r,t,i,n.value,s)});break;default:throw new Jn(`FieldType ${n} unrecognized`)}else yE(r,e,s)}catch(i){throw i instanceof Jn&&i.addToFieldPath(t),i}}function yE(r,t,e){if(typeof t.borshSerialize=="function")return void t.borshSerialize(e);const n=r.get(t.constructor);if(!n)throw new Jn(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([s,i])=>{Ma(r,s,t[s],i,e)});else{if(n.kind!=="enum")throw new Jn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const s=t[n.field];for(let i=0;iEa(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?Ea(r,t,e.type,n):void 0;if(e.kind==="map"){let s=new Map;const i=n.readU32();for(let c=0;c=n.values.length)throw new Jn(`Enum index: ${s} is out of range`);const[i,c]=n.values[s];return new t({[i]:Ea(r,i,c,e)})}throw new Jn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var bE=Cn.deserialize=function(r,t,e,n=gi){const s=new n(e),i=cy(r,t,s);if(s.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};function ly(r,t){return t.property?r+"["+t.property+"]":r}Ht.Layout=Cr,Ht.nameWithProperty=ly,Ht.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Cr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};let ri=class extends Cr{isCount(){throw new Error("ExternalLayout is abstract")}};Ht.ExternalLayout=ri;class wE extends ri{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){Rf(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}Ht.GreedyCount=wE;class dy extends ri{constructor(t,e=0,n){if(!(t instanceof Cr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof ji||this.layout instanceof so}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}Ht.OffsetLayout=dy;class ji extends Cr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ri&&this.count.encode(t.length,e,n),i}}Ht.Sequence=BE;class PE extends Cr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Cr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){Rf(t);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}Ht.Structure=PE;class py{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}Ht.UnionDiscriminator=py;class xl extends py{constructor(t,e){if(!(t instanceof ri&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}Ht.UnionLayoutDiscriminator=xl;class my extends Cr{constructor(t,e,n){let s;if(t instanceof ji||t instanceof so)s=new xl(new dy(t));else if(t instanceof ri&&t.isCount())s=new xl(t);else{if(!(t instanceof py))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");s=t}if(e===void 0&&(e=null),!(e===null||e instanceof Cr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof ji||t instanceof so)&&(i+=s.layout.span)),super(i,n),this.discriminator=s,this.usesPrefixDiscriminator=t instanceof ji||t instanceof so,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const s=this.discriminator,i=s.decode(t,e),c=this.registry[i];if(c===void 0){const l=this.defaultLayout;let p=0;this.usesPrefixDiscriminator&&(p=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[l.property]=l.decode(t,e+p)}else n=c.decode(t,e);return n}encode(t,e,n=0){const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new RE(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}Ht.Union=my;let RE=class extends Cr{constructor(t,e,n,s){if(!(t instanceof my))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Cr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let s=0;return this.layout&&(s=this.layout.getSpan(t,e+n)),n+s}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};function Au(r){return 0>r&&(r+=4294967296),r}Ht.VariantLayout=RE;class vy extends Cr{constructor(t,e,n){if(!(t instanceof ji||t instanceof so))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Au(t&this.valueMask))throw new TypeError(ly("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Au(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),_r(t).slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ri&&(s=t.length),!(t instanceof Uint8Array&&s===t.length))throw new TypeError(ly("Blob.encode",this)+" requires (length "+s+") Uint8Array as src");if(n+s>e.length)throw new RangeError("encoding overruns Uint8Array");const i=_r(t);return _r(e).write(i.toString("hex"),n,s,"hex"),this.length instanceof ri&&this.length.encode(s,e,n),s}}Ht.Blob=TE;class LE extends Cr{constructor(t){super(-1,t)}getSpan(t,e=0){Rf(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const c=_r(e);return s.copy(c,n),c[n+i]=0,i+1}}Ht.CString=LE;class OE extends Cr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return Rf(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(_r(e),n),i}}Ht.UTF8=OE;class UE extends Cr{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}Ht.Constant=UE,Ht.greedy=(r,t)=>new wE(r,t);var Qs=Ht.offset=(r,t,e)=>new dy(r,t,e),or=Ht.u8=r=>new ji(1,r),Ni=Ht.u16=r=>new ji(2,r);Ht.u24=r=>new ji(3,r);var Ce=Ht.u32=r=>new ji(4,r);Ht.u40=r=>new ji(5,r),Ht.u48=r=>new ji(6,r);var In=Ht.nu64=r=>new xE(r);Ht.u16be=r=>new so(2,r),Ht.u24be=r=>new so(3,r),Ht.u32be=r=>new so(4,r),Ht.u40be=r=>new so(5,r),Ht.u48be=r=>new so(6,r),Ht.nu64be=r=>new _E(r),Ht.s8=r=>new wa(1,r),Ht.s16=r=>new wa(2,r),Ht.s24=r=>new wa(3,r),Ht.s32=r=>new wa(4,r),Ht.s40=r=>new wa(5,r),Ht.s48=r=>new wa(6,r);var xi=Ht.ns64=r=>new ME(r);Ht.s16be=r=>new Eu(2,r),Ht.s24be=r=>new Eu(3,r),Ht.s32be=r=>new Eu(4,r),Ht.s40be=r=>new Eu(5,r),Ht.s48be=r=>new Eu(6,r),Ht.ns64be=r=>new EE(r),Ht.f32=r=>new AE(r),Ht.f32be=r=>new SE(r),Ht.f64=r=>new kE(r),Ht.f64be=r=>new IE(r);var Ue=Ht.struct=(r,t,e)=>new PE(r,t,e);Ht.bits=(r,t,e)=>new vy(r,t,e);var On=Ht.seq=(r,t,e)=>new BE(r,t,e);Ht.union=(r,t,e)=>new my(r,t,e),Ht.unionLayoutDiscriminator=(r,t)=>new xl(r,t);var Or=Ht.blob=(r,t)=>new TE(r,t);Ht.cstr=r=>new LE(r),Ht.utf8=(r,t)=>new OE(r,t),Ht.constant=(r,t)=>new UE(r,t);var Uh={};Object.defineProperty(Uh,"__esModule",{value:!0});var NE=Uh.toBigIntLE=function(r){{const t=Zt.Buffer.from(r);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};Uh.toBigIntBE=function(r){{const t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};var Fp,yy=Uh.toBufferLE=function(r,t){{const e=r.toString(16),n=Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};Uh.toBufferBE=function(r,t){{const e=r.toString(16);return Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex")}};class aq extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function ta(r){return typeof r=="object"&&r!=null}function co(r){return typeof r=="string"?JSON.stringify(r):""+r}function uq(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+co(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*l5(r,t,e,n){(function(s){return ta(s)&&typeof s[Symbol.iterator]=="function"})(r)||(r=[r]);for(const s of r){const i=uq(s,t,e,n);i&&(yield i)}}function*by(r,t,e={}){const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&ta(t.schema)&&ta(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=by(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):ta(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class Qo{constructor(t){const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,m)=>l5(s(p,m),m,this,p):()=>[],this.refiner=i?(p,m)=>l5(i(p,m),m,this,p):()=>[]}assert(t){return DE(t,this)}create(t){return Ee(t,this)}is(t){return zE(t,this)}mask(t){return function(e,n){const s=Qc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e={}){return Qc(t,this,e)}}function DE(r,t){const e=Qc(r,t);if(e[0])throw e[0]}function Ee(r,t){const e=Qc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function zE(r,t){return!Qc(r,t)[0]}function Qc(r,t,e={}){const n=by(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new aq(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function uu(r,t){return new Qo({type:r,schema:null,validator:t})}function Ie(r){return new Qo({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+co(t)})}function Go(){return uu("boolean",r=>typeof r=="boolean")}function wy(r){return uu("instance",t=>t instanceof r||"Expected a `"+r.name+"` instance, but received: "+co(t))}function Wr(r){const t=co(r),e=typeof r;return new Qo({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+co(n)})}function ke(r){return new Qo({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function jt(){return uu("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+co(r))}function Ve(r){return new Qo({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function qE(r,t){return new Qo({type:"record",schema:null,*entries(e){if(ta(e))for(const n in e){const s=e[n];yield[n,n,r],yield[n,s,t]}},validator:e=>ta(e)||"Expected an object, but received: "+co(e)})}function _e(){return uu("string",r=>typeof r=="string"||"Expected a string, but received: "+co(r))}function xy(r){const t=uu("never",()=>!1);return new Qo({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const n=Math.max(r.length,e.length);for(let s=0;sArray.isArray(e)||"Expected an array, but received: "+co(e)})}function we(r){const t=Object.keys(r);return new Qo({type:"type",schema:r,*entries(e){if(ta(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>ta(e)||"Expected an object, but received: "+co(e)})}function ci(r){const t=r.map(e=>e.type).join(" | ");return new Qo({type:"union",schema:null,validator(e,n){const s=[];for(const i of r){const[...c]=by(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+co(e),...s]}})}function Nh(){return uu("unknown",()=>!0)}function Dh(r,t,e){return new Qo({...r,coercer:(n,s)=>zE(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}var fq=new Uint8Array(16);function d5(){if(!Fp&&!(Fp=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Fp(fq)}var cq=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function _l(r){return typeof r=="string"&&cq.test(r)}for(var p5,jp,Sn=[],Kp=0;Kp<256;++Kp)Sn.push((Kp+256).toString(16).substr(1));function X0(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(Sn[r[t+0]]+Sn[r[t+1]]+Sn[r[t+2]]+Sn[r[t+3]]+"-"+Sn[r[t+4]]+Sn[r[t+5]]+"-"+Sn[r[t+6]]+Sn[r[t+7]]+"-"+Sn[r[t+8]]+Sn[r[t+9]]+"-"+Sn[r[t+10]]+Sn[r[t+11]]+Sn[r[t+12]]+Sn[r[t+13]]+Sn[r[t+14]]+Sn[r[t+15]]).toLowerCase();if(!_l(e))throw TypeError("Stringified UUID is invalid");return e}var $p=0,Hp=0;function FE(r){if(!_l(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=255&t,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=255&t,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=255&t,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=255&t,e}function jE(r,t,e){function n(s,i,c,l){if(typeof s=="string"&&(s=function(v){v=unescape(encodeURIComponent(v));for(var _=[],E=0;E>>9<<4)+1}function Vs(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e}function xd(r,t,e,n,s,i){return Vs((c=Vs(Vs(t,r),Vs(n,i)))<<(l=s)|c>>>32-l,e);var c,l}function Kn(r,t,e,n,s,i,c){return xd(t&e|~t&n,r,t,s,i,c)}function $n(r,t,e,n,s,i,c){return xd(t&n|e&~n,r,t,s,i,c)}function Hn(r,t,e,n,s,i,c){return xd(t^e^n,r,t,s,i,c)}function Vn(r,t,e,n,s,i,c){return xd(e^(t|~n),r,t,s,i,c)}var hq=jE("v3",48,function(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>l%32&255,m=parseInt(c.charAt(p>>>4&15)+c.charAt(15&p),16);s.push(m)}return s}(function(n,s){n[s>>5]|=128<>5]|=(255&n[c/8])<>>32-t}var pq=jE("v5",80,function(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s>>0;C=R,R=P,P=Vp(B,30)>>>0,B=A,A=H}e[0]=e[0]+A>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+P>>>0,e[3]=e[3]+R>>>0,e[4]=e[4]+C>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}),mq=pq,vq=Object.freeze({__proto__:null,v1:function(r,t,e){var n=t&&e||0,s=t||new Array(16),i=(r=r||{}).node||p5,c=r.clockseq!==void 0?r.clockseq:jp;if(i==null||c==null){var l=r.random||(r.rng||d5)();i==null&&(i=p5=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),c==null&&(c=jp=16383&(l[6]<<8|l[7]))}var p=r.msecs!==void 0?r.msecs:Date.now(),m=r.nsecs!==void 0?r.nsecs:Hp+1,v=p-$p+(m-Hp)/1e4;if(v<0&&r.clockseq===void 0&&(c=c+1&16383),(v<0||p>$p)&&r.nsecs===void 0&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$p=p,Hp=m,jp=c;var _=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;s[n++]=_>>>24&255,s[n++]=_>>>16&255,s[n++]=_>>>8&255,s[n++]=255&_;var E=p/4294967296*1e4&268435455;s[n++]=E>>>8&255,s[n++]=255&E,s[n++]=E>>>24&15|16,s[n++]=E>>>16&255,s[n++]=c>>>8|128,s[n++]=255&c;for(var w=0;w<6;++w)s[n+w]=i[w];return t||X0(s)},v3:lq,v4:function(r,t,e){var n=(r=r||{}).random||(r.rng||d5)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=n[s];return t}return X0(n)},v5:mq,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!_l(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:_l,stringify:X0,parse:FE}),KE=Oh(vq);const gq=KE.v4;var yq=function(r,t,e,n){if(typeof r!="string")throw new TypeError(r+" must be a string");const s=typeof(n=n||{}).version=="number"?n.version:2;if(s!==1&&s!==2)throw new TypeError(s+" must be 1 or 2");const i={method:r};if(s===2&&(i.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");i.params=t}if(e===void 0){const c=typeof n.generator=="function"?n.generator:function(){return gq()};i.id=c(i,n)}else s===2&&e===null?n.notificationIdNull&&(i.id=null):i.id=e;return i};const bq=KE.v4,wq=yq,th=function(r,t){if(!(this instanceof th))return new th(r,t);t||(t={}),this.options={reviver:t.reviver!==void 0?t.reviver:null,replacer:t.replacer!==void 0?t.replacer:null,generator:t.generator!==void 0?t.generator:function(){return bq()},version:t.version!==void 0?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"&&t.notificationIdNull},this.callServer=r};var xq=th;th.prototype.request=function(r,t,e,n){const s=this;let i=null;const c=Array.isArray(r)&&typeof t=="function";if(this.options.version===1&&c)throw new TypeError("JSON-RPC 1.0 does not support batching");if(c||!c&&r&&typeof r=="object"&&typeof t=="function")n=t,i=r;else{typeof e=="function"&&(n=e,e=void 0);const p=typeof n=="function";try{i=wq(r,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(m){if(p)return n(m);throw m}if(!p)return i}let l;try{l=JSON.stringify(i,this.options.replacer)}catch(p){return n(p)}return this.callServer(l,function(p,m){s._parseResponse(p,m,n)}),i},th.prototype._parseResponse=function(r,t,e){if(r)return void e(r);if(!t)return e();let n;try{n=JSON.parse(t,this.options.reviver)}catch(s){return e(s)}if(e.length===3){if(Array.isArray(n)){const s=function(c){return c.error!==void 0},i=function(c){return!s(c)};return e(null,n.filter(s),n.filter(i))}return e(null,n.error,n.result)}e(null,n)};var l0,_q=Yi(xq),$E={},HE={exports:{}};(l0=HE).exports=function(r){return r&&r.__esModule?r:{default:r}},l0.exports.__esModule=!0,l0.exports.default=l0.exports;var v5,g5,Zp,y5,VE=HE.exports,b5={exports:{}},w5={exports:{}};function zh(){return v5||(v5=1,function(r){function t(e){return r.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(w5)),w5.exports}function Mq(){if(y5)return Zp;y5=1;var r=(g5||(g5=1,function(t){var e=zh().default;function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=n=function(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var s,i={},c=Object.prototype,l=c.hasOwnProperty,p=Object.defineProperty||function(u,b,D){u[b]=D.value},m=typeof Symbol=="function"?Symbol:{},v=m.iterator||"@@iterator",_=m.asyncIterator||"@@asyncIterator",E=m.toStringTag||"@@toStringTag";function w(u,b,D){return Object.defineProperty(u,b,{value:D,enumerable:!0,configurable:!0,writable:!0}),u[b]}try{w({},"")}catch{w=function(b,D,Z){return b[D]=Z}}function x(u,b,D,Z){var F=b&&b.prototype instanceof z?b:z,q=Object.create(F.prototype),it=new I(Z||[]);return p(q,"_invoke",{value:f(u,D,it)}),q}function A(u,b,D){try{return{type:"normal",arg:u.call(b,D)}}catch(Z){return{type:"throw",arg:Z}}}i.wrap=x;var B="suspendedStart",P="suspendedYield",R="executing",C="completed",O={};function z(){}function H(){}function tt(){}var nt={};w(nt,v,function(){return this});var G=Object.getPrototypeOf,M=G&&G(G(y([])));M&&M!==c&&l.call(M,v)&&(nt=M);var d=tt.prototype=z.prototype=Object.create(nt);function o(u){["next","throw","return"].forEach(function(b){w(u,b,function(D){return this._invoke(b,D)})})}function a(u,b){function D(F,q,it,at){var Bt=A(u[F],u,q);if(Bt.type!=="throw"){var yt=Bt.arg,pt=yt.value;return pt&&e(pt)=="object"&&l.call(pt,"__await")?b.resolve(pt.__await).then(function(Ft){D("next",Ft,it,at)},function(Ft){D("throw",Ft,it,at)}):b.resolve(pt).then(function(Ft){yt.value=Ft,it(yt)},function(Ft){return D("throw",Ft,it,at)})}at(Bt.arg)}var Z;p(this,"_invoke",{value:function(F,q){function it(){return new b(function(at,Bt){D(F,q,at,Bt)})}return Z=Z?Z.then(it,it):it()}})}function f(u,b,D){var Z=B;return function(F,q){if(Z===R)throw new Error("Generator is already running");if(Z===C){if(F==="throw")throw q;return{value:s,done:!0}}for(D.method=F,D.arg=q;;){var it=D.delegate;if(it){var at=h(it,D);if(at){if(at===O)continue;return at}}if(D.method==="next")D.sent=D._sent=D.arg;else if(D.method==="throw"){if(Z===B)throw Z=C,D.arg;D.dispatchException(D.arg)}else D.method==="return"&&D.abrupt("return",D.arg);Z=R;var Bt=A(u,b,D);if(Bt.type==="normal"){if(Z=D.done?C:P,Bt.arg===O)continue;return{value:Bt.arg,done:D.done}}Bt.type==="throw"&&(Z=C,D.method="throw",D.arg=Bt.arg)}}}function h(u,b){var D=b.method,Z=u.iterator[D];if(Z===s)return b.delegate=null,D==="throw"&&u.iterator.return&&(b.method="return",b.arg=s,h(u,b),b.method==="throw")||D!=="return"&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+D+"' method")),O;var F=A(Z,u.iterator,b.arg);if(F.type==="throw")return b.method="throw",b.arg=F.arg,b.delegate=null,O;var q=F.arg;return q?q.done?(b[u.resultName]=q.value,b.next=u.nextLoc,b.method!=="return"&&(b.method="next",b.arg=s),b.delegate=null,O):q:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,O)}function g(u){var b={tryLoc:u[0]};1 in u&&(b.catchLoc=u[1]),2 in u&&(b.finallyLoc=u[2],b.afterLoc=u[3]),this.tryEntries.push(b)}function S(u){var b=u.completion||{};b.type="normal",delete b.arg,u.completion=b}function I(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(g,this),this.reset(!0)}function y(u){if(u||u===""){var b=u[v];if(b)return b.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var D=-1,Z=function F(){for(;++D=0;--Z){var F=this.tryEntries[Z],q=F.completion;if(F.tryLoc==="root")return D("end");if(F.tryLoc<=this.prev){var it=l.call(F,"catchLoc"),at=l.call(F,"finallyLoc");if(it&&at){if(this.prev=0;--D){var Z=this.tryEntries[D];if(Z.tryLoc<=this.prev&&l.call(Z,"finallyLoc")&&this.prev=0;--b){var D=this.tryEntries[b];if(D.finallyLoc===u)return this.complete(D.completion,D.afterLoc),S(D),O}},catch:function(u){for(var b=this.tryEntries.length-1;b>=0;--b){var D=this.tryEntries[b];if(D.tryLoc===u){var Z=D.completion;if(Z.type==="throw"){var F=Z.arg;S(D)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(u,b,D){return this.delegate={iterator:y(u),resultName:b,nextLoc:D},this.method==="next"&&(this.arg=s),O}},i}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(b5)),b5.exports)();Zp=r;try{regeneratorRuntime=r}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}return Zp}var x5,_5={exports:{}},M5,E5={exports:{}};function ZE(){return M5||(M5=1,function(r){r.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(E5)),E5.exports}var A5,S5,k5,I5={exports:{}},B5={exports:{}},P5={exports:{}};function Eq(){return A5||(A5=1,function(r){var t=zh().default;r.exports=function(e,n){if(t(e)!=="object"||e===null)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var i=s.call(e,n||"default");if(t(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)},r.exports.__esModule=!0,r.exports.default=r.exports}(P5)),P5.exports}function Aq(){return S5||(S5=1,function(r){var t=zh().default,e=Eq();r.exports=function(n){var s=e(n,"string");return t(s)==="symbol"?s:String(s)},r.exports.__esModule=!0,r.exports.default=r.exports}(B5)),B5.exports}function WE(){return k5||(k5=1,function(r){var t=Aq();function e(n,s){for(var i=0;i"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var A,B=(0,m.default)(w);if(x){var P=(0,m.default)(this).constructor;A=Reflect.construct(B,arguments,P)}else A=B.apply(this,arguments);return(0,p.default)(this,A)}}var E=function(w){(0,l.default)(C,w);var x,A,B,P,R=_(C);function C(O){var z,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",tt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},nt=arguments.length>3?arguments[3]:void 0;(0,i.default)(this,C);var G=tt.autoconnect,M=G===void 0||G,d=tt.reconnect,o=d===void 0||d,a=tt.reconnect_interval,f=a===void 0?1e3:a,h=tt.max_reconnects,g=h===void 0?5:h,S=function(I,y){var u={};for(var b in I)Object.prototype.hasOwnProperty.call(I,b)&&y.indexOf(b)<0&&(u[b]=I[b]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function"){var D=0;for(b=Object.getOwnPropertySymbols(I);DH.current_reconnects||H.max_reconnects===0)&&(H.reconnect_timer_id=setTimeout(function(){return H._connect(O,z)},H.reconnect_interval)))})}}]),C}(v.EventEmitter);r.default=E})($E);var Iq=Yi($E),JE={};(function(r){var t=VE;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(m,v){return new p(m,v)};var e=t(ZE()),n=t(WE()),s=t(GE()),i=t(YE()),c=t(XE());function l(m){var v=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,E=(0,c.default)(m);if(v){var w=(0,c.default)(this).constructor;_=Reflect.construct(E,arguments,w)}else _=E.apply(this,arguments);return(0,i.default)(this,_)}}var p=function(m){(0,s.default)(_,m);var v=l(_);function _(E,w,x){var A;return(0,e.default)(this,_),(A=v.call(this)).socket=new window.WebSocket(E,x),A.socket.onopen=function(){return A.emit("open")},A.socket.onmessage=function(B){return A.emit("message",B.data)},A.socket.onerror=function(B){return A.emit("error",B)},A.socket.onclose=function(B){A.emit("close",B.code,B.reason)},A}return(0,n.default)(_,[{key:"send",value:function(E,w,x){var A=x||w;try{this.socket.send(E),A()}catch(B){A(B)}}},{key:"close",value:function(E,w){this.socket.close(E,w)}},{key:"addEventListener",value:function(E,w,x){this.socket.addEventListener(E,w,x)}}]),_}(_y().EventEmitter)})(JE);var Bq=Yi(JE);const[QE,tA,eA]=[[],[],[]],Pq=BigInt(0),oc=BigInt(1),Rq=BigInt(2),Cq=BigInt(7),Tq=BigInt(256),Lq=BigInt(113);for(let r=0,t=oc,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],QE.push(2*(5*n+e)),tA.push((r+1)*(r+2)/2%64);let s=Pq;for(let i=0;i<7;i++)t=(t<>Cq)*Lq)%Tq,t&Rq&&(s^=oc<<(oc<e>32?oE(r,t,e):nE(r,t,e),$5=(r,t,e)=>e>32?sE(r,t,e):iE(r,t,e);class My extends ry{constructor(t,e,n,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,vl(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var c;this.state=new Uint8Array(200),this.state32=(c=this.state,new Uint32Array(c.buffer,c.byteOffset,Math.floor(c.byteLength/4)))}keccak(){(function(t,e=24){const n=new Uint32Array(10);for(let s=24-e;s<24;s++){for(let l=0;l<10;l++)n[l]=t[l]^t[l+10]^t[l+20]^t[l+30]^t[l+40];for(let l=0;l<10;l+=2){const p=(l+8)%10,m=(l+2)%10,v=n[m],_=n[m+1],E=K5(v,_,1)^n[p],w=$5(v,_,1)^n[p+1];for(let x=0;x<50;x+=10)t[l+x]^=E,t[l+x+1]^=w}let i=t[2],c=t[3];for(let l=0;l<24;l++){const p=tA[l],m=K5(i,c,p),v=$5(i,c,p),_=QE[l];i=t[_],c=t[_+1],t[_]=m,t[_+1]=v}for(let l=0;l<50;l+=10){for(let p=0;p<10;p++)n[p]=t[l+p];for(let p=0;p<10;p++)t[l+p]^=~n[(p+2)%10]&n[(p+4)%10]}t[0]^=Oq[s],t[1]^=Uq[s]}n.fill(0)})(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){uf(this);const{blockLen:e,state:n}=this,s=(t=gd(t)).length;for(let i=0;i=n&&this.keccak();const c=Math.min(n-this.posOut,i-s);t.set(e.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return vl(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(XM(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:s,rounds:i,enableXOF:c}=this;return t||(t=new My(e,n,s,c,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=s,t.enableXOF=c,t.destroyed=this.destroyed,t}}const H5=((r,t,e)=>ny(()=>new My(t,r,e)))(1,136,32),{bytesToNumberBE:Nq,hexToBytes:Dq}=Tz,Oa={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:t}=Oa;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");const e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Nq(n),l:r.subarray(e+2)}},toSig(r){const{Err:t}=Oa,e=typeof r=="string"?Dq(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=Oa._parseInt(e.subarray(2)),{d:c,l}=Oa._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:c}},hexFromSig(r){const t=m=>8&Number.parseInt(m[0],16)?"00"+m:m,e=m=>{const v=m.toString(16);return 1&v.length?`0${v}`:v},n=t(e(r.s)),s=t(e(r.r)),i=n.length/2,c=s.length/2,l=e(i),p=e(c);return`30${e(c+i+4)}02${p}${s}02${l}${n}`}},gs=BigInt(0),Ui=BigInt(1);BigInt(2);const V5=BigInt(3);function zq(r){const t=function(x){const A=sy(x);cf(A,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:B,Fp:P,a:R}=A;if(B){if(!P.eql(R,P.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof B!="object"||typeof B.beta!="bigint"||typeof B.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...A})}(r),{Fp:e}=t,n=t.toBytes||((x,A,B)=>{const P=A.toAffine();return Qa(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),s=t.fromBytes||(x=>{const A=x.subarray(1);return{x:e.fromBytes(A.subarray(0,e.BYTES)),y:e.fromBytes(A.subarray(e.BYTES,2*e.BYTES))}});function i(x){const{a:A,b:B}=t,P=e.sqr(x),R=e.mul(P,x);return e.add(e.add(R,e.mul(x,A)),B)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function c(x){return typeof x=="bigint"&&gse.eql(C,e.ZERO);return R(B)&&R(P)?_.ZERO:new _(B,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){const B=e.invertBatch(A.map(P=>P.pz));return A.map((P,R)=>P.toAffine(B[R])).map(_.fromAffine)}static fromHex(A){const B=_.fromAffine(s(mn("pointHex",A)));return B.assertValidity(),B}static fromPrivateKey(A){return _.BASE.multiply(p(A))}_setWindowSize(A){this._WINDOW_SIZE=A,m.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:A,y:B}=this.toAffine();if(!e.isValid(A)||!e.isValid(B))throw new Error("bad point: x or y not FE");const P=e.sqr(B),R=i(A);if(!e.eql(P,R))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:A}=this.toAffine();if(e.isOdd)return!e.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){v(A);const{px:B,py:P,pz:R}=this,{px:C,py:O,pz:z}=A,H=e.eql(e.mul(B,z),e.mul(C,R)),tt=e.eql(e.mul(P,z),e.mul(O,R));return H&&tt}negate(){return new _(this.px,e.neg(this.py),this.pz)}double(){const{a:A,b:B}=t,P=e.mul(B,V5),{px:R,py:C,pz:O}=this;let z=e.ZERO,H=e.ZERO,tt=e.ZERO,nt=e.mul(R,R),G=e.mul(C,C),M=e.mul(O,O),d=e.mul(R,C);return d=e.add(d,d),tt=e.mul(R,O),tt=e.add(tt,tt),z=e.mul(A,tt),H=e.mul(P,M),H=e.add(z,H),z=e.sub(G,H),H=e.add(G,H),H=e.mul(z,H),z=e.mul(d,z),tt=e.mul(P,tt),M=e.mul(A,M),d=e.sub(nt,M),d=e.mul(A,d),d=e.add(d,tt),tt=e.add(nt,nt),nt=e.add(tt,nt),nt=e.add(nt,M),nt=e.mul(nt,d),H=e.add(H,nt),M=e.mul(C,O),M=e.add(M,M),nt=e.mul(M,d),z=e.sub(z,nt),tt=e.mul(M,G),tt=e.add(tt,tt),tt=e.add(tt,tt),new _(z,H,tt)}add(A){v(A);const{px:B,py:P,pz:R}=this,{px:C,py:O,pz:z}=A;let H=e.ZERO,tt=e.ZERO,nt=e.ZERO;const G=t.a,M=e.mul(t.b,V5);let d=e.mul(B,C),o=e.mul(P,O),a=e.mul(R,z),f=e.add(B,P),h=e.add(C,O);f=e.mul(f,h),h=e.add(d,o),f=e.sub(f,h),h=e.add(B,R);let g=e.add(C,z);return h=e.mul(h,g),g=e.add(d,a),h=e.sub(h,g),g=e.add(P,R),H=e.add(O,z),g=e.mul(g,H),H=e.add(o,a),g=e.sub(g,H),nt=e.mul(G,h),H=e.mul(M,a),nt=e.add(H,nt),H=e.sub(o,nt),nt=e.add(o,nt),tt=e.mul(H,nt),o=e.add(d,d),o=e.add(o,d),a=e.mul(G,a),h=e.mul(M,h),o=e.add(o,a),a=e.sub(d,a),a=e.mul(G,a),h=e.add(h,a),d=e.mul(o,h),tt=e.add(tt,d),d=e.mul(g,h),H=e.mul(f,H),H=e.sub(H,d),d=e.mul(f,o),nt=e.mul(g,nt),nt=e.add(nt,d),new _(H,tt,nt)}subtract(A){return this.add(A.negate())}is0(){return this.equals(_.ZERO)}wNAF(A){return w.wNAFCached(this,m,A,B=>{const P=e.invertBatch(B.map(R=>R.pz));return B.map((R,C)=>R.toAffine(P[C])).map(_.fromAffine)})}multiplyUnsafe(A){const B=_.ZERO;if(A===gs)return B;if(l(A),A===Ui)return this;const{endo:P}=t;if(!P)return w.unsafeLadder(this,A);let{k1neg:R,k1:C,k2neg:O,k2:z}=P.splitScalar(A),H=B,tt=B,nt=this;for(;C>gs||z>gs;)C&Ui&&(H=H.add(nt)),z&Ui&&(tt=tt.add(nt)),nt=nt.double(),C>>=Ui,z>>=Ui;return R&&(H=H.negate()),O&&(tt=tt.negate()),tt=new _(e.mul(tt.px,P.beta),tt.py,tt.pz),H.add(tt)}multiply(A){l(A);let B,P,R=A;const{endo:C}=t;if(C){const{k1neg:O,k1:z,k2neg:H,k2:tt}=C.splitScalar(R);let{p:nt,f:G}=this.wNAF(z),{p:M,f:d}=this.wNAF(tt);nt=w.constTimeNegate(O,nt),M=w.constTimeNegate(H,M),M=new _(e.mul(M.px,C.beta),M.py,M.pz),B=nt.add(M),P=G.add(d)}else{const{p:O,f:z}=this.wNAF(R);B=O,P=z}return _.normalizeZ([B,P])[0]}multiplyAndAddUnsafe(A,B,P){const R=_.BASE,C=(z,H)=>H!==gs&&H!==Ui&&z.equals(R)?z.multiply(H):z.multiplyUnsafe(H),O=C(this,B).add(C(A,P));return O.is0()?void 0:O}toAffine(A){const{px:B,py:P,pz:R}=this,C=this.is0();A==null&&(A=C?e.ONE:e.inv(R));const O=e.mul(B,A),z=e.mul(P,A),H=e.mul(R,A);if(C)return{x:e.ZERO,y:e.ZERO};if(!e.eql(H,e.ONE))throw new Error("invZ was invalid");return{x:O,y:z}}isTorsionFree(){const{h:A,isTorsionFree:B}=t;if(A===Ui)return!0;if(B)return B(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:A,clearCofactor:B}=t;return A===Ui?this:B?B(_,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return this.assertValidity(),n(_,this,A)}toHex(A=!0){return Ja(this.toRawBytes(A))}}_.BASE=new _(t.Gx,t.Gy,e.ONE),_.ZERO=new _(e.ZERO,e.ONE,e.ZERO);const E=t.nBitLength,w=hE(_,t.endo?Math.ceil(E/2):E);return{CURVE:t,ProjectivePoint:_,normPrivateKeyToScalar:p,weierstrassEquation:i,isWithinCurveOrder:c}}function qq(r){const t=function(G){const M=sy(G);return cf(M,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...M})}(r),{Fp:e,n}=t,s=e.BYTES+1,i=2*e.BYTES+1;function c(G){return Kr(G,n)}function l(G){return D2(G,n)}const{ProjectivePoint:p,normPrivateKeyToScalar:m,weierstrassEquation:v,isWithinCurveOrder:_}=zq({...t,toBytes(G,M,d){const o=M.toAffine(),a=e.toBytes(o.x),f=Qa;return d?f(Uint8Array.from([M.hasEvenY()?2:3]),a):f(Uint8Array.from([4]),a,e.toBytes(o.y))},fromBytes(G){const M=G.length,d=G[0],o=G.subarray(1);if(M!==s||d!==2&&d!==3){if(M===i&&d===4)return{x:e.fromBytes(o.subarray(0,e.BYTES)),y:e.fromBytes(o.subarray(e.BYTES,2*e.BYTES))};throw new Error(`Point of length ${M} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const f=La(o);if(!(gs<(a=f)&&aJa(Fu(G,t.nByteLength));function w(G){return G>n>>Ui}const x=(G,M,d)=>La(G.slice(M,d));class A{constructor(M,d,o){this.r=M,this.s=d,this.recovery=o,this.assertValidity()}static fromCompact(M){const d=t.nByteLength;return M=mn("compactSignature",M,2*d),new A(x(M,0,d),x(M,d,2*d))}static fromDER(M){const{r:d,s:o}=Oa.toSig(mn("DER",M));return new A(d,o)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(M){return new A(this.r,this.s,M)}recoverPublicKey(M){const{r:d,s:o,recovery:a}=this,f=C(mn("msgHash",M));if(a==null||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const h=a===2||a===3?d+t.n:d;if(h>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const g=1&a?"03":"02",S=p.fromHex(g+E(h)),I=l(h),y=c(-f*I),u=c(o*I),b=p.BASE.multiplyAndAddUnsafe(S,y,u);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return ff(this.toDERHex())}toDERHex(){return Oa.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ff(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const B={isValidPrivateKey(G){try{return m(G),!0}catch{return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const G=a5(t.n);return function(M,d,o=!1){const a=M.length,f=cE(d),h=a5(d);if(a<16||a1024)throw new Error(`expected ${h}-1024 bytes of input, got ${a}`);const g=Kr(o?La(M):qu(M),d-Zr)+Zr;return o?Xc(g,f):Fu(g,f)}(t.randomBytes(G),t.n)},precompute:(G=8,M=p.BASE)=>(M._setWindowSize(G),M.multiply(BigInt(3)),M)};function P(G){const M=G instanceof Uint8Array,d=typeof G=="string",o=(M||d)&&G.length;return M?o===s||o===i:d?o===2*s||o===2*i:G instanceof p}const R=t.bits2int||function(G){const M=La(G),d=8*G.length-t.nBitLength;return d>0?M>>BigInt(d):M},C=t.bits2int_modN||function(G){return c(R(G))},O=oy(t.nBitLength);function z(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!(gs<=G&&GD in d))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:a}=t;let{lowS:f,prehash:h,extraEntropy:g}=d;f==null&&(f=!0),G=mn("msgHash",G),h&&(G=mn("prehashed msgHash",o(G)));const S=C(G),I=m(M),y=[z(I),z(S)];if(g!=null){const D=g===!0?a(e.BYTES):g;y.push(mn("extraEntropy",D))}const u=Qa(...y),b=S;return{seed:u,k2sig:function(D){const Z=R(D);if(!_(Z))return;const F=l(Z),q=p.BASE.multiply(Z).toAffine(),it=c(q.x);if(it===gs)return;const at=c(F*c(b+it*I));if(at===gs)return;let Bt=(q.x===it?0:2)|Number(q.y&Ui),yt=at;return f&&w(at)&&(yt=function(pt){return w(pt)?c(-pt):pt}(at),Bt^=1),new A(it,yt,Bt)}}}const tt={lowS:t.lowS,prehash:!1},nt={lowS:t.lowS,prehash:!1};return p.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(G,M=!0){return p.fromPrivateKey(G).toRawBytes(M)},getSharedSecret:function(G,M,d=!0){if(P(G))throw new Error("first arg must be private key");if(!P(M))throw new Error("second arg must be public key");return p.fromHex(M).multiply(m(G)).toRawBytes(d)},sign:function(G,M,d=tt){const{seed:o,k2sig:a}=H(G,M,d),f=t;return aE(f.hash.outputLen,f.nByteLength,f.hmac)(o,a)},verify:function(G,M,d,o=nt){var q;const a=G;if(M=mn("msgHash",M),d=mn("publicKey",d),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:f,prehash:h}=o;let g,S;try{if(typeof a=="string"||a instanceof Uint8Array)try{g=A.fromDER(a)}catch(it){if(!(it instanceof Oa.Err))throw it;g=A.fromCompact(a)}else{if(typeof a!="object"||typeof a.r!="bigint"||typeof a.s!="bigint")throw new Error("PARSE");{const{r:it,s:at}=a;g=new A(it,at)}}S=p.fromHex(d)}catch(it){if(it.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(f&&g.hasHighS())return!1;h&&(M=t.hash(M));const{r:I,s:y}=g,u=C(M),b=l(y),D=c(u*b),Z=c(I*b),F=(q=p.BASE.multiplyAndAddUnsafe(S,D,Z))==null?void 0:q.toAffine();return!!F&&c(F.x)===I},ProjectivePoint:p,Signature:A,utils:B}}BigInt(4);class rA extends ry{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");vl(c.outputLen),vl(c.blockLen)}(t);const n=gd(e);if(this.iHash=t.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(n.length>s?t.create().update(n).digest():n);for(let c=0;cnew rA(r,t).update(e).digest();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Fq(r){return{hash:r,hmac:(t,...e)=>nA(r,t,Ez(...e)),randomBytes:QM}}nA.create=(r,t)=>new rA(r,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Z5=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),W5=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),jq=BigInt(1),$2=BigInt(2),G5=(r,t)=>(r+t/$2)/t,H2=fE(Z5,void 0,void 0,{sqrt:function(r){const t=Z5,e=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),c=BigInt(23),l=BigInt(44),p=BigInt(88),m=r*r*r%t,v=m*m*r%t,_=en(v,e,t)*v%t,E=en(_,e,t)*v%t,w=en(E,$2,t)*m%t,x=en(w,s,t)*w%t,A=en(x,i,t)*x%t,B=en(A,l,t)*A%t,P=en(B,p,t)*B%t,R=en(P,l,t)*A%t,C=en(R,e,t)*v%t,O=en(C,c,t)*x%t,z=en(O,n,t)*m%t,H=en(z,$2,t);if(!H2.eql(H2.sqr(H),r))throw new Error("Cannot find square root");return H}}),_d=function(r,t){const e=n=>qq({...r,...Fq(n)});return Object.freeze({...e(t),create:e})}({a:BigInt(0),b:BigInt(7),Fp:H2,n:W5,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const t=W5,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-jq*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),l=G5(i*r,t),p=G5(-n*r,t);let m=Kr(r-l*e-p*s,t),v=Kr(-l*n-p*i,t);const _=m>c,E=v>c;if(_&&(m=t-m),E&&(v=t-v),m>c||v>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:_,k1:m,k2neg:E,k2:v}}}},tu);BigInt(0),_d.ProjectivePoint;const Kq=Pf.utils.randomPrivateKey,Y5=()=>{const r=Pf.utils.randomPrivateKey(),t=Ml(r),e=new Uint8Array(64);return e.set(r),e.set(t,32),{publicKey:t,secretKey:e}},Ml=Pf.getPublicKey;function X5(r){try{return Pf.ExtendedPoint.fromHex(r),!0}catch{return!1}}const Ey=(r,t)=>Pf.sign(r,t.slice(0,32)),$q=Pf.verify,nr=r=>Ae.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Ae.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Ae.Buffer.from(r);class V2{constructor(t){Object.assign(this,t)}encode(){return Ae.Buffer.from(fy(Ic,this))}static decode(t){return bE(Ic,this,t)}static decodeUnchecked(t){return mE(Ic,this,t)}}const Ic=new Map;var J5;let iA;const Si=32;let Q5=1;iA=Symbol.toStringTag;class Xt extends V2{constructor(t){if(super({}),this._bn=void 0,function(e){return e._bn!==void 0}(t))this._bn=t._bn;else{if(typeof t=="string"){const e=Ln.decode(t);if(e.length!=Si)throw new Error("Invalid public key input");this._bn=new Jc(e)}else this._bn=new Jc(t);if(this._bn.byteLength()>Si)throw new Error("Invalid public key input")}}static unique(){const t=new Xt(Q5);return Q5+=1,new Xt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ln.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Ae.Buffer);if(t.length===Si)return t;const e=Ae.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[iA](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const s=Ae.Buffer.concat([t.toBuffer(),Ae.Buffer.from(e),n.toBuffer()]),i=tu(s);return new Xt(i)}static createProgramAddressSync(t,e){let n=Ae.Buffer.alloc(0);t.forEach(function(i){if(i.length>32)throw new TypeError("Max seed length exceeded");n=Ae.Buffer.concat([n,nr(i)])}),n=Ae.Buffer.concat([n,e.toBuffer(),Ae.Buffer.from("ProgramDerivedAddress")]);const s=tu(n);if(X5(s))throw new Error("Invalid seeds, address must fall off the curve");return new Xt(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,s=255;for(;s!=0;){try{const i=t.concat(Ae.Buffer.from([s]));n=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;s--;continue}return[n,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return X5(new Xt(t).toBytes())}}J5=Xt,Xt.default=new J5("11111111111111111111111111111111"),Ic.set(Xt,{kind:"struct",fields:[["_bn","u256"]]});const Hq=new Xt("BPFLoader1111111111111111111111111111111111"),ju=1232,Md=127,hf=64;class Z2 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Z2.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class W2 extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(W2.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Su extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Su.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class eh{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach((s,i)=>{e.set(s.toBase58(),i)});const n=s=>{const i=e.get(s.toBase58());if(i===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return i};return t.map(s=>({programIdIndex:n(s.programId),accountKeyIndexes:s.keys.map(i=>n(i.pubkey)),data:s.data}))}}const ar=(r="publicKey")=>Or(32,r),Vq=(r="signature")=>Or(64,r),Ua=(r="string")=>{const t=Ue([Ce("length"),Ce("lengthPadding"),Or(Qs(Ce(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),s=t;return s.decode=(i,c)=>e(i,c).chars.toString(),s.encode=(i,c,l)=>{const p={chars:Ae.Buffer.from(i,"utf8")};return n(p,c,l)},s.alloc=i=>Ce().span+Ce().span+Ae.Buffer.from(i,"utf8").length,s};function oA(r,t){const e=s=>{if(s.span>=0)return s.span;if(typeof s.alloc=="function")return s.alloc(t[s.property]);if("count"in s&&"elementLayout"in s){const i=t[s.property];if(Array.isArray(i))return i.length*e(s.elementLayout)}else if("fields"in s)return oA({layout:s},t[s.property]);return 0};let n=0;return r.layout.fields.forEach(s=>{n+=e(s)}),n}function ti(r){let t=0,e=0;for(;;){let n=r.shift();if(t|=(127&n)<<7*e,e+=1,(128&n)==0)break}return t}function _i(r,t){let e=t;for(;;){let n=127&e;if(e>>=7,e==0){r.push(n);break}n|=128,r.push(n)}}function xr(r,t){if(!r)throw new Error(t||"Assertion failed")}class Ed{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,s=c=>{const l=c.toBase58();let p=n.get(l);return p===void 0&&(p={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(l,p)),p},i=s(e);i.isSigner=!0,i.isWritable=!0;for(const c of t){s(c.programId).isInvoked=!0;for(const l of c.keys){const p=s(l.pubkey);p.isSigner||(p.isSigner=l.isSigner),p.isWritable||(p.isWritable=l.isWritable)}}return new Ed(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];xr(t.length<=256,"Max static account keys length exceeded");const e=t.filter(([,l])=>l.isSigner&&l.isWritable),n=t.filter(([,l])=>l.isSigner&&!l.isWritable),s=t.filter(([,l])=>!l.isSigner&&l.isWritable),i=t.filter(([,l])=>!l.isSigner&&!l.isWritable),c={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{xr(e.length>0,"Expected at least one writable signer key");const[l]=e[0];xr(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[c,[...e.map(([l])=>new Xt(l)),...n.map(([l])=>new Xt(l)),...s.map(([l])=>new Xt(l)),...i.map(([l])=>new Xt(l))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&c.isWritable),[s,i]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&!c.isWritable);if(e.length!==0||s.length!==0)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:s},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,s=new Array;for(const[i,c]of this.keyMetaMap.entries())if(e(c)){const l=new Xt(i),p=t.findIndex(m=>m.equals(l));p>=0&&(xr(p<256,"Max lookup table index exceeded"),n.push(p),s.push(l),this.keyMetaMap.delete(i))}return[n,s]}}class uo{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new Xt(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ln.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new eh(this.staticAccountKeys)}static compile(t){const e=Ed.compile(t.instructions,t.payerKey),[n,s]=e.getMessageComponents(),i=new eh(s).compileInstructions(t.instructions).map(c=>({programIdIndex:c.programIdIndex,accounts:c.accountKeyIndexes,data:Ln.encode(c.data)}));return new uo({header:n,accountKeys:s,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e))}serialize(){const t=this.accountKeys.length;let e=[];_i(e,t);const n=this.instructions.map(_=>{const{accounts:E,programIdIndex:w}=_,x=Array.from(Ln.decode(_.data));let A=[];_i(A,E.length);let B=[];return _i(B,x.length),{programIdIndex:w,keyIndicesCount:Ae.Buffer.from(A),keyIndices:E,dataLength:Ae.Buffer.from(B),data:x}});let s=[];_i(s,n.length);let i=Ae.Buffer.alloc(ju);Ae.Buffer.from(s).copy(i);let c=s.length;n.forEach(_=>{const E=Ue([or("programIdIndex"),Or(_.keyIndicesCount.length,"keyIndicesCount"),On(or("keyIndex"),_.keyIndices.length,"keyIndices"),Or(_.dataLength.length,"dataLength"),On(or("userdatum"),_.data.length,"data")]).encode(_,i,c);c+=E}),i=i.slice(0,c);const l=Ue([Or(1,"numRequiredSignatures"),Or(1,"numReadonlySignedAccounts"),Or(1,"numReadonlyUnsignedAccounts"),Or(e.length,"keyCount"),On(ar("key"),t,"keys"),ar("recentBlockhash")]),p={numRequiredSignatures:Ae.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ae.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ae.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ae.Buffer.from(e),keys:this.accountKeys.map(_=>nr(_.toBytes())),recentBlockhash:Ln.decode(this.recentBlockhash)};let m=Ae.Buffer.alloc(2048);const v=l.encode(p,m);return i.copy(m,v),m.slice(0,v+i.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&Md))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=e.shift(),i=e.shift(),c=ti(e);let l=[];for(let E=0;E0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new eh(this.staticAccountKeys,e)}isAccountSigner(t){return t=n){const s=t-n,i=this.addressTableLookups.reduce((c,l)=>c+l.writableIndexes.length,0);return s=this.header.numRequiredSignatures?t-ei.key.equals(n.accountKey));if(!s)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const i of n.writableIndexes){if(!(im.toBytes()),recentBlockhash:Ln.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:s},l);return l.slice(0,p)}serializeInstructions(){let t=0;const e=new Uint8Array(ju);for(const n of this.compiledInstructions){const s=Array();_i(s,n.accountKeyIndexes.length);const i=Array();_i(i,n.data.length),t+=Ue([or("programIdIndex"),Or(s.length,"encodedAccountKeyIndexesLength"),On(or(),n.accountKeyIndexes.length,"accountKeyIndexes"),Or(i.length,"encodedDataLength"),Or(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(s),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(ju);for(const n of this.addressTableLookups){const s=Array();_i(s,n.writableIndexes.length);const i=Array();_i(i,n.readonlyIndexes.length),t+=Ue([ar("accountKey"),Or(s.length,"encodedWritableIndexesLength"),On(or(),n.writableIndexes.length,"writableIndexes"),Or(i.length,"encodedReadonlyIndexesLength"),On(or(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(s),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),s=n&Md;xr(n!==s,"Expected versioned message but received legacy message"),xr(s===0,`Expected versioned message with version 0 but found version ${s}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},c=[],l=ti(e);for(let w=0;w{const t=Ay.deserializeMessageVersion(r);if(t==="legacy")return uo.from(r);if(t===0)return eu.deserialize(r);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let rs=function(r){return r[r.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",r[r.PROCESSED=1]="PROCESSED",r[r.TIMED_OUT=2]="TIMED_OUT",r[r.NONCE_INVALID=3]="NONCE_INVALID",r}({});const Zq=Ae.Buffer.alloc(hf).fill(0);class Ir{constructor(t){this.keys=void 0,this.programId=void 0,this.data=Ae.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class wr{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Ir(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let A=0;A{A.keys.forEach(P=>{i.push({...P})});const B=A.programId.toString();s.includes(B)||s.push(B)}),s.forEach(A=>{i.push({pubkey:new Xt(A),isSigner:!1,isWritable:!1})});const c=[];i.forEach(A=>{const B=A.pubkey.toString(),P=c.findIndex(R=>R.pubkey.toString()===B);P>-1?(c[P].isWritable=c[P].isWritable||A.isWritable,c[P].isSigner=c[P].isSigner||A.isSigner):c.push(A)}),c.sort(function(A,B){return A.isSigner!==B.isSigner?A.isSigner?-1:1:A.isWritable!==B.isWritable?A.isWritable?-1:1:A.pubkey.toBase58().localeCompare(B.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const l=c.findIndex(A=>A.pubkey.equals(n));if(l>-1){const[A]=c.splice(l,1);A.isSigner=!0,A.isWritable=!0,c.unshift(A)}else c.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const A of this.signatures){const B=c.findIndex(P=>P.pubkey.equals(A.publicKey));if(!(B>-1))throw new Error(`unknown signer: ${A.publicKey.toString()}`);c[B].isSigner||(c[B].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let p=0,m=0,v=0;const _=[],E=[];c.forEach(({pubkey:A,isSigner:B,isWritable:P})=>{B?(_.push(A.toString()),p+=1,P||(m+=1)):(E.push(A.toString()),P||(v+=1))});const w=_.concat(E),x=e.map(A=>{const{data:B,programId:P}=A;return{programIdIndex:w.indexOf(P.toString()),accounts:A.keys.map(R=>w.indexOf(R.pubkey.toString())),data:Ln.encode(B)}});return x.forEach(A=>{xr(A.programIdIndex>=0),A.accounts.forEach(B=>xr(B>=0))}),new uo({header:{numRequiredSignatures:p,numReadonlySignedAccounts:m,numReadonlyUnsignedAccounts:v},accountKeys:w,recentBlockhash:t,instructions:x})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((s,i)=>e[i].equals(s.publicKey))||(this.signatures=e.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const e=new Set;this.signatures=t.filter(n=>{const s=n.toString();return!e.has(s)&&(e.add(s),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,n=[];for(const i of t){const c=i.publicKey.toString();e.has(c)||(e.add(c),n.push(i))}this.signatures=n.map(i=>({signature:null,publicKey:i.publicKey}));const s=this._compile();this._partialSign(s,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,n=[];for(const i of t){const c=i.publicKey.toString();e.has(c)||(e.add(c),n.push(i))}const s=this._compile();this._partialSign(s,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach(s=>{const i=Ey(n,s.secretKey);this._addSignature(s.publicKey,nr(i))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){xr(e.length===64);const n=this.signatures.findIndex(s=>t.equals(s.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=Ae.Buffer.from(e)}verifySignatures(t){return this._verifySignatures(this.serializeMessage(),t===void 0||t)}_verifySignatures(t,e){for(const{signature:n,publicKey:s}of this.signatures)if(n===null){if(e)return!1}else if(!$q(n,t,s.toBytes()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),s=this.serializeMessage();if(n&&!this._verifySignatures(s,e))throw new Error("Signature verification failed");return this._serialize(s)}_serialize(t){const{signatures:e}=this,n=[];_i(n,e.length);const s=n.length+64*e.length+t.length,i=Ae.Buffer.alloc(s);return xr(e.length<256),Ae.Buffer.from(n).copy(i,0),e.forEach(({signature:c},l)=>{c!==null&&(xr(c.length===64,"signature has invalid length"),Ae.Buffer.from(c).copy(i,n.length+64*l))}),t.copy(i,n.length+64*e.length),xr(i.length<=ju,`Transaction too large: ${i.length} > 1232`),i}get keys(){return xr(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return xr(this.instructions.length===1),this.instructions[0].programId}get data(){return xr(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t];const n=ti(e);let s=[];for(let i=0;i0&&(n.feePayer=t.accountKeys[0]),e.forEach((s,i)=>{const c={signature:s==Ln.encode(Zq)?null:Ln.decode(s),publicKey:t.accountKeys[i]};n.signatures.push(c)}),t.instructions.forEach(s=>{const i=s.accounts.map(c=>{const l=t.accountKeys[c];return{pubkey:l,isSigner:n.signatures.some(p=>p.publicKey.toString()===l.toString())||t.isAccountSigner(c),isWritable:t.isAccountWritable(c)}});n.instructions.push(new Ir({keys:i,programId:t.accountKeys[s.programIdIndex],data:Ln.decode(s.data)}))}),n._message=t,n._json=n.toJSON(),n}}class Sy{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:s,recentBlockhash:i}=t,{numRequiredSignatures:c,numReadonlySignedAccounts:l,numReadonlyUnsignedAccounts:p}=n,m=c-l;xr(m>0,"Message header is invalid");const v=t.staticAccountKeys.length-c-p;xr(v>=0,"Message header is invalid");const _=t.getAccountKeys(e),E=_.get(0);if(E===void 0)throw new Error("Failed to decompile message because no account keys were found");const w=[];for(const x of s){const A=[];for(const P of x.accountKeyIndexes){const R=_.get(P);if(R===void 0)throw new Error(`Failed to find key for account key index ${P}`);let C;C=Pc.equals(s.publicKey));xr(i>=0,`Cannot sign with non signer key ${s.publicKey.toBase58()}`),this.signatures[i]=Ey(e,s.secretKey)}}addSignature(t,e){xr(e.byteLength===64,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(t));xr(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const oo=new Xt("SysvarC1ock11111111111111111111111111111111"),Wq=new Xt("SysvarEpochSchedu1e111111111111111111111111"),Gq=new Xt("Sysvar1nstructions1111111111111111111111111"),J0=new Xt("SysvarRecentB1ockHashes11111111111111111111"),na=new Xt("SysvarRent111111111111111111111111111111111"),Yq=new Xt("SysvarRewards111111111111111111111111111111"),Xq=new Xt("SysvarS1otHashes111111111111111111111111111"),Jq=new Xt("SysvarS1otHistory11111111111111111111111111"),Q0=new Xt("SysvarStakeHistory1111111111111111111111111");async function G2(r,t,e,n){const s=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},i=await r.sendTransaction(t,e,s);let c;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)c=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,signature:i,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){const{nonceInstruction:l}=t.nonceInfo,p=l.keys[0].pubkey;c=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:p,nonceValue:t.nonceInfo.nonce,signature:i},n&&n.commitment)).value}else(n==null?void 0:n.abortSignal)!=null&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),c=(await r.confirmTransaction(i,n&&n.commitment)).value;if(c.err)throw new Error(`Transaction ${i} failed (${JSON.stringify(c)})`);return i}function xa(r){return new Promise(t=>setTimeout(t,r))}function gr(r,t){const e=r.layout.span>=0?r.layout.span:oA(r,t),n=Ae.Buffer.alloc(e),s=Object.assign({instruction:r.index},t);return r.layout.encode(s,n),n}function Br(r,t){let e;try{e=r.layout.decode(t)}catch(n){throw new Error("invalid instruction; "+n)}if(e.instruction!==r.index)throw new Error(`invalid instruction; instruction index mismatch ${e.instruction} != ${r.index}`);return e}const sA=In("lamportsPerSignature"),aA=Ue([Ce("version"),Ce("state"),ar("authorizedPubkey"),ar("nonce"),Ue([sA],"feeCalculator")]),rh=aA.span;class El{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=aA.decode(nr(t),0);return new El({authorizedPubkey:new Xt(e.authorizedPubkey),nonce:new Xt(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const lf=(Wp=8,r=>{const t=Or(Wp,r),{encode:e,decode:n}=(i=>({decode:i.decode.bind(i),encode:i.encode.bind(i)}))(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return NE(Ae.Buffer.from(l))},s.encode=(i,c,l)=>{const p=yy(i,Wp);return e(p,c,l)},s});var Wp;const Ur=Object.freeze({Create:{index:0,layout:Ue([Ce("instruction"),xi("lamports"),xi("space"),ar("programId")])},Assign:{index:1,layout:Ue([Ce("instruction"),ar("programId")])},Transfer:{index:2,layout:Ue([Ce("instruction"),lf("lamports")])},CreateWithSeed:{index:3,layout:Ue([Ce("instruction"),ar("base"),Ua("seed"),xi("lamports"),xi("space"),ar("programId")])},AdvanceNonceAccount:{index:4,layout:Ue([Ce("instruction")])},WithdrawNonceAccount:{index:5,layout:Ue([Ce("instruction"),xi("lamports")])},InitializeNonceAccount:{index:6,layout:Ue([Ce("instruction"),ar("authorized")])},AuthorizeNonceAccount:{index:7,layout:Ue([Ce("instruction"),ar("authorized")])},Allocate:{index:8,layout:Ue([Ce("instruction"),xi("space")])},AllocateWithSeed:{index:9,layout:Ue([Ce("instruction"),ar("base"),Ua("seed"),xi("space"),ar("programId")])},AssignWithSeed:{index:10,layout:Ue([Ce("instruction"),ar("base"),Ua("seed"),ar("programId")])},TransferWithSeed:{index:11,layout:Ue([Ce("instruction"),lf("lamports"),Ua("seed"),ar("programId")])},UpgradeNonceAccount:{index:12,layout:Ue([Ce("instruction")])}});class an{constructor(){}static createAccount(t){const e=gr(Ur.Create,{lamports:t.lamports,space:t.space,programId:nr(t.programId.toBuffer())});return new Ir({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;return"basePubkey"in t?(e=gr(Ur.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=gr(Ur.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new Ir({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;return"basePubkey"in t?(e=gr(Ur.AssignWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=gr(Ur.Assign,{programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new Ir({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=gr(Ur.CreateWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:nr(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Ir({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new wr;"basePubkey"in t&&"seed"in t?e.add(an.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:rh,programId:this.programId})):e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:rh,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=gr(Ur.InitializeNonceAccount,{authorized:nr(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:J0,isSigner:!1,isWritable:!1},{pubkey:na,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new Ir(n)}static nonceAdvance(t){const e=gr(Ur.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:J0,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new Ir(n)}static nonceWithdraw(t){const e=gr(Ur.WithdrawNonceAccount,{lamports:t.lamports});return new Ir({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:J0,isSigner:!1,isWritable:!1},{pubkey:na,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=gr(Ur.AuthorizeNonceAccount,{authorized:nr(t.newAuthorizedPubkey.toBuffer())});return new Ir({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;return"basePubkey"in t?(e=gr(Ur.AllocateWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=gr(Ur.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new Ir({keys:n,programId:this.programId,data:e})}}an.programId=new Xt("11111111111111111111111111111111");class ja{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/ja.chunkSize)+1+1)}static async load(t,e,n,s,i){{const _=await t.getMinimumBalanceForRentExemption(i.length),E=await t.getAccountInfo(n.publicKey,"confirmed");let w=null;if(E!==null){if(E.executable)return console.error("Program load failed, account is already executable"),!1;E.data.length!==i.length&&(w=w||new wr,w.add(an.allocate({accountPubkey:n.publicKey,space:i.length}))),E.owner.equals(s)||(w=w||new wr,w.add(an.assign({accountPubkey:n.publicKey,programId:s}))),E.lamports<_&&(w=w||new wr,w.add(an.transfer({fromPubkey:e.publicKey,toPubkey:n.publicKey,lamports:_-E.lamports})))}else w=new wr().add(an.createAccount({fromPubkey:e.publicKey,newAccountPubkey:n.publicKey,lamports:_>0?_:1,space:i.length,programId:s}));w!==null&&await G2(t,w,[e,n],{commitment:"confirmed"})}const c=Ue([Ce("instruction"),Ce("offset"),Ce("bytesLength"),Ce("bytesLengthPadding"),On(or("byte"),Qs(Ce(),-8),"bytes")]),l=ja.chunkSize;let p=0,m=i,v=[];for(;m.length>0;){const _=m.slice(0,l),E=Ae.Buffer.alloc(l+16);c.encode({instruction:0,offset:p,bytes:_,bytesLength:0,bytesLengthPadding:0},E);const w=new wr().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:s,data:E});v.push(G2(t,w,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await xa(1e3/4),p+=l,m=m.slice(l)}await Promise.all(v);{const _=Ue([Ce("instruction")]),E=Ae.Buffer.alloc(_.span);_.encode({instruction:1},E);const w=new wr().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:na,isSigner:!1,isWritable:!1}],programId:s,data:E}),x="processed",A=await t.sendTransaction(w,[e,n],{preflightCommitment:x}),{context:B,value:P}=await t.confirmTransaction({signature:A,lastValidBlockHeight:w.lastValidBlockHeight,blockhash:w.recentBlockhash},x);if(P.err)throw new Error(`Transaction ${A} failed (${JSON.stringify(P)})`);for(;;){try{if(await t.getSlot({commitment:x})>B.slot)break}catch{}await new Promise(R=>setTimeout(R,Math.round(200)))}}return!0}}ja.chunkSize=932;const Qq=new Xt("BPFLoader2111111111111111111111111111111111");function tF(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var eF=Object.prototype.toString,rF=Object.keys||function(r){var t=[];for(var e in r)t.push(e);return t};function Mc(r,t){var e,n,s,i,c,l,p;if(r===!0)return"true";if(r===!1)return"false";switch(typeof r){case"object":if(r===null)return null;if(r.toJSON&&typeof r.toJSON=="function")return Mc(r.toJSON(),t);if((p=eF.call(r))==="[object Array]"){for(s="[",n=r.length-1,e=0;e-1&&(s+=Mc(r[e],!0)),s+"]"}if(p==="[object Object]"){for(n=(i=rF(r).sort()).length,s="",e=0;e1;)r/=2,t++;return t}class e4{constructor(t,e,n,s,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=s,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,1+(n|=n>>32))}(t+32+1))-Gp(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const i=Bq(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in i?i.socket:i,i},t,e,n),this.underlyingSocket=void 0}call(...t){var n;const e=(n=this.underlyingSocket)==null?void 0:n.readyState;return e===1?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){var n;const e=(n=this.underlyingSocket)==null?void 0:n.readyState;return e===1?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class Yp{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(c,l){let p;try{p=c.layout.decode(l)}catch(m){throw new Error("invalid instruction; "+m)}if(p.typeIndex!==c.index)throw new Error(`invalid account data; account type mismatch ${p.typeIndex} != ${c.index}`);return p}(oF,t),n=t.length-56;xr(n>=0,"lookup table is invalid"),xr(n%32==0,"lookup table is invalid");const s=n/32,{addresses:i}=Ue([On(ar(),s,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:e.authority.length!==0?new Xt(e.authority[0]):void 0,addresses:i.map(c=>new Xt(c))}}}const oF={index:1,layout:Ue([Ce("typeIndex"),lf("deactivationSlot"),In("lastExtendedSlot"),or("lastExtendedStartIndex"),or(),On(ar(),Qs(or(),-1),"authority")])},sF=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,hn=Dh(wy(Xt),_e(),r=>new Xt(r)),uA=xy([_e(),Wr("base64")]),Iy=Dh(wy(Ae.Buffer),uA,r=>Ae.Buffer.from(r[0],"base64"));function Fr(r){let t,e;if(typeof r=="string")t=r;else if(r){const{commitment:n,...s}=r;t=n,e=s}return{commitment:t,config:e}}function fA(r){return ci([we({jsonrpc:Wr("2.0"),id:_e(),result:r}),we({jsonrpc:Wr("2.0"),id:_e(),error:we({code:Nh(),message:_e(),data:Ve(uu("any",()=>!0))})})])}const aF=fA(Nh());function rr(r){return Dh(fA(r),aF,t=>"error"in t?t:{...t,result:Ee(t.result,r)})}function nn(r){return rr(we({context:we({slot:jt()}),value:r}))}function Ad(r){return we({context:we({slot:jt()}),value:r})}function Xp(r,t){return r===0?new eu({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new Xt(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Ln.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new uo(t)}const uF=we({foundation:jt(),foundationTerm:jt(),initial:jt(),taper:jt(),terminal:jt()}),fF=rr(Ie(ke(we({epoch:jt(),effectiveSlot:jt(),amount:jt(),postBalance:jt(),commission:Ve(ke(jt()))})))),cF=Ie(we({slot:jt(),prioritizationFee:jt()})),hF=we({total:jt(),validator:jt(),foundation:jt(),epoch:jt()}),lF=we({epoch:jt(),slotIndex:jt(),slotsInEpoch:jt(),absoluteSlot:jt(),blockHeight:Ve(jt()),transactionCount:Ve(jt())}),dF=we({slotsPerEpoch:jt(),leaderScheduleSlotOffset:jt(),warmup:Go(),firstNormalEpoch:jt(),firstNormalSlot:jt()}),pF=qE(_e(),Ie(jt())),fu=ke(ci([we({}),_e()])),mF=we({err:fu}),vF=Wr("receivedSignature"),gF=we({"solana-core":_e(),"feature-set":Ve(jt())}),r4=nn(we({err:ke(ci([we({}),_e()])),logs:ke(Ie(_e())),accounts:Ve(ke(Ie(ke(we({executable:Go(),owner:_e(),lamports:jt(),data:Ie(_e()),rentEpoch:Ve(jt())}))))),unitsConsumed:Ve(jt()),returnData:Ve(ke(we({programId:_e(),data:xy([_e(),Wr("base64")])})))})),yF=nn(we({byIdentity:qE(_e(),Ie(jt())),range:we({firstSlot:jt(),lastSlot:jt()})})),bF=rr(uF),wF=rr(hF),xF=rr(cF),_F=rr(lF),MF=rr(dF),EF=rr(pF),AF=rr(jt()),SF=nn(we({total:jt(),circulating:jt(),nonCirculating:jt(),nonCirculatingAccounts:Ie(hn)})),Y2=we({amount:_e(),uiAmount:ke(jt()),decimals:jt(),uiAmountString:Ve(_e())}),kF=nn(Ie(we({address:hn,amount:_e(),uiAmount:ke(jt()),decimals:jt(),uiAmountString:Ve(_e())}))),IF=nn(Ie(we({pubkey:hn,account:we({executable:Go(),owner:hn,lamports:jt(),data:Iy,rentEpoch:jt()})}))),X2=we({program:_e(),parsed:Nh(),space:jt()}),BF=nn(Ie(we({pubkey:hn,account:we({executable:Go(),owner:hn,lamports:jt(),data:X2,rentEpoch:jt()})}))),PF=nn(Ie(we({lamports:jt(),address:hn}))),nh=we({executable:Go(),owner:hn,lamports:jt(),data:Iy,rentEpoch:jt()}),RF=we({pubkey:hn,account:nh}),CF=Dh(ci([wy(Ae.Buffer),X2]),ci([uA,X2]),r=>Array.isArray(r)?Ee(r,Iy):r),J2=we({executable:Go(),owner:hn,lamports:jt(),data:CF,rentEpoch:jt()}),TF=we({pubkey:hn,account:J2}),LF=we({state:ci([Wr("active"),Wr("inactive"),Wr("activating"),Wr("deactivating")]),active:jt(),inactive:jt()}),OF=rr(Ie(we({signature:_e(),slot:jt(),err:fu,memo:ke(_e()),blockTime:Ve(ke(jt()))}))),UF=rr(Ie(we({signature:_e(),slot:jt(),err:fu,memo:ke(_e()),blockTime:Ve(ke(jt()))}))),NF=we({subscription:jt(),result:Ad(nh)}),DF=we({pubkey:hn,account:nh}),zF=we({subscription:jt(),result:Ad(DF)}),qF=we({parent:jt(),slot:jt(),root:jt()}),FF=we({subscription:jt(),result:qF}),jF=ci([we({type:ci([Wr("firstShredReceived"),Wr("completed"),Wr("optimisticConfirmation"),Wr("root")]),slot:jt(),timestamp:jt()}),we({type:Wr("createdBank"),parent:jt(),slot:jt(),timestamp:jt()}),we({type:Wr("frozen"),slot:jt(),timestamp:jt(),stats:we({numTransactionEntries:jt(),numSuccessfulTransactions:jt(),numFailedTransactions:jt(),maxTransactionsPerEntry:jt()})}),we({type:Wr("dead"),slot:jt(),timestamp:jt(),err:_e()})]),KF=we({subscription:jt(),result:jF}),$F=we({subscription:jt(),result:Ad(ci([mF,vF]))}),HF=we({subscription:jt(),result:jt()}),VF=we({pubkey:_e(),gossip:ke(_e()),tpu:ke(_e()),rpc:ke(_e()),version:ke(_e())}),n4=we({votePubkey:_e(),nodePubkey:_e(),activatedStake:jt(),epochVoteAccount:Go(),epochCredits:Ie(xy([jt(),jt(),jt()])),commission:jt(),lastVote:jt(),rootSlot:ke(jt())}),ZF=rr(we({current:Ie(n4),delinquent:Ie(n4)})),WF=ci([Wr("processed"),Wr("confirmed"),Wr("finalized")]),GF=we({slot:jt(),confirmations:ke(jt()),err:fu,confirmationStatus:Ve(WF)}),YF=nn(Ie(ke(GF))),XF=rr(jt()),cA=we({accountKey:hn,writableIndexes:Ie(jt()),readonlyIndexes:Ie(jt())}),By=we({signatures:Ie(_e()),message:we({accountKeys:Ie(_e()),header:we({numRequiredSignatures:jt(),numReadonlySignedAccounts:jt(),numReadonlyUnsignedAccounts:jt()}),instructions:Ie(we({accounts:Ie(jt()),data:_e(),programIdIndex:jt()})),recentBlockhash:_e(),addressTableLookups:Ve(Ie(cA))})}),hA=we({pubkey:hn,signer:Go(),writable:Go(),source:Ve(ci([Wr("transaction"),Wr("lookupTable")]))}),lA=we({accountKeys:Ie(hA),signatures:Ie(_e())}),i4=we({parsed:Nh(),program:_e(),programId:hn}),o4=we({accounts:Ie(hn),data:_e(),programId:hn}),dA=Dh(ci([o4,i4]),ci([we({parsed:Nh(),program:_e(),programId:_e()}),we({accounts:Ie(_e()),data:_e(),programId:_e()})]),r=>Ee(r,"accounts"in r?o4:i4)),pA=we({signatures:Ie(_e()),message:we({accountKeys:Ie(hA),instructions:Ie(dA),recentBlockhash:_e(),addressTableLookups:Ve(ke(Ie(cA)))})}),Al=we({accountIndex:jt(),mint:_e(),owner:Ve(_e()),uiTokenAmount:Y2}),mA=we({writable:Ie(hn),readonly:Ie(hn)}),Sd=we({err:fu,fee:jt(),innerInstructions:Ve(ke(Ie(we({index:jt(),instructions:Ie(we({accounts:Ie(jt()),data:_e(),programIdIndex:jt()}))})))),preBalances:Ie(jt()),postBalances:Ie(jt()),logMessages:Ve(ke(Ie(_e()))),preTokenBalances:Ve(ke(Ie(Al))),postTokenBalances:Ve(ke(Ie(Al))),loadedAddresses:Ve(mA),computeUnitsConsumed:Ve(jt())}),Py=we({err:fu,fee:jt(),innerInstructions:Ve(ke(Ie(we({index:jt(),instructions:Ie(dA)})))),preBalances:Ie(jt()),postBalances:Ie(jt()),logMessages:Ve(ke(Ie(_e()))),preTokenBalances:Ve(ke(Ie(Al))),postTokenBalances:Ve(ke(Ie(Al))),loadedAddresses:Ve(mA),computeUnitsConsumed:Ve(jt())}),Cf=ci([Wr(0),Wr("legacy")]),cu=we({pubkey:_e(),lamports:jt(),postBalance:ke(jt()),rewardType:ke(_e()),commission:Ve(ke(jt()))}),JF=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:By,meta:ke(Sd),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),QF=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),tj=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:lA,meta:ke(Sd),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),ej=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:pA,meta:ke(Py),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),rj=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:lA,meta:ke(Py),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),nj=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),ij=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:By,meta:ke(Sd)})),rewards:Ve(Ie(cu)),blockTime:ke(jt())}))),s4=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),signatures:Ie(_e()),blockTime:ke(jt())}))),Jp=rr(ke(we({slot:jt(),meta:ke(Sd),blockTime:Ve(ke(jt())),transaction:By,version:Ve(Cf)}))),d0=rr(ke(we({slot:jt(),transaction:pA,meta:ke(Py),blockTime:Ve(ke(jt())),version:Ve(Cf)}))),oj=nn(we({blockhash:_e(),feeCalculator:we({lamportsPerSignature:jt()})})),sj=nn(we({blockhash:_e(),lastValidBlockHeight:jt()})),aj=nn(Go()),uj=rr(Ie(we({slot:jt(),numTransactions:jt(),numSlots:jt(),samplePeriodSecs:jt()}))),fj=nn(ke(we({feeCalculator:we({lamportsPerSignature:jt()})}))),cj=rr(_e()),hj=rr(_e()),lj=we({err:fu,logs:Ie(_e()),signature:_e()}),dj=we({result:Ad(lj),subscription:jt()}),pj={"solana-client":"js/0.0.0-development"};class $u{constructor(t){this._keypair=void 0,this._keypair=t??Y5()}static generate(){return new $u(Y5())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const s=t.slice(0,32),i=Ml(s);for(let c=0;c<32;c++)if(n[c]!==i[c])throw new Error("provided secretKey is invalid")}return new $u({publicKey:n,secretKey:t})}static fromSeed(t){const e=Ml(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new $u({publicKey:e,secretKey:n})}get publicKey(){return new Xt(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const ys=Object.freeze({CreateLookupTable:{index:0,layout:Ue([Ce("instruction"),lf("recentSlot"),or("bumpSeed")])},FreezeLookupTable:{index:1,layout:Ue([Ce("instruction")])},ExtendLookupTable:{index:2,layout:Ue([Ce("instruction"),lf(),On(ar(),Qs(Ce(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Ue([Ce("instruction")])},CloseLookupTable:{index:4,layout:Ue([Ce("instruction")])}});class Q2{constructor(){}static createLookupTable(t){const[e,n]=Xt.findProgramAddressSync([t.authority.toBuffer(),yy(BigInt(t.recentSlot),8)],this.programId),s=gr(ys.CreateLookupTable,{recentSlot:BigInt(t.recentSlot),bumpSeed:n}),i=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:an.programId,isSigner:!1,isWritable:!1}];return[new Ir({programId:this.programId,keys:i,data:s}),e]}static freezeLookupTable(t){const e=gr(ys.FreezeLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ir({programId:this.programId,keys:n,data:e})}static extendLookupTable(t){const e=gr(ys.ExtendLookupTable,{addresses:t.addresses.map(s=>s.toBytes())}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:an.programId,isSigner:!1,isWritable:!1}),new Ir({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=gr(ys.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ir({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=gr(ys.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Ir({programId:this.programId,keys:n,data:e})}}Q2.programId=new Xt("AddressLookupTab1e1111111111111111111111111");const Lo=Object.freeze({RequestUnits:{index:0,layout:Ue([or("instruction"),Ce("units"),Ce("additionalFee")])},RequestHeapFrame:{index:1,layout:Ue([or("instruction"),Ce("bytes")])},SetComputeUnitLimit:{index:2,layout:Ue([or("instruction"),Ce("units")])},SetComputeUnitPrice:{index:3,layout:Ue([or("instruction"),lf("microLamports")])}});class tv{constructor(){}static requestUnits(t){const e=gr(Lo.RequestUnits,t);return new Ir({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=gr(Lo.RequestHeapFrame,t);return new Ir({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=gr(Lo.SetComputeUnitLimit,t);return new Ir({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=gr(Lo.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new Ir({keys:[],programId:this.programId,data:e})}}tv.programId=new Xt("ComputeBudget111111111111111111111111111111");const a4=Ue([or("numSignatures"),or("padding"),Ni("signatureOffset"),Ni("signatureInstructionIndex"),Ni("publicKeyOffset"),Ni("publicKeyInstructionIndex"),Ni("messageDataOffset"),Ni("messageDataSize"),Ni("messageInstructionIndex")]);class kd{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:s,instructionIndex:i}=t;xr(e.length===32,`Public Key must be 32 bytes but received ${e.length} bytes`),xr(s.length===64,`Signature must be 64 bytes but received ${s.length} bytes`);const c=a4.span,l=c+e.length,p=l+s.length,m=Ae.Buffer.alloc(p+n.length),v=i??65535;return a4.encode({numSignatures:1,padding:0,signatureOffset:l,signatureInstructionIndex:v,publicKeyOffset:c,publicKeyInstructionIndex:v,messageDataOffset:p,messageDataSize:n.length,messageInstructionIndex:v},m),m.fill(e,c),m.fill(s,l),m.fill(n,p),new Ir({keys:[],programId:kd.programId,data:m})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:s}=t;xr(e.length===64,`Private key must be 64 bytes but received ${e.length} bytes`);try{const i=$u.fromSecretKey(e),c=i.publicKey.toBytes(),l=Ey(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:c,message:n,signature:l,instructionIndex:s})}catch(i){throw new Error(`Error creating instruction; ${i}`)}}}kd.programId=new Xt("Ed25519SigVerify111111111111111111111111111");_d.utils.isValidPrivateKey;const mj=_d.getPublicKey,Qp=Ue([or("numSignatures"),Ni("signatureOffset"),or("signatureInstructionIndex"),Ni("ethAddressOffset"),or("ethAddressInstructionIndex"),Ni("messageDataOffset"),Ni("messageDataSize"),or("messageInstructionIndex"),Or(20,"ethAddress"),Or(64,"signature"),or("recoveryId")]);class Hu{constructor(){}static publicKeyToEthAddress(t){xr(t.length===64,`Public key must be 64 bytes but received ${t.length} bytes`);try{return Ae.Buffer.from(H5(nr(t))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:s,recoveryId:i,instructionIndex:c}=t;return Hu.createInstructionWithEthAddress({ethAddress:Hu.publicKeyToEthAddress(e),message:n,signature:s,recoveryId:i,instructionIndex:c})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:s,recoveryId:i,instructionIndex:c=0}=t;let l;l=typeof e=="string"?e.startsWith("0x")?Ae.Buffer.from(e.substr(2),"hex"):Ae.Buffer.from(e,"hex"):e,xr(l.length===20,`Address must be 20 bytes but received ${l.length} bytes`);const p=12+l.length,m=p+s.length+1,v=Ae.Buffer.alloc(Qp.span+n.length);return Qp.encode({numSignatures:1,signatureOffset:p,signatureInstructionIndex:c,ethAddressOffset:12,ethAddressInstructionIndex:c,messageDataOffset:m,messageDataSize:n.length,messageInstructionIndex:c,signature:nr(s),ethAddress:nr(l),recoveryId:i},v),v.fill(nr(n),Qp.span),new Ir({keys:[],programId:Hu.programId,data:v})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:s}=t;xr(e.length===32,`Private key must be 32 bytes but received ${e.length} bytes`);try{const i=nr(e),c=mj(i,!1).slice(1),l=Ae.Buffer.from(H5(nr(n))),[p,m]=((v,_)=>{const E=_d.sign(v,_);return[E.toCompactRawBytes(),E.recovery]})(l,i);return this.createInstructionWithPublicKey({publicKey:c,message:n,signature:p,recoveryId:m,instructionIndex:s})}catch(i){throw new Error(`Error creating instruction; ${i}`)}}}var u4;Hu.programId=new Xt("KeccakSecp256k11111111111111111111111111111");const vA=new Xt("StakeConfig11111111111111111111111111111111");class f4{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class ih{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}u4=ih,ih.default=new u4(0,0,Xt.default);const _n=Object.freeze({Initialize:{index:0,layout:Ue([Ce("instruction"),((r="authorized")=>Ue([ar("staker"),ar("withdrawer")],r))(),((r="lockup")=>Ue([xi("unixTimestamp"),xi("epoch"),ar("custodian")],r))()])},Authorize:{index:1,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("stakeAuthorizationType")])},Delegate:{index:2,layout:Ue([Ce("instruction")])},Split:{index:3,layout:Ue([Ce("instruction"),xi("lamports")])},Withdraw:{index:4,layout:Ue([Ce("instruction"),xi("lamports")])},Deactivate:{index:5,layout:Ue([Ce("instruction")])},Merge:{index:7,layout:Ue([Ce("instruction")])},AuthorizeWithSeed:{index:8,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("stakeAuthorizationType"),Ua("authoritySeed"),ar("authorityOwner")])}}),vj=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Sl{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:s}=t,i=s||ih.default,c=gr(_n.Initialize,{authorized:{staker:nr(n.staker.toBuffer()),withdrawer:nr(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:nr(i.custodian.toBuffer())}}),l={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:na,isSigner:!1,isWritable:!1}],programId:this.programId,data:c};return new Ir(l)}static createAccountWithSeed(t){const e=new wr;e.add(an.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:s,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:s,lockup:i}))}static createAccount(t){const e=new wr;e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:s,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:s,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:s}=t,i=gr(_n.Delegate);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!1},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:Q0,isSigner:!1,isWritable:!1},{pubkey:vA,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:s,stakeAuthorizationType:i,custodianPubkey:c}=t,l=gr(_n.Authorize,{newAuthorized:nr(s.toBuffer()),stakeAuthorizationType:i.index}),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return c&&p.push({pubkey:c,isSigner:!1,isWritable:!1}),new wr().add({keys:p,programId:this.programId,data:l})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:s,authorityOwner:i,newAuthorizedPubkey:c,stakeAuthorizationType:l,custodianPubkey:p}=t,m=gr(_n.AuthorizeWithSeed,{newAuthorized:nr(c.toBuffer()),stakeAuthorizationType:l.index,authoritySeed:s,authorityOwner:nr(i.toBuffer())}),v=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:oo,isSigner:!1,isWritable:!1}];return p&&v.push({pubkey:p,isSigner:!1,isWritable:!1}),new wr().add({keys:v,programId:this.programId,data:m})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,lamports:i}=t,c=gr(_n.Split,{lamports:i});return new Ir({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static split(t){const e=new wr;return e.add(an.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,basePubkey:i,seed:c,lamports:l}=t,p=new wr;return p.add(an.allocate({accountPubkey:s,basePubkey:i,seed:c,space:this.space,programId:this.programId})),p.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,lamports:l}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:s}=t,i=gr(_n.Merge);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:Q0,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:s,lamports:i,custodianPubkey:c}=t,l=gr(_n.Withdraw,{lamports:i}),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:Q0,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return c&&p.push({pubkey:c,isSigner:!1,isWritable:!1}),new wr().add({keys:p,programId:this.programId,data:l})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,s=gr(_n.Deactivate);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}}Sl.programId=new Xt("Stake11111111111111111111111111111111111111"),Sl.space=200;class c4{constructor(t,e,n,s){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=s}}const bs=Object.freeze({InitializeAccount:{index:0,layout:Ue([Ce("instruction"),((r="voteInit")=>Ue([ar("nodePubkey"),ar("authorizedVoter"),ar("authorizedWithdrawer"),or("commission")],r))()])},Authorize:{index:1,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("voteAuthorizationType")])},Withdraw:{index:3,layout:Ue([Ce("instruction"),xi("lamports")])},AuthorizeWithSeed:{index:10,layout:Ue([Ce("instruction"),((r="voteAuthorizeWithSeedArgs")=>Ue([Ce("voteAuthorizationType"),ar("currentAuthorityDerivedKeyOwnerPubkey"),Ua("currentAuthorityDerivedKeySeed"),ar("newAuthorized")],r))()])}}),gj=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class df{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:s}=t,i=gr(bs.InitializeAccount,{voteInit:{nodePubkey:nr(s.nodePubkey.toBuffer()),authorizedVoter:nr(s.authorizedVoter.toBuffer()),authorizedWithdrawer:nr(s.authorizedWithdrawer.toBuffer()),commission:s.commission}}),c={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:na,isSigner:!1,isWritable:!1},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Ir(c)}static createAccount(t){const e=new wr;return e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:s,voteAuthorizationType:i}=t,c=gr(bs.Authorize,{newAuthorized:nr(s.toBuffer()),voteAuthorizationType:i.index}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new wr().add({keys:l,programId:this.programId,data:c})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:s,newAuthorizedPubkey:i,voteAuthorizationType:c,votePubkey:l}=t,p=gr(bs.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:nr(n.toBuffer()),currentAuthorityDerivedKeySeed:s,newAuthorized:nr(i.toBuffer()),voteAuthorizationType:c.index}}),m=[{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new wr().add({keys:m,programId:this.programId,data:p})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:s,toPubkey:i}=t,c=gr(bs.Withdraw,{lamports:s}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new wr().add({keys:l,programId:this.programId,data:c})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return df.withdraw(t)}}df.programId=new Xt("Vote111111111111111111111111111111111111111"),df.space=3731;const gA=new Xt("Va1idator1nfo111111111111111111111111111111"),yj=we({name:_e(),website:Ve(_e()),details:Ve(_e()),keybaseUsername:Ve(_e())});class Ry{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(ti(e)!==2)return null;const n=[];for(let s=0;s<2;s++){const i=new Xt(e.slice(0,Si));e=e.slice(Si);const c=e.slice(0,1)[0]===1;e=e.slice(1),n.push({publicKey:i,isSigner:c})}if(n[0].publicKey.equals(gA)&&n[1].isSigner){const s=Ua().decode(Ae.Buffer.from(e)),i=JSON.parse(s);return DE(i,yj),new Ry(n[1].publicKey,i)}return null}}const bj=new Xt("Vote111111111111111111111111111111111111111"),wj=Ue([ar("nodePubkey"),ar("authorizedWithdrawer"),or("commission"),In(),On(Ue([In("slot"),Ce("confirmationCount")]),Qs(Ce(),-8),"votes"),or("rootSlotValid"),In("rootSlot"),In(),On(Ue([In("epoch"),ar("authorizedVoter")]),Qs(Ce(),-8),"authorizedVoters"),Ue([On(Ue([ar("authorizedPubkey"),In("epochOfLastAuthorizedSwitch"),In("targetEpoch")]),32,"buf"),In("idx"),or("isEmpty")],"priorVoters"),In(),On(Ue([In("epoch"),In("credits"),In("prevCredits")]),Qs(Ce(),-8),"epochCredits"),Ue([In("slot"),In("timestamp")],"lastTimestamp")]);class Cy{constructor(t){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=wj.decode(nr(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Cy({nodePubkey:new Xt(e.nodePubkey),authorizedWithdrawer:new Xt(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(xj),priorVoters:_j(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function xj({authorizedVoter:r,epoch:t}){return{epoch:t,authorizedVoter:new Xt(r)}}function h4({authorizedPubkey:r,epochOfLastAuthorizedSwitch:t,targetEpoch:e}){return{authorizedPubkey:new Xt(r),epochOfLastAuthorizedSwitch:t,targetEpoch:e}}function _j({buf:r,idx:t,isEmpty:e}){return e?[]:[...r.slice(t+1).map(h4),...r.slice(0,t).map(h4)]}const l4={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var yA=Object.freeze({__proto__:null,Account:class{constructor(r){if(this._publicKey=void 0,this._secretKey=void 0,r){const t=nr(r);if(r.length!==64)throw new Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=nr(Kq()),this._publicKey=nr(Ml(this._secretKey))}get publicKey(){return new Xt(this._publicKey)}get secretKey(){return Ae.Buffer.concat([this._secretKey,this._publicKey],64)}},AddressLookupTableAccount:Yp,AddressLookupTableInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const t=Ce("instruction").decode(r.data);let e;for(const[n,s]of Object.entries(ys))if(s.index==t){e=n;break}if(!e)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return e}static decodeCreateLookupTable(r){this.checkProgramId(r.programId),this.checkKeysLength(r.keys,4);const{recentSlot:t}=Br(ys.CreateLookupTable,r.data);return{authority:r.keys[1].pubkey,payer:r.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(r){if(this.checkProgramId(r.programId),r.keys.length<2)throw new Error(`invalid instruction; found ${r.keys.length} keys, expected at least 2`);const{addresses:t}=Br(ys.ExtendLookupTable,r.data);return{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,payer:r.keys.length>2?r.keys[2].pubkey:void 0,addresses:t.map(e=>new Xt(e))}}static decodeCloseLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,3),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,recipient:r.keys[2].pubkey}}static decodeFreezeLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static decodeDeactivateLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static checkProgramId(r){if(!r.equals(Q2.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(r,t){if(r.length{const p={};return async m=>{const{commitment:v,config:_}=Fr(m),E=this._buildArgs([],v,void 0,_),w=t4(E);return p[w]=p[w]??(async()=>{try{const x=Ee(await this._rpcRequest("getBlockHeight",E),rr(jt()));if("error"in x)throw new De(x.error,"failed to get block height information");return x.result}finally{delete p[w]}})(),await p[w]}})(),t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,e=t.wsEndpoint,n=t.httpHeaders,s=t.fetch,i=t.fetchMiddleware,c=t.disableRetryOnRateLimit,l=t.httpAgent),this._rpcEndpoint=function(p){if(/^https?:/.test(p)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return p}(r),this._rpcWsEndpoint=e||function(p){const m=p.match(sF);if(m==null)throw TypeError(`Failed to validate endpoint URL \`${p}\``);const[v,_,E,w]=m,x=p.startsWith("https:")?"wss:":"ws:",A=E==null?null:parseInt(E.slice(1),10);return`${x}//${_}${A==null?"":`:${A+1}`}${w}`}(r),this._rpcClient=function(p,m,v,_,E,w){const x=v||nF;let A;return w!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),_&&(A=async(P,R)=>{const C=await new Promise((O,z)=>{try{_(P,R,(H,tt)=>O([H,tt]))}catch(H){z(H)}});return await x(...C)}),new _q(async(P,R)=>{const C={method:"POST",body:P,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},m||{},pj)};try{let O,z=5,H=500;for(;O=A?await A(p,C):await x(p,C),O.status===429&&E!==!0&&(z-=1,z!==0);)console.log(`Server responded with ${O.status} ${O.statusText}. Retrying after ${H}ms delay...`),await xa(H),H*=2;const tt=await O.text();O.ok?R(null,tt):R(new Error(`${O.status} ${O.statusText}: ${tt}`))}catch(O){O instanceof Error&&R(O)}},{})}(r,n,s,i,c,l),this._rpcRequest=function(p){return(m,v)=>new Promise((_,E)=>{p.request(m,v,(w,x)=>{w?E(w):_(x)})})}(this._rpcClient),this._rpcBatchRequest=function(p){return m=>new Promise((v,_)=>{m.length===0&&v([]);const E=m.map(w=>p.request(w.methodName,w.args));p.request(E,(w,x)=>{w?_(w):v(x)})})}(this._rpcClient),this._rpcWebSocket=new iF(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,void 0,n),i=Ee(await this._rpcRequest("getBalance",s),nn(jt()));if("error"in i)throw new De(i.error,`failed to get balance for ${r.toBase58()}`);return i.result}async getBalance(r,t){return await this.getBalanceAndContext(r,t).then(e=>e.value).catch(e=>{throw new Error("failed to get balance of account "+r.toBase58()+": "+e)})}async getBlockTime(r){const t=Ee(await this._rpcRequest("getBlockTime",[r]),rr(ke(jt())));if("error"in t)throw new De(t.error,`failed to get block time for slot ${r}`);return t.result}async getMinimumLedgerSlot(){const r=Ee(await this._rpcRequest("minimumLedgerSlot",[]),rr(jt()));if("error"in r)throw new De(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){const r=Ee(await this._rpcRequest("getFirstAvailableBlock",[]),AF);if("error"in r)throw new De(r.error,"failed to get first available block");return r.result}async getSupply(r){let t={};t=typeof r=="string"?{commitment:r}:r?{...r,commitment:r&&r.commitment||this.commitment}:{commitment:this.commitment};const e=Ee(await this._rpcRequest("getSupply",[t]),SF);if("error"in e)throw new De(e.error,"failed to get supply");return e.result}async getTokenSupply(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenSupply",e),nn(Y2));if("error"in n)throw new De(n.error,"failed to get token supply");return n.result}async getTokenAccountBalance(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenAccountBalance",e),nn(Y2));if("error"in n)throw new De(n.error,"failed to get token account balance");return n.result}async getTokenAccountsByOwner(r,t,e){const{commitment:n,config:s}=Fr(e);let i=[r.toBase58()];"mint"in t?i.push({mint:t.mint.toBase58()}):i.push({programId:t.programId.toBase58()});const c=this._buildArgs(i,n,"base64",s),l=Ee(await this._rpcRequest("getTokenAccountsByOwner",c),IF);if("error"in l)throw new De(l.error,`failed to get token accounts owned by account ${r.toBase58()}`);return l.result}async getParsedTokenAccountsByOwner(r,t,e){let n=[r.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const s=this._buildArgs(n,e,"jsonParsed"),i=Ee(await this._rpcRequest("getTokenAccountsByOwner",s),BF);if("error"in i)throw new De(i.error,`failed to get token accounts owned by account ${r.toBase58()}`);return i.result}async getLargestAccounts(r){const t={...r,commitment:r&&r.commitment||this.commitment},e=t.filter||t.commitment?[t]:[],n=Ee(await this._rpcRequest("getLargestAccounts",e),PF);if("error"in n)throw new De(n.error,"failed to get largest accounts");return n.result}async getTokenLargestAccounts(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenLargestAccounts",e),kF);if("error"in n)throw new De(n.error,"failed to get token largest accounts");return n.result}async getAccountInfoAndContext(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,"base64",n),i=Ee(await this._rpcRequest("getAccountInfo",s),nn(ke(nh)));if("error"in i)throw new De(i.error,`failed to get info about account ${r.toBase58()}`);return i.result}async getParsedAccountInfo(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getAccountInfo",s),nn(ke(J2)));if("error"in i)throw new De(i.error,`failed to get info about account ${r.toBase58()}`);return i.result}async getAccountInfo(r,t){try{return(await this.getAccountInfoAndContext(r,t)).value}catch(e){throw new Error("failed to get info about account "+r.toBase58()+": "+e)}}async getMultipleParsedAccounts(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(l=>l.toBase58()),i=this._buildArgs([s],e,"jsonParsed",n),c=Ee(await this._rpcRequest("getMultipleAccounts",i),nn(Ie(ke(J2))));if("error"in c)throw new De(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfoAndContext(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(l=>l.toBase58()),i=this._buildArgs([s],e,"base64",n),c=Ee(await this._rpcRequest("getMultipleAccounts",i),nn(Ie(ke(nh))));if("error"in c)throw new De(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfo(r,t){return(await this.getMultipleAccountsInfoAndContext(r,t)).value}async getStakeActivation(r,t,e){const{commitment:n,config:s}=Fr(t),i=this._buildArgs([r.toBase58()],n,void 0,{...s,epoch:e??(s==null?void 0:s.epoch)}),c=Ee(await this._rpcRequest("getStakeActivation",i),rr(LF));if("error"in c)throw new De(c.error,`failed to get Stake Activation ${r.toBase58()}`);return c.result}async getProgramAccounts(r,t){const{commitment:e,config:n}=Fr(t),{encoding:s,...i}=n||{},c=this._buildArgs([r.toBase58()],e,s||"base64",i),l=await this._rpcRequest("getProgramAccounts",c),p=Ie(RF),m=i.withContext===!0?Ee(l,nn(p)):Ee(l,rr(p));if("error"in m)throw new De(m.error,`failed to get accounts owned by program ${r.toBase58()}`);return m.result}async getParsedProgramAccounts(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getProgramAccounts",s),rr(Ie(TF)));if("error"in i)throw new De(i.error,`failed to get accounts owned by program ${r.toBase58()}`);return i.result}async confirmTransaction(r,t){var s;let e,n;if(typeof r=="string")e=r;else{const i=r;if((s=i.abortSignal)!=null&&s.aborted)return Promise.reject(i.abortSignal.reason);e=i.signature}try{n=Ln.decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}return xr(n.length===64,"signature has invalid length"),typeof r=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:e}):"lastValidBlockHeight"in r?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:r}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:r})}getCancellationPromise(r){return new Promise((t,e)=>{r!=null&&(r.aborted?e(r.reason):r.addEventListener("abort",()=>{e(r.reason)}))})}getTransactionConfirmationPromise({commitment:r,signature:t}){let e,n,s=!1;const i=new Promise((c,l)=>{try{e=this.onSignature(t,(m,v)=>{e=void 0;const _={context:v,value:m};c({__type:rs.PROCESSED,response:_})},r);const p=new Promise(m=>{e==null?m():n=this._onSubscriptionStateChange(e,v=>{v==="subscribed"&&m()})});(async()=>{if(await p,s)return;const m=await this.getSignatureStatus(t);if(s||m==null)return;const{context:v,value:_}=m;if(_!=null)if(_!=null&&_.err)l(_.err);else{switch(r){case"confirmed":case"single":case"singleGossip":if(_.confirmationStatus==="processed")return;break;case"finalized":case"max":case"root":if(_.confirmationStatus==="processed"||_.confirmationStatus==="confirmed")return}s=!0,c({__type:rs.PROCESSED,response:{context:v,value:_}})}})()}catch(p){l(p)}});return{abortConfirmation:()=>{n&&(n(),n=void 0),e!=null&&(this.removeSignatureListener(e),e=void 0)},confirmationPromise:i}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r,strategy:{abortSignal:t,lastValidBlockHeight:e,signature:n}}){let s=!1;const i=new Promise(v=>{const _=async()=>{try{return await this.getBlockHeight(r)}catch{return-1}};(async()=>{let E=await _();if(!s){for(;E<=e;)if(await xa(1e3),s||(E=await _(),s))return;v({__type:rs.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:c,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:r,signature:n}),p=this.getCancellationPromise(t);let m;try{const v=await Promise.race([p,l,i]);if(v.__type!==rs.PROCESSED)throw new Z2(n);m=v.response}finally{s=!0,c()}return m}async confirmTransactionUsingDurableNonceStrategy({commitment:r,strategy:{abortSignal:t,minContextSlot:e,nonceAccountPubkey:n,nonceValue:s,signature:i}}){let c=!1;const l=new Promise(E=>{let w=s,x=null;const A=async()=>{try{const{context:B,value:P}=await this.getNonceAndContext(n,{commitment:r,minContextSlot:e});return x=B.slot,P==null?void 0:P.nonce}catch{return w}};(async()=>{if(w=await A(),!c)for(;;){if(s!==w)return void E({__type:rs.NONCE_INVALID,slotInWhichNonceDidAdvance:x});if(await xa(2e3),c||(w=await A(),c))return}})()}),{abortConfirmation:p,confirmationPromise:m}=this.getTransactionConfirmationPromise({commitment:r,signature:i}),v=this.getCancellationPromise(t);let _;try{const E=await Promise.race([v,m,l]);if(E.__type===rs.PROCESSED)_=E.response;else{let w;for(;;){const x=await this.getSignatureStatus(i);if(x==null)break;if(!(x.context.slot<(E.slotInWhichNonceDidAdvance??e))){w=x;break}await xa(400)}if(!(w!=null&&w.value))throw new Su(i);{const x=r||"finalized",{confirmationStatus:A}=w.value;switch(x){case"processed":case"recent":if(A!=="processed"&&A!=="confirmed"&&A!=="finalized")throw new Su(i);break;case"confirmed":case"single":case"singleGossip":if(A!=="confirmed"&&A!=="finalized")throw new Su(i);break;case"finalized":case"max":case"root":if(A!=="finalized")throw new Su(i)}_={context:w.context,value:{err:w.value.err}}}}}finally{c=!0,p()}return _}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:r,signature:t}){let e;const n=new Promise(l=>{let p=this._confirmTransactionInitialTimeout||6e4;switch(r){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":p=this._confirmTransactionInitialTimeout||3e4}e=setTimeout(()=>l({__type:rs.TIMED_OUT,timeoutMs:p}),p)}),{abortConfirmation:s,confirmationPromise:i}=this.getTransactionConfirmationPromise({commitment:r,signature:t});let c;try{const l=await Promise.race([i,n]);if(l.__type!==rs.PROCESSED)throw new W2(t,l.timeoutMs/1e3);c=l.response}finally{clearTimeout(e),s()}return c}async getClusterNodes(){const r=Ee(await this._rpcRequest("getClusterNodes",[]),rr(Ie(VF)));if("error"in r)throw new De(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getVoteAccounts",t),ZF);if("error"in e)throw new De(e.error,"failed to get vote accounts");return e.result}async getSlot(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getSlot",n),rr(jt()));if("error"in s)throw new De(s.error,"failed to get slot");return s.result}async getSlotLeader(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getSlotLeader",n),rr(_e()));if("error"in s)throw new De(s.error,"failed to get slot leader");return s.result}async getSlotLeaders(r,t){const e=[r,t],n=Ee(await this._rpcRequest("getSlotLeaders",e),rr(Ie(hn)));if("error"in n)throw new De(n.error,"failed to get slot leaders");return n.result}async getSignatureStatus(r,t){const{context:e,value:n}=await this.getSignatureStatuses([r],t);return xr(n.length===1),{context:e,value:n[0]}}async getSignatureStatuses(r,t){const e=[r];t&&e.push(t);const n=Ee(await this._rpcRequest("getSignatureStatuses",e),YF);if("error"in n)throw new De(n.error,"failed to get signature status");return n.result}async getTransactionCount(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getTransactionCount",n),rr(jt()));if("error"in s)throw new De(s.error,"failed to get transaction count");return s.result}async getTotalSupply(r){return(await this.getSupply({commitment:r,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getInflationGovernor",t),bF);if("error"in e)throw new De(e.error,"failed to get inflation");return e.result}async getInflationReward(r,t,e){const{commitment:n,config:s}=Fr(e),i=this._buildArgs([r.map(l=>l.toBase58())],n,void 0,{...s,epoch:t??(s==null?void 0:s.epoch)}),c=Ee(await this._rpcRequest("getInflationReward",i),fF);if("error"in c)throw new De(c.error,"failed to get inflation reward");return c.result}async getInflationRate(){const r=Ee(await this._rpcRequest("getInflationRate",[]),wF);if("error"in r)throw new De(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getEpochInfo",n),_F);if("error"in s)throw new De(s.error,"failed to get epoch info");return s.result}async getEpochSchedule(){const r=Ee(await this._rpcRequest("getEpochSchedule",[]),MF);if("error"in r)throw new De(r.error,"failed to get epoch schedule");const t=r.result;return new e4(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){const r=Ee(await this._rpcRequest("getLeaderSchedule",[]),EF);if("error"in r)throw new De(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(r,t){const e=this._buildArgs([r],t),n=Ee(await this._rpcRequest("getMinimumBalanceForRentExemption",e),XF);return"error"in n?(console.warn("Unable to fetch minimum balance for rent exemption"),0):n.result}async getRecentBlockhashAndContext(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getRecentBlockhash",t),oj);if("error"in e)throw new De(e.error,"failed to get recent blockhash");return e.result}async getRecentPerformanceSamples(r){const t=Ee(await this._rpcRequest("getRecentPerformanceSamples",r?[r]:[]),uj);if("error"in t)throw new De(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(r,t){const e=this._buildArgs([r],t),n=Ee(await this._rpcRequest("getFeeCalculatorForBlockhash",e),fj);if("error"in n)throw new De(n.error,"failed to get fee calculator");const{context:s,value:i}=n.result;return{context:s,value:i!==null?i.feeCalculator:null}}async getFeeForMessage(r,t){const e=nr(r.serialize()).toString("base64"),n=this._buildArgs([e],t),s=Ee(await this._rpcRequest("getFeeForMessage",n),nn(ke(jt())));if("error"in s)throw new De(s.error,"failed to get fee for message");if(s.result===null)throw new Error("invalid blockhash");return s.result}async getRecentPrioritizationFees(r){var s;const t=(s=r==null?void 0:r.lockedWritableAccounts)==null?void 0:s.map(i=>i.toBase58()),e=t!=null&&t.length?[t]:[],n=Ee(await this._rpcRequest("getRecentPrioritizationFees",e),xF);if("error"in n)throw new De(n.error,"failed to get recent prioritization fees");return n.result}async getRecentBlockhash(r){try{return(await this.getRecentBlockhashAndContext(r)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(r){try{return(await this.getLatestBlockhashAndContext(r)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getLatestBlockhash",n),sj);if("error"in s)throw new De(s.error,"failed to get latest blockhash");return s.result}async isBlockhashValid(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r],e,void 0,n),i=Ee(await this._rpcRequest("isBlockhashValid",s),aj);if("error"in i)throw new De(i.error,"failed to determine if the blockhash `"+r+"`is valid");return i.result}async getVersion(){const r=Ee(await this._rpcRequest("getVersion",[]),rr(gF));if("error"in r)throw new De(r.error,"failed to get version");return r.result}async getGenesisHash(){const r=Ee(await this._rpcRequest("getGenesisHash",[]),rr(_e()));if("error"in r)throw new De(r.error,"failed to get genesis hash");return r.result}async getBlock(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,void 0,n),i=await this._rpcRequest("getBlock",s);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const c=Ee(i,tj);if("error"in c)throw c.error;return c.result}case"none":{const c=Ee(i,QF);if("error"in c)throw c.error;return c.result}default:{const c=Ee(i,JF);if("error"in c)throw c.error;const{result:l}=c;return l?{...l,transactions:l.transactions.map(({transaction:p,meta:m,version:v})=>({meta:m,transaction:{...p,message:Xp(v,p.message)},version:v}))}:null}}}catch(c){throw new De(c,"failed to get confirmed block")}}async getParsedBlock(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed",n),i=await this._rpcRequest("getBlock",s);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const c=Ee(i,rj);if("error"in c)throw c.error;return c.result}case"none":{const c=Ee(i,nj);if("error"in c)throw c.error;return c.result}default:{const c=Ee(i,ej);if("error"in c)throw c.error;return c.result}}}catch(c){throw new De(c,"failed to get block")}}async getBlockProduction(r){let t,e;if(typeof r=="string")e=r;else if(r){const{commitment:i,...c}=r;e=i,t=c}const n=this._buildArgs([],e,"base64",t),s=Ee(await this._rpcRequest("getBlockProduction",n),yF);if("error"in s)throw new De(s.error,"failed to get block production information");return s.result}async getTransaction(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,void 0,n),i=Ee(await this._rpcRequest("getTransaction",s),Jp);if("error"in i)throw new De(i.error,"failed to get transaction");const c=i.result;return c&&{...c,transaction:{...c.transaction,message:Xp(c.version,c.transaction.message)}}}async getParsedTransaction(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getTransaction",s),d0);if("error"in i)throw new De(i.error,"failed to get transaction");return i.result}async getParsedTransactions(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(i=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([i],e,"jsonParsed",n)}));return(await this._rpcBatchRequest(s)).map(i=>{const c=Ee(i,d0);if("error"in c)throw new De(c.error,"failed to get transactions");return c.result})}async getTransactions(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(i=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([i],e,void 0,n)}));return(await this._rpcBatchRequest(s)).map(i=>{const c=Ee(i,Jp);if("error"in c)throw new De(c.error,"failed to get transactions");const l=c.result;return l&&{...l,transaction:{...l.transaction,message:Xp(l.version,l.transaction.message)}}})}async getConfirmedBlock(r,t){const e=this._buildArgsAtLeastConfirmed([r],t),n=Ee(await this._rpcRequest("getConfirmedBlock",e),ij);if("error"in n)throw new De(n.error,"failed to get confirmed block");const s=n.result;if(!s)throw new Error("Confirmed block "+r+" not found");const i={...s,transactions:s.transactions.map(({transaction:c,meta:l})=>{const p=new uo(c.message);return{meta:l,transaction:{...c,message:p}}})};return{...i,transactions:i.transactions.map(({transaction:c,meta:l})=>({meta:l,transaction:wr.populate(c.message,c.signatures)}))}}async getBlocks(r,t,e){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[r,t]:[r],e),s=Ee(await this._rpcRequest("getBlocks",n),rr(Ie(jt())));if("error"in s)throw new De(s.error,"failed to get blocks");return s.result}async getBlockSignatures(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=Ee(await this._rpcRequest("getBlock",e),s4);if("error"in n)throw new De(n.error,"failed to get block");const s=n.result;if(!s)throw new Error("Block "+r+" not found");return s}async getConfirmedBlockSignatures(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=Ee(await this._rpcRequest("getConfirmedBlock",e),s4);if("error"in n)throw new De(n.error,"failed to get confirmed block");const s=n.result;if(!s)throw new Error("Confirmed block "+r+" not found");return s}async getConfirmedTransaction(r,t){const e=this._buildArgsAtLeastConfirmed([r],t),n=Ee(await this._rpcRequest("getConfirmedTransaction",e),Jp);if("error"in n)throw new De(n.error,"failed to get transaction");const s=n.result;if(!s)return s;const i=new uo(s.transaction.message),c=s.transaction.signatures;return{...s,transaction:wr.populate(i,c)}}async getParsedConfirmedTransaction(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,"jsonParsed"),n=Ee(await this._rpcRequest("getConfirmedTransaction",e),d0);if("error"in n)throw new De(n.error,"failed to get confirmed transaction");return n.result}async getParsedConfirmedTransactions(r,t){const e=r.map(n=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([n],t,"jsonParsed")}));return(await this._rpcBatchRequest(e)).map(n=>{const s=Ee(n,d0);if("error"in s)throw new De(s.error,"failed to get confirmed transactions");return s.result})}async getConfirmedSignaturesForAddress(r,t,e){let n={},s=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--t<=0||t0&&(n.until=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}let i=await this.getSlot("finalized");for(;!("before"in n||++e>i);)try{const c=await this.getConfirmedBlockSignatures(e);c.signatures.length>0&&(n.before=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}return(await this.getConfirmedSignaturesForAddress2(r,n)).map(c=>c.signature)}async getConfirmedSignaturesForAddress2(r,t,e){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],e,void 0,t),s=Ee(await this._rpcRequest("getConfirmedSignaturesForAddress2",n),OF);if("error"in s)throw new De(s.error,"failed to get confirmed signatures for address");return s.result}async getSignaturesForAddress(r,t,e){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],e,void 0,t),s=Ee(await this._rpcRequest("getSignaturesForAddress",n),UF);if("error"in s)throw new De(s.error,"failed to get signatures for address");return s.result}async getAddressLookupTable(r,t){const{context:e,value:n}=await this.getAccountInfoAndContext(r,t);let s=null;return n!==null&&(s=new Yp({key:r,state:Yp.deserialize(n.data)})),{context:e,value:s}}async getNonceAndContext(r,t){const{context:e,value:n}=await this.getAccountInfoAndContext(r,t);let s=null;return n!==null&&(s=El.fromAccountData(n.data)),{context:e,value:s}}async getNonce(r,t){return await this.getNonceAndContext(r,t).then(e=>e.value).catch(e=>{throw new Error("failed to get nonce for account "+r.toBase58()+": "+e)})}async requestAirdrop(r,t){const e=Ee(await this._rpcRequest("requestAirdrop",[r.toBase58(),t]),cj);if("error"in e)throw new De(e.error,`airdrop to ${r.toBase58()} failed`);return e.result}async _blockhashWithExpiryBlockHeight(r){if(!r){for(;this._pollingBlockhash;)await xa(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(this._blockhashInfo.latestBlockhash!==null&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const r=Date.now(),t=this._blockhashInfo.latestBlockhash,e=t?t.blockhash:null;for(let n=0;n<50;n++){const s=await this.getLatestBlockhash("finalized");if(e!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await xa(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-r}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,"base64",e),s=Ee(await this._rpcRequest("getStakeMinimumDelegation",n),nn(jt()));if("error"in s)throw new De(s.error,"failed to get stake minimum delegation");return s.result}async simulateTransaction(r,t,e){if("message"in r){const _=r.serialize(),E=Ae.Buffer.from(_).toString("base64");if(Array.isArray(t)||e!==void 0)throw new Error("Invalid arguments");const w=t||{};w.encoding="base64","commitment"in w||(w.commitment=this.commitment);const x=[E,w],A=Ee(await this._rpcRequest("simulateTransaction",x),r4);if("error"in A)throw new Error("failed to simulate transaction: "+A.error.message);return A.result}let n;if(r instanceof wr){let _=r;n=new wr,n.feePayer=_.feePayer,n.instructions=r.instructions,n.nonceInfo=_.nonceInfo,n.signatures=_.signatures}else n=wr.populate(r),n._message=n._json=void 0;if(t!==void 0&&!Array.isArray(t))throw new Error("Invalid arguments");const s=t;if(n.nonceInfo&&s)n.sign(...s);else{let _=this._disableBlockhashCaching;for(;;){const E=await this._blockhashWithExpiryBlockHeight(_);if(n.lastValidBlockHeight=E.lastValidBlockHeight,n.recentBlockhash=E.blockhash,!s)break;if(n.sign(...s),!n.signature)throw new Error("!signature");const w=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(w)&&!this._blockhashInfo.transactionSignatures.includes(w)){this._blockhashInfo.simulatedSignatures.push(w);break}_=!0}}const i=n._compile(),c=i.serialize(),l=n._serialize(c).toString("base64"),p={encoding:"base64",commitment:this.commitment};if(e){const _=(Array.isArray(e)?e:i.nonProgramIds()).map(E=>E.toBase58());p.accounts={encoding:"base64",addresses:_}}s&&(p.sigVerify=!0);const m=[l,p],v=Ee(await this._rpcRequest("simulateTransaction",m),r4);if("error"in v){let _;if("data"in v.error&&(_=v.error.data.logs,_&&Array.isArray(_))){const E=` + `,w=E+_.join(E);console.error(v.error.message,w)}throw new Ku("failed to simulate transaction: "+v.error.message,_)}return v.result}async sendTransaction(r,t,e){if("version"in r){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const i=r.serialize();return await this.sendRawTransaction(i,t)}if(t===void 0||!Array.isArray(t))throw new Error("Invalid arguments");const n=t;if(r.nonceInfo)r.sign(...n);else{let i=this._disableBlockhashCaching;for(;;){const c=await this._blockhashWithExpiryBlockHeight(i);if(r.lastValidBlockHeight=c.lastValidBlockHeight,r.recentBlockhash=c.blockhash,r.sign(...n),!r.signature)throw new Error("!signature");const l=r.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(l)){this._blockhashInfo.transactionSignatures.push(l);break}i=!0}}const s=r.serialize();return await this.sendRawTransaction(s,e)}async sendRawTransaction(r,t){const e=nr(r).toString("base64");return await this.sendEncodedTransaction(e,t)}async sendEncodedTransaction(r,t){const e={encoding:"base64"},n=t&&t.skipPreflight,s=t&&t.preflightCommitment||this.commitment;t&&t.maxRetries!=null&&(e.maxRetries=t.maxRetries),t&&t.minContextSlot!=null&&(e.minContextSlot=t.minContextSlot),n&&(e.skipPreflight=n),s&&(e.preflightCommitment=s);const i=[r,e],c=Ee(await this._rpcRequest("sendTransaction",i),hj);if("error"in c){let l;throw"data"in c.error&&(l=c.error.data.logs),new Ku("failed to send transaction: "+c.error.message,l)}return c.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(r){this._rpcWebSocketConnected=!1,console.error("ws error:",r.message)}_wsOnClose(r){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),r!==1e3?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([t,e])=>{this._setSubscription(t,{...e,state:"pending"})})):this._updateSubscriptions()}_setSubscription(r,t){var n;const e=(n=this._subscriptionsByHash[r])==null?void 0:n.state;if(this._subscriptionsByHash[r]=t,e!==t.state){const s=this._subscriptionStateChangeCallbacksByHash[r];s&&s.forEach(i=>{try{i(t.state)}catch{}})}}_onSubscriptionStateChange(r,t){var s;const e=this._subscriptionHashByClientSubscriptionId[r];if(e==null)return()=>{};const n=(s=this._subscriptionStateChangeCallbacksByHash)[e]||(s[e]=new Set);return n.add(t),()=>{n.delete(t),n.size===0&&delete this._subscriptionStateChangeCallbacksByHash[e]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}},500)));if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const r=this._rpcWebSocketGeneration,t=()=>r===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{const n=this._subscriptionsByHash[e];if(n!==void 0)switch(n.state){case"pending":case"unsubscribed":if(n.callbacks.size===0)return delete this._subscriptionsByHash[e],n.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:s,method:i}=n;try{this._setSubscription(e,{...n,state:"subscribing"});const c=await this._rpcWebSocket.call(i,s);this._setSubscription(e,{...n,serverSubscriptionId:c,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[c]=n.callbacks,await this._updateSubscriptions()}catch(c){if(c instanceof Error&&console.error(`${i} error for argument`,s,c.message),!t())return;this._setSubscription(e,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":n.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:s,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(e,{...n,state:"unsubscribing"}),this._setSubscription(e,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[s])}catch(c){return c instanceof Error&&console.error(`${i} error:`,c.message),t()?(this._setSubscription(e,{...n,state:"subscribed"}),void await this._updateSubscriptions()):void 0}}this._setSubscription(e,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(r,t){const e=this._subscriptionCallbacksByServerSubscriptionId[r];e!==void 0&&e.forEach(n=>{try{n(...t)}catch(s){console.error(s)}})}_wsOnAccountNotification(r){const{result:t,subscription:e}=Ee(r,NF);this._handleServerNotification(e,[t.value,t.context])}_makeSubscription(r,t){const e=this._nextClientSubscriptionId++,n=t4([r.method,t],!0),s=this._subscriptionsByHash[n];return s===void 0?this._subscriptionsByHash[n]={...r,args:t,callbacks:new Set([r.callback]),state:"pending"}:s.callbacks.add(r.callback),this._subscriptionHashByClientSubscriptionId[e]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[e]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[e],delete this._subscriptionHashByClientSubscriptionId[e];const i=this._subscriptionsByHash[n];xr(i!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${e}`),i.callbacks.delete(r.callback),await this._updateSubscriptions()},this._updateSubscriptions(),e}onAccountChange(r,t,e){const n=this._buildArgs([r.toBase58()],e||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},n)}async removeAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"account change")}_wsOnProgramAccountNotification(r){const{result:t,subscription:e}=Ee(r,zF);this._handleServerNotification(e,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(r,t,e,n){const s=this._buildArgs([r.toBase58()],e||this._commitment||"finalized","base64",n?{filters:n}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"program account change")}onLogs(r,t,e){const n=this._buildArgs([typeof r=="object"?{mentions:[r.toString()]}:r],e||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(r){await this._unsubscribeClientSubscription(r,"logs")}_wsOnLogsNotification(r){const{result:t,subscription:e}=Ee(r,dj);this._handleServerNotification(e,[t.value,t.context])}_wsOnSlotNotification(r){const{result:t,subscription:e}=Ee(r,FF);this._handleServerNotification(e,[t])}onSlotChange(r){return this._makeSubscription({callback:r,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(r){await this._unsubscribeClientSubscription(r,"slot change")}_wsOnSlotUpdatesNotification(r){const{result:t,subscription:e}=Ee(r,KF);this._handleServerNotification(e,[t])}onSlotUpdate(r){return this._makeSubscription({callback:r,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(r){await this._unsubscribeClientSubscription(r,"slot update")}async _unsubscribeClientSubscription(r,t){const e=this._subscriptionDisposeFunctionsByClientSubscriptionId[r];e?await e():console.warn(`Ignored unsubscribe request because an active subscription with id \`${r}\` for '${t}' events could not be found.`)}_buildArgs(r,t,e,n){const s=t||this._commitment;if(s||e||n){let i={};e&&(i.encoding=e),s&&(i.commitment=s),n&&(i=Object.assign(i,n)),r.push(i)}return r}_buildArgsAtLeastConfirmed(r,t,e,n){const s=t||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(r,t,e,n)}_wsOnSignatureNotification(r){const{result:t,subscription:e}=Ee(r,$F);t.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(e),this._handleServerNotification(e,t.value==="receivedSignature"?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(r,t,e){const n=this._buildArgs([r],e||this._commitment||"finalized"),s=this._makeSubscription({callback:(i,c)=>{if(i.type==="status"){t(i.result,c);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return s}onSignatureWithOptions(r,t,e){const{commitment:n,...s}={...e,commitment:e&&e.commitment||this._commitment||"finalized"},i=this._buildArgs([r],n,void 0,s),c=this._makeSubscription({callback:(l,p)=>{t(l,p);try{this.removeSignatureListener(c)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return c}async removeSignatureListener(r){await this._unsubscribeClientSubscription(r,"signature result")}_wsOnRootNotification(r){const{result:t,subscription:e}=Ee(r,HF);this._handleServerNotification(e,[t])}onRootChange(r){return this._makeSubscription({callback:r,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(r){await this._unsubscribeClientSubscription(r,"root change")}},Ed25519Program:kd,Enum:class extends V2{constructor(r){if(super(r),this.enum="",Object.keys(r).length!==1)throw new Error("Enum can only take single value");Object.keys(r).map(t=>{this.enum=t})}},EpochSchedule:e4,FeeCalculatorLayout:sA,Keypair:$u,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:ys,Loader:ja,Lockup:ih,MAX_SEED_LENGTH:32,Message:uo,MessageAccountKeys:eh,MessageV0:eu,NONCE_ACCOUNT_LENGTH:rh,NonceAccount:El,PACKET_DATA_SIZE:ju,PUBLIC_KEY_LENGTH:Si,PublicKey:Xt,SIGNATURE_LENGTH_IN_BYTES:hf,SOLANA_SCHEMA:Ic,STAKE_CONFIG_ID:vA,STAKE_INSTRUCTION_LAYOUTS:_n,SYSTEM_INSTRUCTION_LAYOUTS:Ur,SYSVAR_CLOCK_PUBKEY:oo,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Wq,SYSVAR_INSTRUCTIONS_PUBKEY:Gq,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:J0,SYSVAR_RENT_PUBKEY:na,SYSVAR_REWARDS_PUBKEY:Yq,SYSVAR_SLOT_HASHES_PUBKEY:Xq,SYSVAR_SLOT_HISTORY_PUBKEY:Jq,SYSVAR_STAKE_HISTORY_PUBKEY:Q0,Secp256k1Program:Hu,SendTransactionError:Ku,SolanaJSONRPCError:De,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:vj,StakeInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const t=Ce("instruction").decode(r.data);let e;for(const[n,s]of Object.entries(_n))if(s.index==t){e=n;break}if(!e)throw new Error("Instruction type incorrect; not a StakeInstruction");return e}static decodeInitialize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{authorized:t,lockup:e}=Br(_n.Initialize,r.data);return{stakePubkey:r.keys[0].pubkey,authorized:new f4(new Xt(t.staker),new Xt(t.withdrawer)),lockup:new ih(e.unixTimestamp,e.epoch,new Xt(e.custodian))}}static decodeDelegate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,6),Br(_n.Delegate,r.data),{stakePubkey:r.keys[0].pubkey,votePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[5].pubkey}}static decodeAuthorize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{newAuthorized:t,stakeAuthorizationType:e}=Br(_n.Authorize,r.data),n={stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey,newAuthorizedPubkey:new Xt(t),stakeAuthorizationType:{index:e}};return r.keys.length>3&&(n.custodianPubkey=r.keys[3].pubkey),n}static decodeAuthorizeWithSeed(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{newAuthorized:t,stakeAuthorizationType:e,authoritySeed:n,authorityOwner:s}=Br(_n.AuthorizeWithSeed,r.data),i={stakePubkey:r.keys[0].pubkey,authorityBase:r.keys[1].pubkey,authoritySeed:n,authorityOwner:new Xt(s),newAuthorizedPubkey:new Xt(t),stakeAuthorizationType:{index:e}};return r.keys.length>3&&(i.custodianPubkey=r.keys[3].pubkey),i}static decodeSplit(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{lamports:t}=Br(_n.Split,r.data);return{stakePubkey:r.keys[0].pubkey,splitStakePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[2].pubkey,lamports:t}}static decodeMerge(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),Br(_n.Merge,r.data),{stakePubkey:r.keys[0].pubkey,sourceStakePubKey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey}}static decodeWithdraw(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,5);const{lamports:t}=Br(_n.Withdraw,r.data),e={stakePubkey:r.keys[0].pubkey,toPubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey,lamports:t};return r.keys.length>5&&(e.custodianPubkey=r.keys[5].pubkey),e}static decodeDeactivate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),Br(_n.Deactivate,r.data),{stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey}}static checkProgramId(r){if(!r.equals(Sl.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(r,t){if(r.length({decode:r.decode.bind(r),encode:r.encode.bind(r)}),tl=(r=>t=>{const e=Or(r,t),{encode:n,decode:s}=Ty(e),i=e;return i.decode=(c,l)=>{const p=s(c,l);return NE(Zt.Buffer.from(p))},i.encode=(c,l,p)=>{const m=yy(c,r);return n(m,l,p)},i})(8),bA=r=>{const t=or(r),{encode:e,decode:n}=Ty(t),s=t;return s.decode=(i,c)=>!!n(i,c),s.encode=(i,c,l)=>{const p=Number(i);return e(p,c,l)},s},Rn=r=>{const t=Or(32,r),{encode:e,decode:n}=Ty(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return new Xt(l)},s.encode=(i,c,l)=>{const p=i.toBuffer();return e(p,c,l)},s};class Mj extends Error{constructor(t){super(t)}}class Ej extends Mj{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var d4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Mint=1]="Mint",r[r.Account=2]="Account"})(d4||(d4={}));Ue([or("m"),or("n"),bA("isInitialized"),Rn("signer1"),Rn("signer2"),Rn("signer3"),Rn("signer4"),Rn("signer5"),Rn("signer6"),Rn("signer7"),Rn("signer8"),Rn("signer9"),Rn("signer10"),Rn("signer11")]).span;var p4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initialized=1]="Initialized",r[r.Frozen=2]="Frozen"})(p4||(p4={}));const Aj=Ue([Rn("mint"),Rn("owner"),tl("amount"),Ce("delegateOption"),Rn("delegate"),or("state"),Ce("isNativeOption"),tl("isNative"),tl("delegatedAmount"),Ce("closeAuthorityOption"),Rn("closeAuthority")]);Aj.span;const Sj=Ue([Ce("mintAuthorityOption"),Rn("mintAuthority"),tl("supply"),or("decimals"),bA("isInitialized"),Ce("freezeAuthorityOption"),Rn("freezeAuthority")]);Sj.span;function m4(r,t,e=!1,n=kl,s=ev){if(!e&&!Xt.isOnCurve(t.toBuffer()))throw new Ej;const[i]=Xt.findProgramAddressSync([t.toBuffer(),n.toBuffer(),r.toBuffer()],s);return i}function kj(r,t,e,n,s=kl,i=ev){return function(c,l,p,m,v,_=kl,E=ev){const w=[{pubkey:c,isSigner:!0,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:an.programId,isSigner:!1,isWritable:!1},{pubkey:_,isSigner:!1,isWritable:!1}];return new Ir({keys:w,programId:E,data:v})}(r,t,e,n,Zt.Buffer.alloc(0),s,i)}var Il;(function(r){r.SymbolNotFound="SymbolNotFound",r.InvalidSubdomain="InvalidSubdomain",r.FavouriteDomainNotFound="FavouriteDomainNotFound",r.MissingParentOwner="MissingParentOwner",r.U32Overflow="U32Overflow",r.InvalidBufferLength="InvalidBufferLength",r.U64Overflow="U64Overflow",r.NoRecordData="NoRecordData",r.InvalidRecordData="InvalidRecordData",r.UnsupportedRecord="UnsupportedRecord",r.InvalidEvmAddress="InvalidEvmAddress",r.InvalidInjectiveAddress="InvalidInjectiveAddress",r.InvalidARecord="InvalidARecord",r.InvalidAAAARecord="InvalidAAAARecord",r.InvalidRecordInput="InvalidRecordInput",r.InvalidSignature="InvalidSignature",r.AccountDoesNotExist="AccountDoesNotExist",r.MultipleRegistries="MultipleRegistries",r.InvalidReverseTwitter="InvalidReverseTwitter",r.NoAccountData="NoAccountData",r.InvalidInput="InvalidInput",r.InvalidDomain="InvalidDomain",r.InvalidCustomBg="InvalidCustomBackground",r.UnsupportedSignature="UnsupportedSignature",r.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",r.RecordIsNotSigned="RecordIsNotSigned",r.UnsupportedSignatureType="UnsupportedSignatureType",r.InvalidSolRecordV2="InvalidSolRecordV2",r.MissingVerifier="MissingVerifier"})(Il||(Il={}));class Bl extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,Bl)}}class oh{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return fy(oh.schema,this)}getInstruction(t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B,P){const R=Ae.Buffer.from(this.serialize());let C=[];return C.push({pubkey:e,isSigner:!1,isWritable:!1}),C.push({pubkey:n,isSigner:!1,isWritable:!1}),C.push({pubkey:s,isSigner:!1,isWritable:!0}),C.push({pubkey:i,isSigner:!1,isWritable:!0}),C.push({pubkey:c,isSigner:!1,isWritable:!1}),C.push({pubkey:l,isSigner:!1,isWritable:!1}),C.push({pubkey:p,isSigner:!0,isWritable:!0}),C.push({pubkey:m,isSigner:!1,isWritable:!0}),C.push({pubkey:v,isSigner:!1,isWritable:!1}),C.push({pubkey:_,isSigner:!1,isWritable:!1}),C.push({pubkey:E,isSigner:!1,isWritable:!1}),C.push({pubkey:w,isSigner:!1,isWritable:!0}),C.push({pubkey:x,isSigner:!1,isWritable:!1}),C.push({pubkey:A,isSigner:!1,isWritable:!1}),C.push({pubkey:B,isSigner:!1,isWritable:!1}),P&&C.push({pubkey:P,isSigner:!1,isWritable:!0}),new Ir({keys:C,programId:t,data:R})}}oh.schema=new Map([[oh,{kind:"struct",fields:[["tag","u8"],["name","string"],["space","u32"],["referrerIdxOpt",{kind:"option",type:"u16"}]]}]]);new Xt("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk");Ae.Buffer.from("tokenized_name");var v4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.CentralState=1]="CentralState",r[r.ActiveRecord=2]="ActiveRecord",r[r.InactiveRecord=3]="InactiveRecord"})(v4||(v4={}));var wA={},ur={},qh=xA;function xA(r,t){if(!r)throw new Error(t||"Assertion failed")}xA.equal=function(r,t,e){if(r!=t)throw new Error(e||"Assertion failed: "+r+" != "+t)};var rv={exports:{}};typeof Object.create=="function"?rv.exports=function(r,t){t&&(r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:rv.exports=function(r,t){if(t){r.super_=t;var e=function(){};e.prototype=t.prototype,r.prototype=new e,r.prototype.constructor=r}};var Ij=rv.exports,Bj=qh,Pj=Ij;function Rj(r,t){return(64512&r.charCodeAt(t))==55296&&!(t<0||t+1>=r.length)&&(64512&r.charCodeAt(t+1))==56320}function g4(r){return(r>>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function y4(r){return r.length===1?"0"+r:r}function b4(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}ur.inherits=Pj,ur.toArray=function(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),s=0;s>6|192,e[n++]=63&i|128):Rj(r,s)?(i=65536+((1023&i)<<10)+(1023&r.charCodeAt(++s)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}else for(s=0;s>>0}return i},ur.split32=function(r,t){for(var e=new Array(4*r.length),n=0,s=0;n>>24,e[s+1]=i>>>16&255,e[s+2]=i>>>8&255,e[s+3]=255&i):(e[s+3]=i>>>24,e[s+2]=i>>>16&255,e[s+1]=i>>>8&255,e[s]=255&i)}return e},ur.rotr32=function(r,t){return r>>>t|r<<32-t},ur.rotl32=function(r,t){return r<>>32-t},ur.sum32=function(r,t){return r+t>>>0},ur.sum32_3=function(r,t,e){return r+t+e>>>0},ur.sum32_4=function(r,t,e,n){return r+t+e+n>>>0},ur.sum32_5=function(r,t,e,n,s){return r+t+e+n+s>>>0},ur.sum64=function(r,t,e,n){var s=r[t],i=n+r[t+1]>>>0,c=(i>>0,r[t+1]=i},ur.sum64_hi=function(r,t,e,n){return(t+n>>>0>>0},ur.sum64_lo=function(r,t,e,n){return t+n>>>0},ur.sum64_4_hi=function(r,t,e,n,s,i,c,l){var p=0,m=t;return p+=(m=m+n>>>0)>>0)>>0)>>0},ur.sum64_4_lo=function(r,t,e,n,s,i,c,l){return t+n+i+l>>>0},ur.sum64_5_hi=function(r,t,e,n,s,i,c,l,p,m){var v=0,_=t;return v+=(_=_+n>>>0)>>0)>>0)>>0)>>0},ur.sum64_5_lo=function(r,t,e,n,s,i,c,l,p,m){return t+n+i+l+m>>>0},ur.rotr64_hi=function(r,t,e){return(t<<32-e|r>>>e)>>>0},ur.rotr64_lo=function(r,t,e){return(r<<32-e|t>>>e)>>>0},ur.shr64_hi=function(r,t,e){return r>>>e},ur.shr64_lo=function(r,t,e){return(r<<32-e|t>>>e)>>>0};var Tf={},w4=ur,Cj=qh;function p0(){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}Tf.BlockHash=p0,p0.prototype.update=function(r,t){if(r=w4.toArray(r,t),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){var e=(r=this.pending).length%this._delta8;this.pending=r.slice(r.length-e,r.length),this.pending.length===0&&(this.pending=null),r=w4.join32(r,0,r.length-e,this.endian);for(var n=0;n>>24&255,n[s++]=r>>>16&255,n[s++]=r>>>8&255,n[s++]=255&r}else for(n[s++]=255&r,n[s++]=r>>>8&255,n[s++]=r>>>16&255,n[s++]=r>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,i=8;i>>3},ko.g1_256=function(r){return wo(r,17)^wo(r,19)^r>>>10};var pf=ur,Tj=Tf,Lj=ko,tm=pf.rotl32,sc=pf.sum32,Oj=pf.sum32_5,Uj=Lj.ft_1,_A=Tj.BlockHash,Nj=[1518500249,1859775393,2400959708,3395469782];function Oo(){if(!(this instanceof Oo))return new Oo;_A.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pf.inherits(Oo,_A);var Dj=Oo;Oo.blockSize=512,Oo.outSize=160,Oo.hmacStrength=80,Oo.padLength=64,Oo.prototype._update=function(r,t){for(var e=this.W,n=0;n<16;n++)e[n]=r[t+n];for(;nthis.blockSize&&(r=new this.Hash().update(r).digest()),AK(r.length<=this.blockSize);for(var t=r.length;t{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}();var ov,no;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(ov||(ov={})),function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"}(no||(no={}));const R4="0123456789abcdef";class tn{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();el[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),B4>el[n]||console.log.apply(console,e)}debug(...t){this._log(tn.levels.DEBUG,t)}info(...t){this._log(tn.levels.INFO,t)}warn(...t){this._log(tn.levels.WARNING,t)}makeError(t,e,n){if(I4)return this.makeError("censored error",e,{});e||(e=tn.errors.UNKNOWN_ERROR),n||(n={});const s=[];Object.keys(n).forEach(p=>{const m=n[p];try{if(m instanceof Uint8Array){let v="";for(let _=0;_>4],v+=R4[15&m[_]];s.push(p+"=Uint8Array(0x"+v+")")}else s.push(p+"="+JSON.stringify(m))}catch{s.push(p+"="+JSON.stringify(n[p].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const i=t;let c="";switch(e){case no.NUMERIC_FAULT:{c="NUMERIC_FAULT";const p=t;switch(p){case"overflow":case"underflow":case"division-by-zero":c+="-"+p;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result"}break}case no.CALL_EXCEPTION:case no.INSUFFICIENT_FUNDS:case no.MISSING_NEW:case no.NONCE_EXPIRED:case no.REPLACEMENT_UNDERPRICED:case no.TRANSACTION_REPLACED:case no.UNPREDICTABLE_GAS_LIMIT:c=e}c&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=i,l.code=e,Object.keys(n).forEach(function(p){l[p]=n[p]}),l}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,tn.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,s){t||this.throwError(e,n,s)}assertArgument(t,e,n,s){t||this.throwArgumentError(e,n,s)}checkNormalize(t){P4&&this.throwError("platform missing String.prototype.normalize",tn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:P4})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,tn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,tn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,tn.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&t!=null||this.throwError("missing new",tn.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",tn.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&t!=null||this.throwError("missing new",tn.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return nm||(nm=new tn("logger/5.7.0")),nm}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",tn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),k4){if(!t)return;this.globalLogger().throwError("error censorship permanent",tn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}I4=!!t,k4=!!e}static setLogLevel(t){const e=el[t.toLowerCase()];e!=null?B4=e:tn.globalLogger().warn("invalid log level - "+t)}static from(t){return new tn(t)}}tn.errors=no,tn.levels=ov;const im=new tn("bytes/5.7.0");function rl(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return rl(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function C4(r){return typeof r=="number"&&r==r&&r%1==0}function IK(r,t){if(t||(t={}),typeof r=="number"){im.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(255&r),r=parseInt(String(r/256));return e.length===0&&e.push(0),rl(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),function(e){return!!e.toHexString}(r)&&(r=r.toHexString()),function(e,n){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||n&&e.length!==2+2*n)}(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":im.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let s=0;s=256)return!1}return!0}(r)?rl(new Uint8Array(r)):im.throwArgumentError("invalid arrayify value","value",r)}function BK(r){return"0x"+kK.sha256().update(IK(r)).digest("hex")}const TA=new Xt("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),PK="SPL Name Service",T4=new Xt("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),v0=new Xt("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR");new Xt("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF");new Xt("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc");new Xt("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z");new Xt("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi");new Xt("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv");new Xt("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7");const RK=new Xt("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),LA=[new Xt("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new Xt("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new Xt("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new Xt("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new Xt("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new Xt("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new Xt("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u")],CK=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["FeGn77dhg1KXRRFeSwwMiykZnZPw5JXW6naf2aQgZDQf","ETH"],["7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx","GMT"],["AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB","GST"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"]]),TK=new Xt("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),LK=new Xt("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi");new Xt("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz");new Xt("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT");new Xt("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");var L4={},sv=Oh(yA),Zu={};Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.readBigUInt64LE=Zu.readBigInt64LE=void 0;var OK=function(){return new Error("Attempt to access memory outside buffer bounds")},UK=function(r,t,e){return new Error('The "'+r+'" argument must be of type '+t+". Received "+e)},O4=function(r,t,e){return new Error('The value of "'+r+" is out of range. It must be "+t+". Received "+e)};function av(r,t){if(typeof r!="number")throw UK(t,"number",r)}function U4(r,t){throw Math.floor(r)!==r?(av(r,"offset"),O4("offset","an integer",r)):t<0?OK():O4("offset",">= 0 and <= "+t,r)}Zu.readBigInt64LE=function(r,t){t===void 0&&(t=0),av(t,"offset");var e=r[t],n=r[t+7];e!==void 0&&n!==void 0||U4(t,r.length-8);var s=r[t+4]+r[t+5]*Math.pow(2,8)+r[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(s)<0&&m[m.length-1])||A[0]!==6&&A[0]!==2)){_=0;continue}if(A[0]===3&&(!m||A[1]>m[0]&&A[1]0&&p[p.length-1])||x[0]!==6&&x[0]!==2)){v=0;continue}if(x[0]===3&&(!p||x[1]>p[0]&&x[1]{if(typeof m!="string"&&!Array.isArray(m))throw new TypeError("Expected the input to be `string | string[]`");if(v={pascalCase:!1,preserveConsecutiveUppercase:!1,...v},m=Array.isArray(m)?m.map(w=>w.trim()).filter(w=>w.length).join("-"):m.trim(),m.length===0)return"";const _=v.locale===!1?w=>w.toLowerCase():w=>w.toLocaleLowerCase(v.locale),E=v.locale===!1?w=>w.toUpperCase():w=>w.toLocaleUpperCase(v.locale);return m.length===1?v.pascalCase?E(m):_(m):(m!==_(m)&&(m=((w,x,A)=>{let B=!1,P=!1,R=!1;for(let C=0;C(e.lastIndex=0,w.replace(e,A=>x(A))))(m,_):_(m),v.pascalCase&&(m=E(m.charAt(0))+m.slice(1)),((w,x)=>(c.lastIndex=0,l.lastIndex=0,w.replace(c,(A,B)=>x(B)).replace(l,A=>x(A))))(m,E))};return g0.exports=p,g0.exports.default=p,g0.exports}var zr=Yi(uv()),We={},Be={};class Tr{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function Ly(r,t){return t.property?r+"["+t.property+"]":r}Be.Layout=Tr,Be.nameWithProperty=Ly,Be.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Tr))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class ni extends Tr{isCount(){throw new Error("ExternalLayout is abstract")}}class K4 extends ni{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class fv extends ni{constructor(t,e,n){if(!(t instanceof Tr))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Po||this.layout instanceof ds}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Po extends Tr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ni&&this.count.encode(t.length,e,n),i}}class G4 extends Tr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Tr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class Oy{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class Pl extends Oy{constructor(t,e){if(!(t instanceof ni&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class hv extends Tr{constructor(t,e,n){const s=t instanceof Po||t instanceof ds;if(s)t=new Pl(new fv(t));else if(t instanceof ni&&t.isCount())t=new Pl(t);else if(!(t instanceof Oy))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Tr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;e===void 0&&(e=0);const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new OA(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class OA extends Tr{constructor(t,e,n,s){if(!(t instanceof hv))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Tr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Iu(r){return 0>r&&(r+=4294967296),r}class lv extends Tr{constructor(t,e,n){if(!(t instanceof Po||t instanceof ds))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Iu(t&this.valueMask))throw new TypeError(Ly("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Iu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ni&&(s=t.length),!Zt.Buffer.isBuffer(t)||s!==t.length)throw new TypeError(Ly("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof ni&&this.length.encode(s,e,n),s}}class X4 extends Tr{constructor(t){super(-1,t)}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),e[n+i]=0,i+1}}class J4 extends Tr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let s=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),i}}class Q4 extends Tr{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Be.ExternalLayout=ni,Be.GreedyCount=K4,Be.OffsetLayout=fv,Be.UInt=Po,Be.UIntBE=ds,Be.Int=va,Be.IntBE=yu,Be.Float=$4,Be.FloatBE=H4,Be.Double=V4,Be.DoubleBE=Z4,Be.Sequence=W4,Be.Structure=G4,Be.UnionDiscriminator=Oy,Be.UnionLayoutDiscriminator=Pl,Be.Union=hv,Be.VariantLayout=OA,Be.BitStructure=lv,Be.BitField=Bc,Be.Boolean=UA,Be.Blob=Y4,Be.CString=X4,Be.UTF8=J4,Be.Constant=Q4,Be.greedy=(r,t)=>new K4(r,t),Be.offset=(r,t,e)=>new fv(r,t,e),Be.u8=r=>new Po(1,r),Be.u16=r=>new Po(2,r),Be.u24=r=>new Po(3,r),Be.u32=r=>new Po(4,r),Be.u40=r=>new Po(5,r),Be.u48=r=>new Po(6,r),Be.nu64=r=>new zK(r),Be.u16be=r=>new ds(2,r),Be.u24be=r=>new ds(3,r),Be.u32be=r=>new ds(4,r),Be.u40be=r=>new ds(5,r),Be.u48be=r=>new ds(6,r),Be.nu64be=r=>new qK(r),Be.s8=r=>new va(1,r),Be.s16=r=>new va(2,r),Be.s24=r=>new va(3,r),Be.s32=r=>new va(4,r),Be.s40=r=>new va(5,r),Be.s48=r=>new va(6,r),Be.ns64=r=>new FK(r),Be.s16be=r=>new yu(2,r),Be.s24be=r=>new yu(3,r),Be.s32be=r=>new yu(4,r),Be.s40be=r=>new yu(5,r),Be.s48be=r=>new yu(6,r),Be.ns64be=r=>new jK(r),Be.f32=r=>new $4(r),Be.f32be=r=>new H4(r),Be.f64=r=>new V4(r),Be.f64be=r=>new Z4(r),Be.struct=(r,t,e)=>new G4(r,t,e),Be.bits=(r,t,e)=>new lv(r,t,e),Be.seq=(r,t,e)=>new W4(r,t,e),Be.union=(r,t,e)=>new hv(r,t,e),Be.unionLayoutDiscriminator=(r,t)=>new Pl(r,t),Be.blob=(r,t)=>new Y4(r,t),Be.cstr=r=>new X4(r),Be.utf8=(r,t)=>new J4(r,t),Be.const=(r,t)=>new Q4(r,t),function(r){var t=$e&&$e.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=Be,n=sv,s=t(ay);var i=Be;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class c extends e.Layout{constructor(A,B,P){super(A,P),this.blob=(0,e.blob)(A),this.signed=B}decode(A,B=0){const P=new s.default(this.blob.decode(A,B),10,"le");return this.signed?P.fromTwos(8*this.span).clone():P}encode(A,B,P=0){return this.signed&&(A=A.toTwos(8*this.span)),this.blob.encode(A.toArrayLike(Zt.Buffer,"le",this.span),B,P)}}function l(x){return new c(8,!1,x)}r.u64=l,r.i64=function(x){return new c(8,!0,x)},r.u128=function(x){return new c(16,!1,x)},r.i128=function(x){return new c(16,!0,x)},r.u256=function(x){return new c(32,!1,x)},r.i256=function(x){return new c(32,!0,x)};class p extends e.Layout{constructor(A,B,P,R){super(A.span,R),this.layout=A,this.decoder=B,this.encoder=P}decode(A,B){return this.decoder(this.layout.decode(A,B))}encode(A,B,P){return this.layout.encode(this.encoder(A),B,P)}getSpan(A,B){return this.layout.getSpan(A,B)}}r.publicKey=function(x){return new p((0,e.blob)(32),A=>new n.PublicKey(A),A=>A.toBuffer(),x)};class m extends e.Layout{constructor(A,B){super(-1,B),this.layout=A,this.discriminator=(0,e.u8)()}encode(A,B,P=0){return A==null?this.discriminator.encode(0,B,P):(this.discriminator.encode(1,B,P),this.layout.encode(A,B,P+1)+1)}decode(A,B=0){const P=this.discriminator.decode(A,B);if(P===0)return null;if(P===1)return this.layout.decode(A,B+1);throw new Error("Invalid option "+this.property)}getSpan(A,B=0){const P=this.discriminator.decode(A,B);if(P===0)return 1;if(P===1)return this.layout.getSpan(A,B+1)+1;throw new Error("Invalid option "+this.property)}}function v(x){if(x===0)return!1;if(x===1)return!0;throw new Error("Invalid bool: "+x)}function _(x){return x?1:0}function E(x){const A=(0,e.u32)("length"),B=(0,e.struct)([A,(0,e.blob)((0,e.offset)(A,-A.span),"data")]);return new p(B,({data:P})=>P,P=>({data:P}),x)}r.option=function(x,A){return new m(x,A)},r.bool=function(x){return new p((0,e.u8)(),v,_,x)},r.vec=function(x,A){const B=(0,e.u32)("length"),P=(0,e.struct)([B,(0,e.seq)(x,(0,e.offset)(B,-B.span),"values")]);return new p(P,({values:R})=>R,R=>({values:R}),A)},r.tagged=function(x,A,B){const P=(0,e.struct)([l("tag"),A.replicate("data")]);return new p(P,function({tag:R,data:C}){if(!R.eq(x))throw new Error("Invalid tag, expected: "+x.toString("hex")+", got: "+R.toString("hex"));return C},R=>({tag:x,data:R}),B)},r.vecU8=E,r.str=function(x){return new p(E(),A=>A.toString("utf-8"),A=>Zt.Buffer.from(A,"utf-8"),x)},r.rustEnum=function(x,A,B){const P=(0,e.union)(B??(0,e.u8)(),A);return x.forEach((R,C)=>P.addVariant(C,R,R.property)),P},r.array=function(x,A,B){const P=(0,e.struct)([(0,e.seq)(x,A,"values")]);return new p(P,({values:R})=>R,R=>({values:R}),B)};class w extends e.Layout{constructor(A,B,P){super(A.span+B.span,P),this.keyLayout=A,this.valueLayout=B}decode(A,B){return B=B||0,[this.keyLayout.decode(A,B),this.valueLayout.decode(A,B+this.keyLayout.getSpan(A,B))]}encode(A,B,P){P=P||0;const R=this.keyLayout.encode(A[0],B,P);return R+this.valueLayout.encode(A[1],B,P+R)}getSpan(A,B){return this.keyLayout.getSpan(A,B)+this.valueLayout.getSpan(A,B)}}r.map=function(x,A,B){const P=(0,e.u32)("length"),R=(0,e.struct)([P,(0,e.seq)(new w(x,A),(0,e.offset)(P,-P.span),"values")]);return new p(R,({values:C})=>new Map(C),C=>({values:Array.from(C.entries())}),B)}}(We);function Of(r){let t=r.length;for(;--t>=0;)r[t]=0}const KK=30,$K=new Array(576);Of($K);const HK=new Array(60);Of(HK);const VK=new Array(512);Of(VK);const ZK=new Array(256);Of(ZK);const WK=new Array(29);Of(WK);const GK=new Array(KK);Of(GK);var dv=(r,t,e,n)=>{let s=65535&r|0,i=r>>>16&65535|0,c=0;for(;e!==0;){c=e>2e3?2e3:e,e-=c;do s=s+t[n++]|0,i=i+s|0;while(--c);s%=65521,i%=65521}return s|i<<16|0};const YK=new Uint32Array((()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t})());var xo=(r,t,e,n)=>{const s=YK,i=n+e;r^=-1;for(let c=n;c>>8^s[255&(r^t[c])];return-1^r},pv={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Uy={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const XK=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var NA={assign:function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)XK(e,n)&&(r[n]=e[n])}}return r},flattenChunks:r=>{let t=0;for(let n=0,s=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;sh[254]=sh[254]=1;var mv={string2buf:r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,c=r.length,l=0;for(s=0;s>>6,t[i++]=128|63&e):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|63&e):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|63&e);return t},buf2string:(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(2*e);for(s=0,n=0;n4)i[s++]=65533,n+=l-1;else{for(c&=l===2?31:l===3?15:7;l>1&&n1?i[s++]=65533:c<65536?i[s++]=c:(c-=65536,i[s++]=55296|c>>10&1023,i[s++]=56320|1023&c)}}return((c,l)=>{if(l<65534&&c.subarray&&DA)return String.fromCharCode.apply(null,c.length===l?c:c.subarray(0,l));let p="";for(let m=0;m{(t=t||r.length)>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(192&r[e])==128;)e--;return e<0||e===0?t:e+sh[r[e]]>t?e:t}},JK=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const y0=16209;var QK=function(r,t){let e,n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R,C,O,z,H,tt,nt,G;const M=r.state;e=r.next_in,nt=r.input,n=e+(r.avail_in-5),s=r.next_out,G=r.output,i=s-(t-r.avail_out),c=s+(r.avail_out-257),l=M.dmax,p=M.wsize,m=M.whave,v=M.wnext,_=M.window,E=M.hold,w=M.bits,x=M.lencode,A=M.distcode,B=(1<>>24,E>>>=C,w-=C,C=R>>>16&255,C===0)G[s++]=65535&R;else{if(!(16&C)){if(!(64&C)){R=x[(65535&R)+(E&(1<>>=C,w-=C),w<15&&(E+=nt[e++]<>>24,E>>>=C,w-=C,C=R>>>16&255,!(16&C)){if(!(64&C)){R=A[(65535&R)+(E&(1<l){r.msg="invalid distance too far back",M.mode=y0;break t}if(E>>>=C,w-=C,C=s-i,z>C){if(C=z-C,C>m&&M.sane){r.msg="invalid distance too far back",M.mode=y0;break t}if(H=0,tt=_,v===0){if(H+=p-C,C2;)G[s++]=tt[H++],G[s++]=tt[H++],G[s++]=tt[H++],O-=3;O&&(G[s++]=tt[H++],O>1&&(G[s++]=tt[H++]))}else{H=s-z;do G[s++]=G[H++],G[s++]=G[H++],G[s++]=G[H++],O-=3;while(O>2);O&&(G[s++]=G[H++],O>1&&(G[s++]=G[H++]))}break}}break}}while(e>3,e-=O,w-=O<<3,E&=(1<{const p=l.bits;let m,v,_,E,w,x,A=0,B=0,P=0,R=0,C=0,O=0,z=0,H=0,tt=0,nt=0,G=null;const M=new Uint16Array(16),d=new Uint16Array(16);let o,a,f,h=null;for(A=0;A<=b0;A++)M[A]=0;for(B=0;B=1&&M[R]===0;R--);if(C>R&&(C=R),R===0)return s[i++]=20971520,s[i++]=20971520,l.bits=1,0;for(P=1;P0&&(r===0||R!==1))return-1;for(d[1]=0,A=1;A852||r===2&&tt>592)return 1;for(;;){o=A-z,c[B]+1=x?(a=h[c[B]-x],f=G[c[B]-x]):(a=96,f=0),m=1<>z)+v]=o<<24|a<<16|f|0;while(v!==0);for(m=1<>=1;if(m!==0?(nt&=m-1,nt+=m):nt=0,B++,--M[A]==0){if(A===R)break;A=t[e+c[B]]}if(A>C&&(nt&E)!==_){for(z===0&&(z=C),w+=P,O=A-z,H=1<852||r===2&&tt>592)return 1;_=nt&E,s[_]=C<<24|O<<16|w-i|0}}return nt!==0&&(s[w+nt]=A-z<<24|64<<16|0),l.bits=C,0};const{Z_FINISH:t8,Z_BLOCK:i$,Z_TREES:w0,Z_OK:ru,Z_STREAM_END:o$,Z_NEED_DICT:s$,Z_STREAM_ERROR:Vi,Z_DATA_ERROR:zA,Z_MEM_ERROR:qA,Z_BUF_ERROR:a$,Z_DEFLATED:e8}=Uy,Pd=16180,Rl=16190,ns=16191,om=16192,sm=16194,x0=16199,_0=16200,am=16206,jr=16209,r8=r=>(r>>>24&255)+(r>>>8&65280)+((65280&r)<<8)+((255&r)<<24);function u$(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const hu=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode16211?1:0},FA=r=>{if(hu(r))return Vi;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=1&t.wrap),t.mode=Pd,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,ru},jA=r=>{if(hu(r))return Vi;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,FA(r)},KA=(r,t)=>{let e;if(hu(r))return Vi;const n=r.state;return t<0?(e=0,t=-t):(e=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Vi:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,jA(r))},n8=(r,t)=>{if(!r)return Vi;const e=new u$;r.state=e,e.strm=r,e.window=null,e.mode=Pd;const n=KA(r,t);return n!==ru&&(r.state=null),n};let um,fm,i8=!0;const f$=r=>{if(i8){um=new Int32Array(512),fm=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Pc(1,r.lens,0,288,um,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Pc(2,r.lens,0,32,fm,0,r.work,{bits:5}),i8=!1}r.lencode=um,r.lenbits=9,r.distcode=fm,r.distbits=5},$A=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),(n-=s)?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave{let e,n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R,C,O,z,H,tt,nt=0;const G=new Uint8Array(4);let M,d;const o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(hu(r)||!r.output||!r.input&&r.avail_in!==0)return Vi;e=r.state,e.mode===ns&&(e.mode=om),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,_=l,E=p,tt=ru;t:for(;;)switch(e.mode){case Pd:if(e.wrap===0){e.mode=om;break}for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xo(e.check,G,2,0),m=0,v=0,e.mode=16181;break}if(e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&m)<<8)+(m>>8))%31){r.msg="incorrect header check",e.mode=jr;break}if((15&m)!==e8){r.msg="unknown compression method",e.mode=jr;break}if(m>>>=4,v-=4,H=8+(15&m),e.wbits===0&&(e.wbits=H),H>15||H>e.wbits){r.msg="invalid window size",e.mode=jr;break}e.dmax=1<>8&1),512&e.flags&&4&e.wrap&&(G[0]=255&m,G[1]=m>>>8&255,e.check=xo(e.check,G,2,0)),m=0,v=0,e.mode=16182;case 16182:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>8&255,G[2]=m>>>16&255,G[3]=m>>>24&255,e.check=xo(e.check,G,4,0)),m=0,v=0,e.mode=16183;case 16183:for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>8),512&e.flags&&4&e.wrap&&(G[0]=255&m,G[1]=m>>>8&255,e.check=xo(e.check,G,2,0)),m=0,v=0,e.mode=16184;case 16184:if(1024&e.flags){for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xo(e.check,G,2,0)),m=0,v=0}else e.head&&(e.head.extra=null);e.mode=16185;case 16185:if(1024&e.flags&&(w=e.length,w>l&&(w=l),w&&(e.head&&(H=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+w),H)),512&e.flags&&4&e.wrap&&(e.check=xo(e.check,n,w,i)),l-=w,i+=w,e.length-=w),e.length))break t;e.length=0,e.mode=16186;case 16186:if(2048&e.flags){if(l===0)break t;w=0;do H=n[i+w++],e.head&&H&&e.length<65536&&(e.head.name+=String.fromCharCode(H));while(H&&w>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=ns;break;case 16189:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>=7&v,v-=7&v,e.mode=am;break}for(;v<3;){if(l===0)break t;l--,m+=n[i++]<>>=1,v-=1,3&m){case 0:e.mode=16193;break;case 1:if(f$(e),e.mode=x0,t===w0){m>>>=2,v-=2;break t}break;case 2:e.mode=16196;break;case 3:r.msg="invalid block type",e.mode=jr}m>>>=2,v-=2;break;case 16193:for(m>>>=7&v,v-=7&v;v<32;){if(l===0)break t;l--,m+=n[i++]<>>16^65535)){r.msg="invalid stored block lengths",e.mode=jr;break}if(e.length=65535&m,m=0,v=0,e.mode=sm,t===w0)break t;case sm:e.mode=16195;case 16195:if(w=e.length,w){if(w>l&&(w=l),w>p&&(w=p),w===0)break t;s.set(n.subarray(i,i+w),c),l-=w,i+=w,p-=w,c+=w,e.length-=w;break}e.mode=ns;break;case 16196:for(;v<14;){if(l===0)break t;l--,m+=n[i++]<>>=5,v-=5,e.ndist=1+(31&m),m>>>=5,v-=5,e.ncode=4+(15&m),m>>>=4,v-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=jr;break}e.have=0,e.mode=16197;case 16197:for(;e.have>>=3,v-=3}for(;e.have<19;)e.lens[o[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,M={bits:e.lenbits},tt=Pc(0,e.lens,0,19,e.lencode,0,e.work,M),e.lenbits=M.bits,tt){r.msg="invalid code lengths set",e.mode=jr;break}e.have=0,e.mode=16198;case 16198:for(;e.have>>24,P=nt>>>16&255,R=65535&nt,!(B<=v);){if(l===0)break t;l--,m+=n[i++]<>>=B,v-=B,e.lens[e.have++]=R;else{if(R===16){for(d=B+2;v>>=B,v-=B,e.have===0){r.msg="invalid bit length repeat",e.mode=jr;break}H=e.lens[e.have-1],w=3+(3&m),m>>>=2,v-=2}else if(R===17){for(d=B+3;v>>=B,v-=B,H=0,w=3+(7&m),m>>>=3,v-=3}else{for(d=B+7;v>>=B,v-=B,H=0,w=11+(127&m),m>>>=7,v-=7}if(e.have+w>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=jr;break}for(;w--;)e.lens[e.have++]=H}}if(e.mode===jr)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=jr;break}if(e.lenbits=9,M={bits:e.lenbits},tt=Pc(1,e.lens,0,e.nlen,e.lencode,0,e.work,M),e.lenbits=M.bits,tt){r.msg="invalid literal/lengths set",e.mode=jr;break}if(e.distbits=6,e.distcode=e.distdyn,M={bits:e.distbits},tt=Pc(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,M),e.distbits=M.bits,tt){r.msg="invalid distances set",e.mode=jr;break}if(e.mode=x0,t===w0)break t;case x0:e.mode=_0;case _0:if(l>=6&&p>=258){r.next_out=c,r.avail_out=p,r.next_in=i,r.avail_in=l,e.hold=m,e.bits=v,QK(r,E),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,e.mode===ns&&(e.back=-1);break}for(e.back=0;nt=e.lencode[m&(1<>>24,P=nt>>>16&255,R=65535&nt,!(B<=v);){if(l===0)break t;l--,m+=n[i++]<>C)],B=nt>>>24,P=nt>>>16&255,R=65535&nt,!(C+B<=v);){if(l===0)break t;l--,m+=n[i++]<>>=C,v-=C,e.back+=C}if(m>>>=B,v-=B,e.back+=B,e.length=R,P===0){e.mode=16205;break}if(32&P){e.back=-1,e.mode=ns;break}if(64&P){r.msg="invalid literal/length code",e.mode=jr;break}e.extra=15&P,e.mode=16201;case 16201:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=16202;case 16202:for(;nt=e.distcode[m&(1<>>24,P=nt>>>16&255,R=65535&nt,!(B<=v);){if(l===0)break t;l--,m+=n[i++]<>C)],B=nt>>>24,P=nt>>>16&255,R=65535&nt,!(C+B<=v);){if(l===0)break t;l--,m+=n[i++]<>>=C,v-=C,e.back+=C}if(m>>>=B,v-=B,e.back+=B,64&P){r.msg="invalid distance code",e.mode=jr;break}e.offset=R,e.extra=15&P,e.mode=16203;case 16203:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=jr;break}e.mode=16204;case 16204:if(p===0)break t;if(w=E-p,e.offset>w){if(w=e.offset-w,w>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=jr;break}w>e.wnext?(w-=e.wnext,x=e.wsize-w):x=e.wnext-w,w>e.length&&(w=e.length),A=e.window}else A=s,x=c-e.offset,w=e.length;w>p&&(w=p),p-=w,e.length-=w;do s[c++]=A[x++];while(--w);e.length===0&&(e.mode=_0);break;case 16205:if(p===0)break t;s[c++]=e.length,p--,e.mode=_0;break;case am:if(e.wrap){for(;v<32;){if(l===0)break t;l--,m|=n[i++]<{if(hu(r))return Vi;let t=r.state;return t.window&&(t.window=null),r.state=null,ru},l$=(r,t)=>{if(hu(r))return Vi;const e=r.state;return 2&e.wrap?(e.head=t,t.done=!1,ru):Vi},d$=(r,t)=>{const e=t.length;let n,s,i;return hu(r)?Vi:(n=r.state,n.wrap!==0&&n.mode!==Rl?Vi:n.mode===Rl&&(s=1,s=dv(s,t,e,0),s!==n.check)?zA:(i=$A(r,t,e,e),i?(n.mode=16210,qA):(n.havedict=1,ru)))},ps={inflateReset:jA,inflateReset2:KA,inflateResetKeep:FA,inflateInit:r=>n8(r,15),inflateInit2:n8,inflate:c$,inflateEnd:h$,inflateGetHeader:l$,inflateSetDictionary:d$,inflateInfo:"pako inflate (from Nodeca project)"},p$=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const HA=Object.prototype.toString,{Z_NO_FLUSH:m$,Z_FINISH:v$,Z_OK:Rc,Z_STREAM_END:cm,Z_NEED_DICT:hm,Z_STREAM_ERROR:g$,Z_DATA_ERROR:o8,Z_MEM_ERROR:y$}=Uy;function Cc(r){this.options=NA.assign({chunkSize:65536,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||r&&r.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new JK,this.strm.avail_out=0;let e=ps.inflateInit2(this.strm,t.windowBits);if(e!==Rc)throw new Error(pv[e]);if(this.header=new p$,ps.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=mv.string2buf(t.dictionary):HA.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ps.inflateSetDictionary(this.strm,t.dictionary),e!==Rc)))throw new Error(pv[e])}function lm(r,t){const e=new Cc(t);if(e.push(r),e.err)throw e.msg||pv[e.err];return e.result}Cc.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,c,l;if(this.ended)return!1;for(c=t===~~t?t:t===!0?v$:m$,HA.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ps.inflate(e,c),i===hm&&s&&(i=ps.inflateSetDictionary(e,s),i===Rc?i=ps.inflate(e,c):i===o8&&(i=hm));e.avail_in>0&&i===cm&&e.state.wrap>0&&r[e.next_in]!==0;)ps.inflateReset(e),i=ps.inflate(e,c);switch(i){case g$:case o8:case hm:case y$:return this.onEnd(i),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||i===cm))if(this.options.to==="string"){let p=mv.utf8border(e.output,e.next_out),m=e.next_out-p,v=mv.buf2string(e.output,p);e.next_out=m,e.avail_out=n-m,m&&e.output.set(e.output.subarray(p,p+m),0),this.onData(v)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(i!==Rc||l!==0){if(i===cm)return i=ps.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},Cc.prototype.onData=function(r){this.chunks.push(r)},Cc.prototype.onEnd=function(r){r===Rc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=NA.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var b$={Inflate:Cc,inflate:lm,inflateRaw:function(r,t){return(t=t||{}).raw=!0,lm(r,t)},ungzip:lm,constants:Uy};const{Inflate:lG,inflate:w$,inflateRaw:dG,ungzip:pG}=b$;var x$=w$,_$=Yi(_y());const cc=r=>"version"in r;var M$=Object.freeze({__proto__:null,encode:function(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")},decode:function(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2==1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?Ae.Buffer.from([]):Ae.Buffer.from(t.map(e=>parseInt(e,16)))}});function VA(r){return new TextDecoder("utf-8").decode(r)}function ZA(r){return new TextEncoder().encode(r)}var E$=Object.freeze({__proto__:null,decode:VA,encode:ZA});function vv(r){return Wu.encode(r)}var A$=Object.freeze({__proto__:null,encode:vv,decode:function(r){return Wu.decode(r)}});function WA(r){return Ae.Buffer.from(YM(r))}var S$=Object.freeze({__proto__:null,encode:function(r){return U2(r)},decode:WA}),k$=Object.freeze({__proto__:null,hex:M$,utf8:E$,bs58:A$,base64:S$});function GA(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function YA(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function Ny(r,t={}){r.forEach(e=>{if("accounts"in e)Ny(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function ai(r){return r instanceof Xt?r:new Xt(r)}class I$ extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function Gu(r){return typeof r=="object"&&r!=null}function ia(r){return typeof r=="string"?JSON.stringify(r):""+r}function B$(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+ia(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*s8(r,t,e,n){(function(s){return Gu(s)&&typeof s[Symbol.iterator]=="function"})(r)||(r=[r]);for(const s of r){const i=B$(s,t,e,n);i&&(yield i)}}function*Dy(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&Gu(t.schema)&&Gu(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=Dy(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):Gu(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class ua{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,m)=>s8(s(p,m),m,this,p):()=>[],this.refiner=i?(p,m)=>s8(i(p,m),m,this,p):()=>[]}assert(t){return function(e,n){const s=Tc(e,n);if(s[0])throw s[0]}(t,this)}create(t){return zy(t,this)}is(t){return XA(t,this)}mask(t){return function(e,n){const s=Tc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e){return e===void 0&&(e={}),Tc(t,this,e)}}function zy(r,t){const e=Tc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function XA(r,t){return!Tc(r,t)[0]}function Tc(r,t,e){e===void 0&&(e={});const n=Dy(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new I$(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function Fh(r,t){return new ua({type:r,schema:null,validator:t})}function dm(r){return new ua({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+ia(t)})}function a8(r){const t=ia(r),e=typeof r;return new ua({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+ia(n)})}function M0(r){return new ua({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function E0(){return Fh("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ia(r))}function nl(r){return new ua({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Na(){return Fh("string",r=>typeof r=="string"||"Expected a string, but received: "+ia(r))}function Ks(r){const t=Object.keys(r);return new ua({type:"type",schema:r,*entries(e){if(Gu(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>Gu(e)||"Expected an object, but received: "+ia(e)})}function JA(r){const t=r.map(e=>e.type).join(" | ");return new ua({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[c]=i.validate(e,{coerce:!0});return!c})||qy()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...c]=Dy(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ia(e),...s]}})}function qy(){return Fh("unknown",()=>!0)}const u8=99;async function gv(r,t,e){if(t.length<=u8)return await f8(r,t,e);{const n=function(s,i){return Array.apply(0,new Array(Math.ceil(s.length/i))).map((c,l)=>s.slice(l*i,(l+1)*i))}(t,u8);return(await Promise.all(n.map(s=>f8(r,s,e)))).flat()}}async function f8(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((c,l)=>c===null?null:{publicKey:t[l],account:c,context:i})}async function QA(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const c=t._compile(),l=c.serialize(),p=t._serialize(l).toString("base64"),m={encoding:"base64",commitment:n??r.commitment};if(s){const E=(Array.isArray(s)?s:c.nonProgramIds()).map(w=>w.toBase58());m.accounts={encoding:"base64",addresses:E}}e&&(m.sigVerify=!0);const v=[p,m],_=zy(await r._rpcRequest("simulateTransaction",v),C$);if("error"in _){let E;if("data"in _.error&&(E=(i=_.error.data)===null||i===void 0?void 0:i.logs,E&&Array.isArray(E))){const w=` + `,x=w+E.join(w);console.error(_.error.message,x)}throw new Ku("failed to simulate transaction: "+_.error.message,E)}return _.result}function P$(r){return function(t,e,n){return new ua({...t,coercer:(s,i)=>XA(s,e)?t.coercer(n(s,i),i):t.coercer(s,i)})}(tS(r),R$,t=>"error"in t?t:{...t,result:zy(t.result,r)})}const R$=tS(qy());function tS(r){return JA([Ks({jsonrpc:a8("2.0"),id:Na(),result:r}),Ks({jsonrpc:a8("2.0"),id:Na(),error:Ks({code:qy(),message:Na(),data:nl(Fh("any",()=>!0))})})])}const C$=(c8=Ks({err:M0(JA([Ks({}),Na()])),logs:M0(dm(Na())),accounts:nl(M0(dm(M0(Ks({executable:Fh("boolean",r=>typeof r=="boolean"),owner:Na(),lamports:E0(),data:dm(Na()),rentEpoch:nl(E0())}))))),unitsConsumed:nl(E0())}),P$(Ks({context:Ks({slot:E0()}),value:c8})));var c8,T$=Object.freeze({__proto__:null,invoke:async function(r,t,e,n){r=ai(r),n||(n=ah());const s=new wr;if(s.add(new Ir({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])},getMultipleAccounts:async function(r,t,e){return(await gv(r,t,e)).map(n=>n?{publicKey:n.publicKey,account:n.account}:null)},getMultipleAccountsAndContext:gv,simulateTransaction:QA});class eS{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,c,l;if(n===void 0&&(n=this.opts),cc(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const m of e)t.partialSign(m);const p=(t=await this.wallet.signTransaction(t)).serialize();try{return await h8(this.connection,p,n)}catch(m){if(m instanceof yv){const v=vv(cc(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(c=t.signature)!==null&&c!==void 0?c:new Uint8Array),_=await this.connection.getTransaction(v,{commitment:"confirmed"});if(_){const E=(l=_.meta)===null||l===void 0?void 0:l.logMessages;throw E?new Ku(m.message,E):m}throw m}throw m}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const c=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let l=t.map(v=>{var _,E;if(cc(v.tx)){let w=v.tx;return v.signers&&w.sign(v.signers),w}{let w=v.tx,x=(_=v.signers)!==null&&_!==void 0?_:[];return w.feePayer=(E=w.feePayer)!==null&&E!==void 0?E:this.wallet.publicKey,w.recentBlockhash=c,x.forEach(A=>{w.partialSign(A)}),w}});const p=await this.wallet.signAllTransactions(l),m=[];for(let v=0;vm.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+11)return null;s=l[0].match(/([0-9]+)/g)[0]}try{i=parseInt(s)}catch{return null}let c=e.get(i);return c!==void 0?new fh(i,c,t.logs):(c=nS.get(i),c!==void 0?new fh(i,c,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function jy(r,t){Fy("debug-logs")&&console.log("Translating error:",r);const e=Yu.parse(r.logs);if(e)return e;const n=fh.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,c){return c==="programErrorStack"?i.programErrorStack.stack:c==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=Uf.parse(r.logs),new Proxy(r,s)}return r}const qe={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},nS=new Map([[qe.InstructionMissing,"8 byte instruction identifier not provided"],[qe.InstructionFallbackNotFound,"Fallback functions are not supported"],[qe.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[qe.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[qe.IdlInstructionStub,"The program was compiled without idl instructions"],[qe.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[qe.ConstraintMut,"A mut constraint was violated"],[qe.ConstraintHasOne,"A has one constraint was violated"],[qe.ConstraintSigner,"A signer constraint was violated"],[qe.ConstraintRaw,"A raw constraint was violated"],[qe.ConstraintOwner,"An owner constraint was violated"],[qe.ConstraintRentExempt,"A rent exemption constraint was violated"],[qe.ConstraintSeeds,"A seeds constraint was violated"],[qe.ConstraintExecutable,"An executable constraint was violated"],[qe.ConstraintState,"Deprecated Error, feel free to replace with something else"],[qe.ConstraintAssociated,"An associated constraint was violated"],[qe.ConstraintAssociatedInit,"An associated init constraint was violated"],[qe.ConstraintClose,"A close constraint was violated"],[qe.ConstraintAddress,"An address constraint was violated"],[qe.ConstraintZero,"Expected zero account discriminant"],[qe.ConstraintTokenMint,"A token mint constraint was violated"],[qe.ConstraintTokenOwner,"A token owner constraint was violated"],[qe.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[qe.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[qe.ConstraintMintDecimals,"A mint decimals constraint was violated"],[qe.ConstraintSpace,"A space constraint was violated"],[qe.ConstraintAccountIsNone,"A required account for the constraint is None"],[qe.RequireViolated,"A require expression was violated"],[qe.RequireEqViolated,"A require_eq expression was violated"],[qe.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[qe.RequireNeqViolated,"A require_neq expression was violated"],[qe.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[qe.RequireGtViolated,"A require_gt expression was violated"],[qe.RequireGteViolated,"A require_gte expression was violated"],[qe.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[qe.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[qe.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[qe.AccountDidNotDeserialize,"Failed to deserialize the account"],[qe.AccountDidNotSerialize,"Failed to serialize the account"],[qe.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[qe.AccountNotMutable,"The given account is not mutable"],[qe.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[qe.InvalidProgramId,"Program ID was not as expected"],[qe.InvalidProgramExecutable,"Program account is not executable"],[qe.AccountNotSigner,"The given account did not sign"],[qe.AccountNotSystemOwned,"The given account is not owned by the system program"],[qe.AccountNotInitialized,"The program expected this account to be already initialized"],[qe.AccountNotProgramData,"The given account is not a program data account"],[qe.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[qe.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[qe.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[qe.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[qe.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[qe.Deprecated,"The API being used is deprecated and should no longer be used"]]);var wv=function(){return wv=Object.assign||function(r){for(var t,e=1,n=arguments.length;ec.name===s);if(i.length!==1)throw new uh(`Type not found: ${JSON.stringify(t)}`);return Mi.typeDefLayout(i[0],e,n)}if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],c=Mi.fieldLayout({name:void 0,type:s},e);return We.array(c,i,n)}throw new Error(`Not yet implemented: ${t}`)}}static typeDefLayout(t,e=[],n){if(t.type.kind==="struct"){const s=t.type.fields.map(i=>Mi.fieldLayout(i,e));return We.struct(s,n)}if(t.type.kind==="enum"){let s=t.type.variants.map(i=>{const c=zr(i.name);if(i.fields===void 0)return We.struct([],c);const l=i.fields.map((p,m)=>p.hasOwnProperty("name")?Mi.fieldLayout(p,e):Mi.fieldLayout({type:p,name:m.toString()},e));return We.struct(l,c)});return n!==void 0?We.rustEnum(s).replicate(n):We.rustEnum(s,n)}throw new Error(`Unknown type kint: ${t}`)}}const d8="global";class Rd{constructor(t){this.idl=t,this.ixLayout=Rd.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=p8(d8,n.name);e.set(Wu.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(d8,t,e)}_encode(t,e,n){const s=Ae.Buffer.alloc(1e3),i=zr(e),c=this.ixLayout.get(i);if(!c)throw new Error(`Unknown method: ${i}`);const l=c.encode(n,s),p=s.slice(0,l);return Ae.Buffer.concat([p8(t,e),p])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(c=>{var l,p;return Mi.fieldLayout(c,Array.from([...(l=t.accounts)!==null&&l!==void 0?l:[],...(p=t.types)!==null&&p!==void 0?p:[]]))});const i=zr(n.name);return[i,We.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?Ae.Buffer.from(t,"hex"):Wu.decode(t));let n=Wu.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return fs.format(t,e,this.idl)}}class fs{static format(t,e,n){const s=n.instructions.filter(l=>t.name===l.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(l=>({name:l.name,type:fs.formatIdlType(l.type),data:fs.formatIdlData(l,t.data[l.name],n.types)})),c=fs.flattenIdlAccounts(s.accounts);return{args:i,accounts:e.map((l,p)=>p`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return fs.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){if(t.type.kind==="struct"){const s=t.type;return"{ "+Object.keys(e).map(c=>{const l=s.fields.filter(p=>p.name===c)[0];if(l===void 0)throw new Error("Unable to find type");return c+": "+fs.formatIdlData(l,e[c],n)}).join(", ")+" }"}if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],c=e[i],l=Object.keys(c).map(m=>{var v;const _=c[m],E=(v=s[i])===null||v===void 0?void 0:v.filter(w=>w.name===m)[0];if(E===void 0)throw new Error("Unable to find variant");return m+": "+fs.formatIdlData(E,_,n)}).join(", "),p=zr(i,{pascalCase:!0});return l.length===0?p:`${p} { ${l} }`}return"Tuple formatting not yet implemented"}static flattenIdlAccounts(t,e){return t.map(n=>{const s=function(i){const c=i.replace(/([A-Z])/g," $1");return c.charAt(0).toUpperCase()+c.slice(1)}(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return fs.flattenIdlAccounts(n.accounts,i)}return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function p8(r,t){var e;let n=`${r}:${e===void 0&&(e={}),q$(t,wv({delimiter:"_"},e))}`;return Ae.Buffer.from(tu(n).slice(0,8))}function Ky(r,t){if(t.type.kind==="enum"){const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>Lc(r,typeof s=="object"&&"name"in s?s.type:s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}return t.type.fields.map(e=>Lc(r,e.type)).reduce((e,n)=>e+n,0)}function Lc(r,t){var e,n;switch(t){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+Lc(r,t.option);if("coption"in t)return 4+Lc(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(i=>i.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new uh(`Type not found: ${JSON.stringify(t)}`);return Ky(r,s[0])}if("array"in t){let s=t.array[0],i=t.array[1];return Lc(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const Cl=8;function iS(r){return Zt.Buffer.from(tu(r).slice(0,Cl))}class Da{constructor(t){if(t.accounts===void 0)return void(this.accountLayouts=new Map);const e=t.accounts.map(n=>[n.name,Mi.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=Ae.Buffer.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let c=n.slice(0,i),l=Da.accountDiscriminator(t);return Ae.Buffer.concat([l,c])}decode(t,e){if(Da.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>Da.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Cl),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=Da.accountDiscriminator(t);return{offset:0,bytes:Wu.encode(e?Ae.Buffer.concat([n,e]):n)}}size(t){var e;return Cl+((e=Ky(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){return iS(`account:${zr(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class oS{constructor(t){if(t.events===void 0)return void(this.layouts=new Map);const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,Mi.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[U2(sS(n.name)),n.name]))}decode(t){let e;try{e=Ae.Buffer.from(YM(t))}catch{return null}const n=U2(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function sS(r){return iS(`event:${r}`)}class F${constructor(t){if(t.types===void 0)return void(this.typeLayouts=new Map);const e=t.types.map(n=>[n.name,Mi.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=Ae.Buffer.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class $y{constructor(t){this.instruction=new Rd(t),this.accounts=new Da(t),this.events=new oS(t),this.types=new F$(t)}}var j$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Zt.global<"u"?Zt.global:typeof self<"u"?self:{};function K$(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class li{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var Cd=li;class za extends li{isCount(){throw new Error("ExternalLayout is abstract")}}class aS extends za{constructor(t,e,n){if(!(t instanceof li))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Td||this.layout instanceof uS}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Td extends li{constructor(t,e){if(super(t,e),6i&&c instanceof li,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class hS{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class m8 extends hS{constructor(t,e){if(!(t instanceof za&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class lS extends li{constructor(t,e,n){const s=t instanceof Td||t instanceof uS;if(s)t=new m8(new aS(t));else if(t instanceof za&&t.isCount())t=new m8(t);else if(!(t instanceof hS))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof li))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;e===void 0&&(e=0);const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new Z$(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Z$ extends li{constructor(t,e,n,s){if(!(t instanceof lS))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof li))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class W$ extends li{constructor(t,e){if(!(t instanceof za&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof za||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof za&&(s=t.length),!Zt.Buffer.isBuffer(t)||s!==t.length)throw new TypeError(function(i,c){return c.property?i+"["+c.property+"]":i}("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof za&&this.length.encode(s,e,n),s}}var G$=(r,t,e)=>new aS(r,t,e),_s=r=>new Td(4,r),is=r=>new H$(r),dn=(r,t,e)=>new V$(r,t,e),dS=(r,t,e)=>new lS(r,t,e),jh=(r,t)=>new W$(r,t);class Y${constructor(t){}encode(t,e){switch(zr(t)){case"createAccount":return function({lamports:n,space:s,owner:i}){return Ri({createAccount:{lamports:n,space:s,owner:i.toBuffer()}})}(e);case"assign":return function({owner:n}){return Ri({assign:{owner:n.toBuffer()}})}(e);case"transfer":return function({lamports:n}){return Ri({transfer:{lamports:n}})}(e);case"createAccountWithSeed":return function({base:n,seed:s,lamports:i,space:c,owner:l}){return Ri({createAccountWithSeed:{base:n.toBuffer(),seed:s,lamports:i,space:c,owner:l.toBuffer()}},wn.getVariant(3).span+s.length)}(e);case"advanceNonceAccount":return function({authorized:n}){return Ri({advanceNonceAccount:{authorized:n.toBuffer()}})}(e);case"withdrawNonceAccount":return function({lamports:n}){return Ri({withdrawNonceAccount:{lamports:n}})}(e);case"initializeNonceAccount":return function({authorized:n}){return Ri({initializeNonceAccount:{authorized:n.toBuffer()}})}(e);case"authorizeNonceAccount":return function({authorized:n}){return Ri({authorizeNonceAccount:{authorized:n.toBuffer()}})}(e);case"allocate":return function({space:n}){return Ri({allocate:{space:n}})}(e);case"allocateWithSeed":return function({base:n,seed:s,space:i,owner:c}){return Ri({allocateWithSeed:{base:n.toBuffer(),seed:s,space:i,owner:c.toBuffer()}},wn.getVariant(9).span+s.length)}(e);case"assignWithSeed":return function({base:n,seed:s,owner:i}){return Ri({assignWithSeed:{base:n.toBuffer(),seed:s,owner:i.toBuffer()}},wn.getVariant(10).span+s.length)}(e);case"transferWithSeed":return function({lamports:n,seed:s,owner:i}){return Ri({transferWithSeed:{lamports:n,seed:s,owner:i.toBuffer()}},wn.getVariant(11).span+s.length)}(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class X$ extends Cd{constructor(t){super(-1,t),this.property=t,this.layout=dn([_s("length"),_s("lengthPadding"),jh(G$(_s(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Zt.Buffer.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return _s().span+_s().span+new Jc(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function A0(r){return new X$(r)}function Pi(r){return jh(32,r)}const wn=dS(_s("instruction"));function Ri(r,t){const e=Zt.Buffer.alloc(t??J$),n=wn.encode(r,e);return t===void 0?e.slice(0,n):e}wn.addVariant(0,dn([is("lamports"),is("space"),Pi("owner")]),"createAccount"),wn.addVariant(1,dn([Pi("owner")]),"assign"),wn.addVariant(2,dn([is("lamports")]),"transfer"),wn.addVariant(3,dn([Pi("base"),A0("seed"),is("lamports"),is("space"),Pi("owner")]),"createAccountWithSeed"),wn.addVariant(4,dn([Pi("authorized")]),"advanceNonceAccount"),wn.addVariant(5,dn([is("lamports")]),"withdrawNonceAccount"),wn.addVariant(6,dn([Pi("authorized")]),"initializeNonceAccount"),wn.addVariant(7,dn([Pi("authorized")]),"authorizeNonceAccount"),wn.addVariant(8,dn([is("space")]),"allocate"),wn.addVariant(9,dn([Pi("base"),A0("seed"),is("space"),Pi("owner")]),"allocateWithSeed"),wn.addVariant(10,dn([Pi("base"),A0("seed"),Pi("owner")]),"assignWithSeed"),wn.addVariant(11,dn([is("lamports"),A0("seed"),Pi("owner")]),"transferWithSeed");const J$=Math.max(...Object.values(wn.registry).map(r=>r.span));class Q${constructor(t){this.idl=t}async encode(t,e){if(t==="nonce"){const n=Zt.Buffer.alloc(rh),s=g8.encode(e,n);return n.slice(0,s)}throw new Error(`Invalid account name: ${t}`)}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){if(t==="nonce")return function(n){return g8.decode(n)}(e);throw new Error(`Invalid account name: ${t}`)}memcmp(t,e){if(t==="nonce")return{dataSize:rh};throw new Error(`Invalid account name: ${t}`)}size(t){var e;return(e=Ky(this.idl,t))!==null&&e!==void 0?e:0}}class tH extends Cd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function v8(r){return new tH(jh(32),t=>new Xt(t),t=>t.toBuffer(),r)}const g8=dn([_s("version"),_s("state"),v8("authorizedPubkey"),v8("nonce"),dn([(y8="lamportsPerSignature",new $$(y8))],"feeCalculator")]);var y8;class eH{constructor(t){}decode(t){throw new Error("System program does not have events")}}class rH{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class pS{constructor(t){this.instruction=new Y$(t),this.accounts=new Q$(t),this.events=new eH(t),this.types=new rH(t)}}var nH=Object.freeze({__proto__:null,hash:function(r){return new TextDecoder().decode(tu(r))}});function mS(r,...t){let e=[Ae.Buffer.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof Ae.Buffer?s:ai(s).toBuffer())});const[n]=Xt.findProgramAddressSync(e,ai(r));return n}var iH=Object.freeze({__proto__:null,createWithSeedSync:function(r,t,e){const n=Ae.Buffer.concat([r.toBuffer(),Ae.Buffer.from(t),e.toBuffer()]);return new Xt(tu(n))},associated:mS});const Mv=new Xt("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ev=new Xt("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var oH=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Mv,ASSOCIATED_PROGRAM_ID:Ev,associatedAddress:function({mint:r,owner:t}){return Xt.findProgramAddressSync([t.toBuffer(),Mv.toBuffer(),r.toBuffer()],Ev)[0]}}),Av={exports:{}};(function(r,t){var e=typeof self<"u"?self:j$,n=function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i}();(function(i){(function(c){var l="URLSearchParams"in i,p="Symbol"in i&&"iterator"in Symbol,m="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),v="FormData"in i,_="ArrayBuffer"in i;if(_)var E=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],w=ArrayBuffer.isView||function(a){return a&&E.indexOf(Object.prototype.toString.call(a))>-1};function x(a){if(typeof a!="string"&&(a=String(a)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function A(a){return typeof a!="string"&&(a=String(a)),a}function B(a){var f={next:function(){var h=a.shift();return{done:h===void 0,value:h}}};return p&&(f[Symbol.iterator]=function(){return f}),f}function P(a){this.map={},a instanceof P?a.forEach(function(f,h){this.append(h,f)},this):Array.isArray(a)?a.forEach(function(f){this.append(f[0],f[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(f){this.append(f,a[f])},this)}function R(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function C(a){return new Promise(function(f,h){a.onload=function(){f(a.result)},a.onerror=function(){h(a.error)}})}function O(a){var f=new FileReader,h=C(f);return f.readAsArrayBuffer(a),h}function z(a){if(a.slice)return a.slice(0);var f=new Uint8Array(a.byteLength);return f.set(new Uint8Array(a)),f.buffer}function H(){return this.bodyUsed=!1,this._initBody=function(a){var f;this._bodyInit=a,a?typeof a=="string"?this._bodyText=a:m&&Blob.prototype.isPrototypeOf(a)?this._bodyBlob=a:v&&FormData.prototype.isPrototypeOf(a)?this._bodyFormData=a:l&&URLSearchParams.prototype.isPrototypeOf(a)?this._bodyText=a.toString():_&&m&&(f=a)&&DataView.prototype.isPrototypeOf(f)?(this._bodyArrayBuffer=z(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(a)||w(a))?this._bodyArrayBuffer=z(a):this._bodyText=a=Object.prototype.toString.call(a):this._bodyText="",this.headers.get("content-type")||(typeof a=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m&&(this.blob=function(){var a=R(this);if(a)return a;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?R(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(O)}),this.text=function(){var a=R(this);if(a)return a;if(this._bodyBlob)return function(f){var h=new FileReader,g=C(h);return h.readAsText(f),g}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(f){for(var h=new Uint8Array(f),g=new Array(h.length),S=0;S-1?g:h),this.mode=f.mode||this.mode||null,this.signal=f.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&S)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(S)}function G(a){var f=new FormData;return a.trim().split("&").forEach(function(h){if(h){var g=h.split("="),S=g.shift().replace(/\+/g," "),I=g.join("=").replace(/\+/g," ");f.append(decodeURIComponent(S),decodeURIComponent(I))}}),f}function M(a,f){f||(f={}),this.type="default",this.status=f.status===void 0?200:f.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in f?f.statusText:"OK",this.headers=new P(f.headers),this.url=f.url||"",this._initBody(a)}nt.prototype.clone=function(){return new nt(this,{body:this._bodyInit})},H.call(nt.prototype),H.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},M.error=function(){var a=new M(null,{status:0,statusText:""});return a.type="error",a};var d=[301,302,303,307,308];M.redirect=function(a,f){if(d.indexOf(f)===-1)throw new RangeError("Invalid status code");return new M(null,{status:f,headers:{location:a}})},c.DOMException=i.DOMException;try{new c.DOMException}catch{c.DOMException=function(f,h){this.message=f,this.name=h;var g=Error(f);this.stack=g.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function o(a,f){return new Promise(function(h,g){var S=new nt(a,f);if(S.signal&&S.signal.aborted)return g(new c.DOMException("Aborted","AbortError"));var I=new XMLHttpRequest;function y(){I.abort()}I.onload=function(){var u,b,D={status:I.status,statusText:I.statusText,headers:(u=I.getAllResponseHeaders()||"",b=new P,u.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(F){var q=F.split(":"),it=q.shift().trim();if(it){var at=q.join(":").trim();b.append(it,at)}}),b)};D.url="responseURL"in I?I.responseURL:D.headers.get("X-Request-URL");var Z="response"in I?I.response:I.responseText;h(new M(Z,D))},I.onerror=function(){g(new TypeError("Network request failed"))},I.ontimeout=function(){g(new TypeError("Network request failed"))},I.onabort=function(){g(new c.DOMException("Aborted","AbortError"))},I.open(S.method,S.url,!0),S.credentials==="include"?I.withCredentials=!0:S.credentials==="omit"&&(I.withCredentials=!1),"responseType"in I&&m&&(I.responseType="blob"),S.headers.forEach(function(u,b){I.setRequestHeader(b,u)}),S.signal&&(S.signal.addEventListener("abort",y),I.onreadystatechange=function(){I.readyState===4&&S.signal.removeEventListener("abort",y)}),I.send(S._bodyInit===void 0?null:S._bodyInit)})}o.polyfill=!0,i.fetch||(i.fetch=o,i.Headers=P,i.Request=nt,i.Response=M),c.Headers=P,c.Request=nt,c.Response=M,c.fetch=o,Object.defineProperty(c,"__esModule",{value:!0})})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(Av,Av.exports);var sH=K$(Av.exports);async function b8(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=Sv(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=Sv(s.data);return i}const aH=We.rustEnum([We.struct([],"uninitialized"),We.struct([We.option(We.publicKey(),"authorityAddress")],"buffer"),We.struct([We.publicKey("programdataAddress")],"program"),We.struct([We.u64("slot"),We.option(We.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,We.u32());function Sv(r){return aH.decode(r)}var uH=Object.freeze({__proto__:null,verifiedBuild:async function(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([b8(r,t),sH(n)]),c=(await i.json()).filter(p=>!p.aborted&&p.state==="Built"&&p.verified==="Verified");if(c.length===0)return null;const l=c[0];return s.slot.toNumber()!==l.verified_slot?null:l},fetchData:b8,decodeUpgradeableLoaderState:Sv}),fH=Object.freeze({__proto__:null,sha256:nH,rpc:T$,publicKey:iH,bytes:k$,token:oH,features:U$,registry:uH});function cH(r){return"accounts"in r}const hH=We.struct([We.publicKey("authority"),We.vecU8("data")]);function Kh(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(c=>c.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class Tl{static build(t,e,n){if(t.name==="_inner")throw new uh("the _inner name is reserved");const s=(...i)=>{const[c,l]=Kh(t,[...i]);Ny(t.accounts,l.accounts);const p=s.accounts(l.accounts);return l.remainingAccounts!==void 0&&p.push(...l.remainingAccounts),Fy("debug-logs")&&console.log("Outgoing account metas:",p),new Ir({keys:p,programId:n,data:e(t.name,YA(t,...c))})};return s.accounts=i=>Tl.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const c=t[i.name];return Tl.accountsArray(c,i.accounts,n,s).flat()}{const c=i;let l;try{l=ai(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const p=c.isOptional&&l.equals(n);return{pubkey:l,isWritable:c.isMut&&!p,isSigner:c.isSigner&&!p}}}).flat():[]}}class lH{static build(t,e){return(...n)=>{var s,i,c;const[,l]=Kh(t,[...n]),p=new wr;if(l.preInstructions&&l.instructions)throw new Error("instructions is deprecated, use preInstructions");return(s=l.preInstructions)===null||s===void 0||s.forEach(m=>p.add(m)),(i=l.instructions)===null||i===void 0||i.forEach(m=>p.add(m)),p.add(e(...n)),(c=l.postInstructions)===null||c===void 0||c.forEach(m=>p.add(m)),p}}}class dH{static build(t,e,n,s){return async(...i)=>{var c;const l=e(...i),[,p]=Kh(t,[...i]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(l,(c=p.signers)!==null&&c!==void 0?c:[],p.options)}catch(m){throw jy(m,n)}}}}class pH{static build(t,e,n,s){var i;const c={};return(i=t.accounts)===null||i===void 0||i.forEach(l=>{const p=zr(l.name);c[p]=new vS(t,l,n,s,e)}),c}}class vS{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??ah(),this._coder=i??new $y(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(n=>n?n.data:null)}async fetchMultipleAndContext(t,e){return(await gv(this._provider.connection,t.map(n=>ai(n)),e)).map(n=>{if(n==null)return null;const{account:s,context:i}=n;return{data:this._coder.accounts.decode(this._idlAccount.name,s.data),context:i}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Zt.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:s,account:i})=>({publicKey:s,account:this._coder.accounts.decode(this._idlAccount.name,i.data)}))}subscribe(t,e){const n=hc.get(t.toString());if(n)return n.ee;const s=new _$;t=ai(t);const i=this._provider.connection.onAccountChange(t,c=>{const l=this._coder.accounts.decode(this._idlAccount.name,c.data);s.emit("change",l)},e);return hc.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=hc.get(t.toString());e?hc&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{hc.delete(t.toString())}).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return an.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await mS(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(ai(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(ai(t),e)}}const hc=new Map,w8="Program log: ",mH="Program data: ";class gS{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new Hy(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,c)=>{if(!i.err)for(const l of this._eventParser.parseLogs(i.logs)){const p=this._eventListeners.get(l.name);p&&p.forEach(m=>{const v=this._eventCallbacks.get(m);if(v){const[,_]=v;_(l.data,c.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class Hy{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new gH(t),s=new vH;let i=n.next();for(;i!==null;){let[c,l,p]=this.handleLog(s,i,e);c&&(yield c),l&&s.push(l),p&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(w8)||t.startsWith(mH)){const n=t.startsWith(w8)?t.slice(13):t.slice(14),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class vH{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class gH{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class yH{static build(t,e,n,s,i,c,l){return async(...p)=>{var m;const v=e(...p),[,_]=Kh(t,[...p]);let E;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{E=await s.simulate(v,_.signers,(m=_.options)===null||m===void 0?void 0:m.commitment)}catch(A){throw jy(A,n)}if(E===void 0)throw new Error("Unable to simulate transaction");const w=E.logs;if(!w)throw new Error("Simulated logs not found");const x=[];if(l.events){let A=new Hy(c,i);for(const B of A.parseLogs(w))x.push(B)}return{events:x,raw:w}}}}function pm(r){return new yS(jh(8),t=>Vy.fromBuffer(t),t=>t.toBuffer(),r)}function S0(r){return new yS(jh(32),t=>new Xt(t),t=>t.toBuffer(),r)}function mm(r,t){return new bH(r,t)}class yS extends Cd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class bH extends Cd{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=_s()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class Vy extends Jc{toBuffer(){const t=super.toArray().reverse(),e=Zt.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Zt.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Vy([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const wH=dn([S0("mint"),S0("owner"),pm("amount"),mm(S0(),"delegate"),(r=>{const t=dS((e=>new Td(1,e))("discriminator"),null,"state");return t.addVariant(0,dn([]),"uninitialized"),t.addVariant(1,dn([]),"initialized"),t.addVariant(2,dn([]),"frozen"),t})(),mm(pm(),"isNative"),pm("delegatedAmount"),mm(S0(),"closeAuthority")]);class ch{constructor(t,e,n,s,i,c,l,p){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=l,this._customResolver=p,this._args=t,this._accountStore=new xH(n,c,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,c=t[i];c!==void 0&&(wS(c)?cH(s)?n[i]=this.resolveOptionalsHelper(c,s.accounts):n[i]=xS(c,!0):c!==null?n[i]=ai(c):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,p])&&await this.autoPopulatePda(l,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s!this.get([...e,zr(E)]));if(n+=_.length,_.length>0){const E=await this._accountStore.fetchAccount({publicKey:v});await Promise.all(_.map(async w=>{const x=zr(w);return this.set([...e,x],E[x]),E[x]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(c=>this.toBuffer(c,e)));if(n.some(c=>c===void 0))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await Xt.findProgramAddress(n,s);this.set([...e,zr(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new Xt(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(i=>i.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const s=n.type.fields.find(i=>i.name===e[0]);return this.getType(s.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(e!==void 0)return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=zr(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,c)=>(i||{})[c],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,zr(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const c=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(c,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[zr(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Zt.Buffer.from([e]);case"u16":let n=Zt.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Zt.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Zt.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Zt.Buffer.from(ZA(e));case"publicKey":return e.toBuffer();default:if(t.array)return Zt.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}ch.CONST_ACCOUNTS={associatedTokenProgram:Ev,rent:na,systemProgram:an.programId,tokenProgram:Mv,clock:oo};class xH{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await nu.fetchIdl(t,this._provider);if(e){const n=new nu(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=function(l){return wH.decode(l)}(i.data);this._cache.set(s,c)}else if(e){const i=await this.ensureIdl(n);if(i){const c=i[zr(e)];if(c){const l=await c.fetch(t);this._cache.set(s,l)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=i.data,l=await this.ensureIdl(i.owner);if(l){const p=Object.values(l)[0];if(!p)throw new Error("No accounts for this program");const m=p.coder.accounts.decodeAny(c);this._cache.set(s,m)}}return this._cache.get(s)}}class bS{static build(t,e,n,s,i,c,l,p,m,v,_){return(...E)=>new _H(E,s,i,c,l,p,t,e,n,m,v,_)}}function wS(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function xS(r,t){const e={};for(const n in r){const s=r[n];if(s!==null)e[n]=wS(s)?xS(s,!0):ai(s);else if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return e}class _H{constructor(t,e,n,s,i,c,l,p,m,v,_,E){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=c,this._programId=p,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new ch(t,this._accounts,l,p,m,v,_,E)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class MH{static build(t,e,n,s){const i=e.accounts.find(l=>l.isMut),c=!!e.returns;if(!(i||!c))return async(...l)=>{var p,m;let v=await n(...l);const _=`Program return: ${t} `;let E=v.raw.find(A=>A.startsWith(_));if(!E)throw new Error("View expected return log");let w=WA(E.slice(_.length)),x=e.returns;if(!x)throw new Error("View expected return type");return Mi.fieldLayout({type:x},Array.from([...(p=s.accounts)!==null&&p!==void 0?p:[],...(m=s.types)!==null&&m!==void 0?m:[]])).decode(w)}}}class EH{static build(t,e,n,s,i){const c={},l={},p={},m={},v={},_={},E=GA(t),w=t.accounts?pH.build(t,e,n,s):{};return t.instructions.forEach(x=>{const A=Tl.build(x,(H,tt)=>e.instruction.encode(H,tt),n),B=lH.build(x,A),P=dH.build(x,B,E,s),R=yH.build(x,B,E,s,e,n,t),C=MH.build(n,x,R,t),O=bS.build(s,n,x,A,B,P,R,C,w,t.types||[],i&&i(x)),z=zr(x.name);l[z]=A,p[z]=B,c[z]=P,m[z]=R,v[z]=O,C&&(_[z]=C)}),[c,l,p,w,m,v,_]}}class nu{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=ai(e),n||(n=ah()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new $y(t),this._events=new gS(this._programId,n,this._coder);const[c,l,p,m,v,_,E]=EH.build(t,this._coder,e,n,i??(()=>{}));this.rpc=c,this.instruction=l,this.transaction=p,this.account=m,this.simulate=v,this.methods=_,this.views=E}static async at(t,e){const n=ai(t),s=await nu.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new nu(s,n,e)}static async fetchIdl(t,e){e=e??ah();const n=ai(t),s=await async function(p){const m=(await Xt.findProgramAddress([],p))[0];return await Xt.createWithSeed(m,"anchor:idl",p)}(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let c=function(p){return hH.decode(p)}(i.data.slice(8));const l=x$(c.data);return JSON.parse(VA(l))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const AH=new Xt("11111111111111111111111111111111");function SH(r){return new nu(x8,AH,r,new pS(x8))}const x8={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};var _8,_S=Oh(Object.freeze({__proto__:null,web3:yA,AccountClient:vS,AnchorError:Yu,AnchorProvider:eS,BorshAccountsCoder:Da,BorshCoder:$y,BorshEventCoder:oS,BorshInstructionCoder:Rd,DISCRIMINATOR_SIZE:Cl,EventManager:gS,EventParser:Hy,IdlError:uh,LangErrorCode:qe,LangErrorMessage:nS,MethodsBuilderFactory:bS,Native:class{static system(r){return SH(r)}},Program:nu,ProgramError:fh,ProgramErrorStack:Uf,SystemCoder:pS,eventDiscriminator:sS,getProvider:ah,parseIdlErrors:GA,setProvider:function(r){bv=r},splitArgsAndCtx:Kh,toInstruction:YA,translateAddress:ai,translateError:jy,utils:fH,validateAccounts:Ny,BN:Jc})),lc={},dc={},M8,pc={};function kH(){if(M8)return pc;M8=1;var r=$e&&$e.__awaiter||function(n,s,i,c){return new(i||(i=Promise))(function(l,p){function m(E){try{_(c.next(E))}catch(w){p(w)}}function v(E){try{_(c.throw(E))}catch(w){p(w)}}function _(E){E.done?l(E.value):function(w){return w instanceof i?w:new i(function(x){x(w)})}(E.value).then(m,v)}_((c=c.apply(n,s||[])).next())})},t=$e&&$e.__generator||function(n,s){var i,c,l,p,m={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return p={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function v(_){return function(E){return function(w){if(i)throw new TypeError("Generator is already executing.");for(;m;)try{if(i=1,c&&(l=2&w[0]?c.return:w[0]?c.throw||((l=c.return)&&l.call(c),0):c.next)&&!(l=l.call(c,w[1])).done)return l;switch(c=0,l&&(w=[2&w[0],l.value]),w[0]){case 0:case 1:l=w;break;case 4:return m.label++,{value:w[1],done:!1};case 5:m.label++,c=w[1],w=[0];continue;case 7:w=m.ops.pop(),m.trys.pop();continue;default:if(l=m.trys,!((l=l.length>0&&l[l.length-1])||w[0]!==6&&w[0]!==2)){m=0;continue}if(w[0]===3&&(!l||w[1]>l[0]&&w[1]=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(A);_[E];){var P=t[_.charCodeAt(E)];if(P===255)return;for(var R=0,C=A-1;(P!==0||R>>0,B[C]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=R,E++}for(var O=A-x;O!==A&&B[O]===0;)O++;for(var z=new Uint8Array(w+(A-O)),H=w;O!==A;)z[H++]=B[O++];return z}return{encode:function(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var E=0,w=0,x=0,A=_.length;x!==A&&_[x]===0;)x++,E++;for(var B=(A-x)*m+1>>>0,P=new Uint8Array(B);x!==A;){for(var R=_[x],C=0,O=B-1;(R!==0||C>>0,P[O]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=C,x++}for(var z=B-w;z!==B&&P[z]===0;)z++;for(var H=l.repeat(E);z464)throw new Error("The metadata is too long");var H=x.subarray(0,R);return c.Buffer.concat([P,H])}var tt=B.encode(w,x);return H=x.subarray(0,tt),c.Buffer.concat([P,H])},_.parseIxLayout=function(E){var w=E.instructions.map(function(x){var A=x.args.map(function(P){var R,C;return m.IdlCoder.fieldLayout(P,Array.from(n(n([],(R=E.accounts)!==null&&R!==void 0?R:[]),(C=E.types)!==null&&C!==void 0?C:[])))}),B=l.default(x.name);return[B,p.struct(A,B)]});return new Map(w)},_.prototype.decode=function(E,w){w===void 0&&(w="hex"),typeof E=="string"&&(E=w==="hex"?c.Buffer.from(E,"hex"):c.Buffer.from(i.default.decode(E)));var x=i.default.encode(E.subarray(0,this.discriminatorLength)),A=E.subarray(this.discriminatorLength),B=this.discriminatorLayouts.get(x);if(!B)return null;if(B.name==="updProduct"||B.name==="addProduct"){for(var P={},R=0;Rr.MAX_SLOT_DIFFERENCE&&(pt=t.Unknown),pt===t.Trading&&(R=yt.price,C=yt.confidence);for(var Ft=[],lt=240;Ft.length0?s-4:s;for(e=0;e>16&255,c[l++]=t>>8&255,c[l++]=255&t;return i===2&&(t=Oi[r.charCodeAt(e)]<<2|Oi[r.charCodeAt(e+1)]>>4,c[l++]=255&t),i===1&&(t=Oi[r.charCodeAt(e)]<<10|Oi[r.charCodeAt(e+1)]<<4|Oi[r.charCodeAt(e+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},fromByteArray:function(r){for(var t,e=r.length,n=e%3,s=[],i=16383,c=0,l=e-n;cl?l:c+i));return n===1?(t=r[e-1],s.push(No[t>>2]+No[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],s.push(No[t>>10]+No[t>>4&63]+No[t<<2&63]+"=")),s.join("")}},No=[],Oi=[],TH=typeof Uint8Array<"u"?Uint8Array:Array,L8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bu=0;bu<64;++bu)No[bu]=L8[bu],Oi[L8.charCodeAt(bu)]=bu;function O8(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return e===-1&&(e=t),[e,e===t?0:4-e%4]}function LH(r,t,e){for(var n,s,i=[],c=t;c>18&63]+No[s>>12&63]+No[s>>6&63]+No[63&s]);return i.join("")}Oi["-".charCodeAt(0)]=62,Oi["_".charCodeAt(0)]=63;var vm={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function U8(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function AS(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Ll(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}vm.read=function(r,t,e,n,s){var i,c,l=8*s-n-1,p=(1<>1,v=-7,_=e?s-1:0,E=e?-1:1,w=r[t+_];for(_+=E,i=w&(1<<-v)-1,w>>=-v,v+=l;v>0;i=256*i+r[t+_],_+=E,v-=8);for(c=i&(1<<-v)-1,i>>=-v,v+=n;v>0;c=256*c+r[t+_],_+=E,v-=8);if(i===0)i=1-m;else{if(i===p)return c?NaN:1/0*(w?-1:1);c+=Math.pow(2,n),i-=m}return(w?-1:1)*c*Math.pow(2,i-n)},vm.write=function(r,t,e,n,s,i){var c,l,p,m=8*i-s-1,v=(1<>1,E=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,x=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,c=v):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),(t+=c+_>=1?E/p:E*Math.pow(2,1-_))*p>=2&&(c++,p/=2),c+_>=v?(l=0,c=v):c+_>=1?(l=(t*p-1)*Math.pow(2,s),c+=_):(l=t*Math.pow(2,_-1)*Math.pow(2,s),c=0));s>=8;r[e+w]=255&l,w+=x,l/=256,s-=8);for(c=c<0;r[e+w]=255&c,w+=x,c/=256,m-=8);r[e+w-x]|=128*A},function(r){const t=CH,e=vm,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(k){return+k!=k&&(k=0),c.alloc(+k)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function i(k){if(k>s)throw new RangeError('The value "'+k+'" is invalid for option "size"');const T=new Uint8Array(k);return Object.setPrototypeOf(T,c.prototype),T}function c(k,T,L){if(typeof k=="number"){if(typeof T=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return l(k,T,L)}function l(k,T,L){if(typeof k=="string")return function(Q,ot){if(typeof ot=="string"&&ot!==""||(ot="utf8"),!c.isEncoding(ot))throw new TypeError("Unknown encoding: "+ot);const qt=0|w(Q,ot);let It=i(qt);const xt=It.write(Q,ot);return xt!==qt&&(It=It.slice(0,xt)),It}(k,T);if(ArrayBuffer.isView(k))return function(Q){if(Ft(Q,Uint8Array)){const ot=new Uint8Array(Q);return _(ot.buffer,ot.byteOffset,ot.byteLength)}return v(Q)}(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(Ft(k,ArrayBuffer)||k&&Ft(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ft(k,SharedArrayBuffer)||k&&Ft(k.buffer,SharedArrayBuffer)))return _(k,T,L);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=k.valueOf&&k.valueOf();if(j!=null&&j!==k)return c.from(j,T,L);const rt=function(Q){if(c.isBuffer(Q)){const ot=0|E(Q.length),qt=i(ot);return qt.length===0||Q.copy(qt,0,0,ot),qt}return Q.length!==void 0?typeof Q.length!="number"||lt(Q.length)?i(0):v(Q):Q.type==="Buffer"&&Array.isArray(Q.data)?v(Q.data):void 0}(k);if(rt)return rt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return c.from(k[Symbol.toPrimitive]("string"),T,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function m(k){return p(k),i(k<0?0:0|E(k))}function v(k){const T=k.length<0?0:0|E(k.length),L=i(T);for(let j=0;j=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|k}function w(k,T){if(c.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||Ft(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const L=k.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&L===0)return 0;let rt=!1;for(;;)switch(T){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return Bt(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*L;case"hex":return L>>>1;case"base64":return yt(k).length;default:if(rt)return j?-1:Bt(k).length;T=(""+T).toLowerCase(),rt=!0}}function x(k,T,L){let j=!1;if((T===void 0||T<0)&&(T=0),T>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0)<=(T>>>=0))return"";for(k||(k="utf8");;)switch(k){case"hex":return o(this,T,L);case"utf8":case"utf-8":return nt(this,T,L);case"ascii":return M(this,T,L);case"latin1":case"binary":return d(this,T,L);case"base64":return tt(this,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,T,L);default:if(j)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),j=!0}}function A(k,T,L){const j=k[T];k[T]=k[L],k[L]=j}function B(k,T,L,j,rt){if(k.length===0)return-1;if(typeof L=="string"?(j=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),lt(L=+L)&&(L=rt?0:k.length-1),L<0&&(L=k.length+L),L>=k.length){if(rt)return-1;L=k.length-1}else if(L<0){if(!rt)return-1;L=0}if(typeof T=="string"&&(T=c.from(T,j)),c.isBuffer(T))return T.length===0?-1:P(k,T,L,j,rt);if(typeof T=="number")return T&=255,typeof Uint8Array.prototype.indexOf=="function"?rt?Uint8Array.prototype.indexOf.call(k,T,L):Uint8Array.prototype.lastIndexOf.call(k,T,L):P(k,[T],L,j,rt);throw new TypeError("val must be string, number or Buffer")}function P(k,T,L,j,rt){let Q,ot=1,qt=k.length,It=T.length;if(j!==void 0&&((j=String(j).toLowerCase())==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(k.length<2||T.length<2)return-1;ot=2,qt/=2,It/=2,L/=2}function xt(Qt,Ct){return ot===1?Qt[Ct]:Qt.readUInt16BE(Ct*ot)}if(rt){let Qt=-1;for(Q=L;Qqt&&(L=qt-It),Q=L;Q>=0;Q--){let Qt=!0;for(let Ct=0;Ctrt&&(j=rt):j=rt;const Q=T.length;let ot;for(j>Q/2&&(j=Q/2),ot=0;ot>8,It=ot%256,xt.push(It),xt.push(qt);return xt}(T,k.length-L),k,L,j)}function tt(k,T,L){return T===0&&L===k.length?t.fromByteArray(k):t.fromByteArray(k.slice(T,L))}function nt(k,T,L){L=Math.min(k.length,L);const j=[];let rt=T;for(;rt239?4:Q>223?3:Q>191?2:1;if(rt+qt<=L){let It,xt,Qt,Ct;switch(qt){case 1:Q<128&&(ot=Q);break;case 2:It=k[rt+1],(192&It)==128&&(Ct=(31&Q)<<6|63&It,Ct>127&&(ot=Ct));break;case 3:It=k[rt+1],xt=k[rt+2],(192&It)==128&&(192&xt)==128&&(Ct=(15&Q)<<12|(63&It)<<6|63&xt,Ct>2047&&(Ct<55296||Ct>57343)&&(ot=Ct));break;case 4:It=k[rt+1],xt=k[rt+2],Qt=k[rt+3],(192&It)==128&&(192&xt)==128&&(192&Qt)==128&&(Ct=(15&Q)<<18|(63&It)<<12|(63&xt)<<6|63&Qt,Ct>65535&&Ct<1114112&&(ot=Ct))}}ot===null?(ot=65533,qt=1):ot>65535&&(ot-=65536,j.push(ot>>>10&1023|55296),ot=56320|1023&ot),j.push(ot),rt+=qt}return function(Q){const ot=Q.length;if(ot<=G)return String.fromCharCode.apply(String,Q);let qt="",It=0;for(;It"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(k,T,L){return l(k,T,L)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(k,T,L){return function(j,rt,Q){return p(j),j<=0?i(j):rt!==void 0?typeof Q=="string"?i(j).fill(rt,Q):i(j).fill(rt):i(j)}(k,T,L)},c.allocUnsafe=function(k){return m(k)},c.allocUnsafeSlow=function(k){return m(k)},c.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==c.prototype},c.compare=function(k,T){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),Ft(T,Uint8Array)&&(T=c.from(T,T.offset,T.byteLength)),!c.isBuffer(k)||!c.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===T)return 0;let L=k.length,j=T.length;for(let rt=0,Q=Math.min(L,j);rtj.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(j,rt)):Uint8Array.prototype.set.call(j,Q,rt);else{if(!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(j,rt)}rt+=Q.length}return j},c.byteLength=w,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const k=this.length;if(k%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let T=0;TT&&(k+=" ... "),""},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(k,T,L,j,rt){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),!c.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(T===void 0&&(T=0),L===void 0&&(L=k?k.length:0),j===void 0&&(j=0),rt===void 0&&(rt=this.length),T<0||L>k.length||j<0||rt>this.length)throw new RangeError("out of range index");if(j>=rt&&T>=L)return 0;if(j>=rt)return-1;if(T>=L)return 1;if(this===k)return 0;let Q=(rt>>>=0)-(j>>>=0),ot=(L>>>=0)-(T>>>=0);const qt=Math.min(Q,ot),It=this.slice(j,rt),xt=k.slice(T,L);for(let Qt=0;Qt>>=0,isFinite(L)?(L>>>=0,j===void 0&&(j="utf8")):(j=L,L=void 0)}const rt=this.length-T;if((L===void 0||L>rt)&&(L=rt),k.length>0&&(L<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");let Q=!1;for(;;)switch(j){case"hex":return R(this,k,T,L);case"utf8":case"utf-8":return C(this,k,T,L);case"ascii":case"latin1":case"binary":return O(this,k,T,L);case"base64":return z(this,k,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,k,T,L);default:if(Q)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const G=4096;function M(k,T,L){let j="";L=Math.min(k.length,L);for(let rt=T;rtj)&&(L=j);let rt="";for(let Q=T;QL)throw new RangeError("Trying to access beyond buffer length")}function h(k,T,L,j,rt,Q){if(!c.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(T>rt||Tk.length)throw new RangeError("Index out of range")}function g(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,L}function S(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L+7]=Q,Q>>=8,k[L+6]=Q,Q>>=8,k[L+5]=Q,Q>>=8,k[L+4]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L+3]=ot,ot>>=8,k[L+2]=ot,ot>>=8,k[L+1]=ot,ot>>=8,k[L]=ot,L+8}function I(k,T,L,j,rt,Q){if(L+j>k.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function y(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,4),e.write(k,T,L,j,23,4),L+4}function u(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,8),e.write(k,T,L,j,52,8),L+8}c.prototype.slice=function(k,T){const L=this.length;(k=~~k)<0?(k+=L)<0&&(k=0):k>L&&(k=L),(T=T===void 0?L:~~T)<0?(T+=L)<0&&(T=0):T>L&&(T=L),T>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k+--T],rt=1;for(;T>0&&(rt*=256);)j+=this[k+--T]*rt;return j},c.prototype.readUint8=c.prototype.readUInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),this[k]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]|this[k+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]<<8|this[k+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+16777216*this[k+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),16777216*this[k]+(this[k+1]<<16|this[k+2]<<8|this[k+3])},c.prototype.readBigUInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T+256*this[++k]+65536*this[++k]+this[++k]*2**24,rt=this[++k]+256*this[++k]+65536*this[++k]+L*2**24;return BigInt(j)+(BigInt(rt)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T*2**24+65536*this[++k]+256*this[++k]+this[++k],rt=this[++k]*2**24+65536*this[++k]+256*this[++k]+L;return(BigInt(j)<>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q=rt&&(j-=Math.pow(2,8*T)),j},c.prototype.readIntBE=function(k,T,L){k>>>=0,T>>>=0,L||f(k,T,this.length);let j=T,rt=1,Q=this[k+--j];for(;j>0&&(rt*=256);)Q+=this[k+--j]*rt;return rt*=128,Q>=rt&&(Q-=Math.pow(2,8*T)),Q},c.prototype.readInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),128&this[k]?-1*(255-this[k]+1):this[k]},c.prototype.readInt16LE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k]|this[k+1]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt16BE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k+1]|this[k]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},c.prototype.readInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},c.prototype.readBigInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=this[k+4]+256*this[k+5]+65536*this[k+6]+(L<<24);return(BigInt(j)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=(T<<24)+65536*this[++k]+256*this[++k]+this[++k];return(BigInt(j)<>>=0,T||f(k,4,this.length),e.read(this,k,!0,23,4)},c.prototype.readFloatBE=function(k,T){return k>>>=0,T||f(k,4,this.length),e.read(this,k,!1,23,4)},c.prototype.readDoubleLE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!0,52,8)},c.prototype.readDoubleBE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(k,T,L,j){k=+k,T>>>=0,L>>>=0,j||h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=1,Q=0;for(this[T]=255&k;++Q>>=0,L>>>=0,j||h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=L-1,Q=1;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)this[T+rt]=k/Q&255;return T+L},c.prototype.writeUint8=c.prototype.writeUInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,255,0),this[T]=255&k,T+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T+3]=k>>>24,this[T+2]=k>>>16,this[T+1]=k>>>8,this[T]=255&k,T+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigUInt64LE=Tt(function(k,T=0){return g(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Tt(function(k,T=0){return S(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=0,Q=1,ot=0;for(this[T]=255&k;++rt>0)-ot&255;return T+L},c.prototype.writeIntBE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=L-1,Q=1,ot=0;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)k<0&&ot===0&&this[T+rt+1]!==0&&(ot=1),this[T+rt]=(k/Q>>0)-ot&255;return T+L},c.prototype.writeInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,127,-128),k<0&&(k=255+k+1),this[T]=255&k,T+1},c.prototype.writeInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),this[T]=255&k,this[T+1]=k>>>8,this[T+2]=k>>>16,this[T+3]=k>>>24,T+4},c.prototype.writeInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigInt64LE=Tt(function(k,T=0){return g(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Tt(function(k,T=0){return S(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(k,T,L){return y(this,k,T,!0,L)},c.prototype.writeFloatBE=function(k,T,L){return y(this,k,T,!1,L)},c.prototype.writeDoubleLE=function(k,T,L){return u(this,k,T,!0,L)},c.prototype.writeDoubleBE=function(k,T,L){return u(this,k,T,!1,L)},c.prototype.copy=function(k,T,L,j){if(!c.isBuffer(k))throw new TypeError("argument should be a Buffer");if(L||(L=0),j||j===0||(j=this.length),T>=k.length&&(T=k.length),T||(T=0),j>0&&j=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),k.length-T>>=0,L=L===void 0?this.length:L>>>0,k||(k=0),typeof k=="number")for(rt=T;rt=j+4;L-=3)T=`_${k.slice(L-3,L)}${T}`;return`${k.slice(0,L)}${T}`}function F(k,T,L,j,rt,Q){if(k>L||k3?T===0||T===BigInt(0)?`>= 0${ot} and < 2${ot} ** ${8*(Q+1)}${ot}`:`>= -(2${ot} ** ${8*(Q+1)-1}${ot}) and < 2 ** ${8*(Q+1)-1}${ot}`:`>= ${T}${ot} and <= ${L}${ot}`,new b.ERR_OUT_OF_RANGE("value",qt,k)}(function(ot,qt,It){q(qt,"offset"),ot[qt]!==void 0&&ot[qt+It]!==void 0||it(qt,ot.length-(It+1))})(j,rt,Q)}function q(k,T){if(typeof k!="number")throw new b.ERR_INVALID_ARG_TYPE(T,"number",k)}function it(k,T,L){throw Math.floor(k)!==k?(q(k,L),new b.ERR_OUT_OF_RANGE(L||"offset","an integer",k)):T<0?new b.ERR_BUFFER_OUT_OF_BOUNDS:new b.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${T}`,k)}D("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),D("ERR_INVALID_ARG_TYPE",function(k,T){return`The "${k}" argument must be of type number. Received type ${typeof T}`},TypeError),D("ERR_OUT_OF_RANGE",function(k,T,L){let j=`The value of "${k}" is out of range.`,rt=L;return Number.isInteger(L)&&Math.abs(L)>2**32?rt=Z(String(L)):typeof L=="bigint"&&(rt=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(rt=Z(rt)),rt+="n"),j+=` It must be ${T}. Received ${rt}`,j},RangeError);const at=/[^+/0-9A-Za-z-_]/g;function Bt(k,T){let L;T=T||1/0;const j=k.length;let rt=null;const Q=[];for(let ot=0;ot55295&&L<57344){if(!rt){if(L>56319){(T-=3)>-1&&Q.push(239,191,189);continue}if(ot+1===j){(T-=3)>-1&&Q.push(239,191,189);continue}rt=L;continue}if(L<56320){(T-=3)>-1&&Q.push(239,191,189),rt=L;continue}L=65536+(rt-55296<<10|L-56320)}else rt&&(T-=3)>-1&&Q.push(239,191,189);if(rt=null,L<128){if((T-=1)<0)break;Q.push(L)}else if(L<2048){if((T-=2)<0)break;Q.push(L>>6|192,63&L|128)}else if(L<65536){if((T-=3)<0)break;Q.push(L>>12|224,L>>6&63|128,63&L|128)}else{if(!(L<1114112))throw new Error("Invalid code point");if((T-=4)<0)break;Q.push(L>>18|240,L>>12&63|128,L>>6&63|128,63&L|128)}}return Q}function yt(k){return t.toByteArray(function(T){if((T=(T=T.split("=")[0]).trim().replace(at,"")).length<2)return"";for(;T.length%4!=0;)T+="=";return T}(k))}function pt(k,T,L,j){let rt;for(rt=0;rt=T.length||rt>=k.length);++rt)T[rt+L]=k[rt];return rt}function Ft(k,T){return k instanceof T||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===T.name}function lt(k){return k!=k}const ct=function(){const k="0123456789abcdef",T=new Array(256);for(let L=0;L<16;++L){const j=16*L;for(let rt=0;rt<16;++rt)T[j+rt]=k[L]+k[rt]}return T}();function Tt(k){return typeof BigInt>"u"?kt:k}function kt(){throw new Error("BigInt not supported")}}(Vr);const gm=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,SS=r=>r instanceof Uint8Array,ym=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),_o=(r,t)=>r<<32-t|r>>>t;if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function Gy(r){if(typeof r=="string"&&(r=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}(r)),!SS(r))throw new Error("expected Uint8Array, got "+typeof r);return r}class kS{clone(){return this._cloneInto()}}function IS(r){const t=n=>r().update(Gy(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function BS(r=32){if(gm&&typeof gm.getRandomValues=="function")return gm.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}class PS extends kS{constructor(t,e,n,s){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ym(this.buffer)}update(t){Ll(this);const{view:e,buffer:n,blockLen:s}=this,i=(t=Gy(t)).length;for(let c=0;cs-c&&(this.process(n,0),c=0);for(let _=c;_>A&B),R=Number(w&B),C=x?4:0,O=x?0:4;_.setUint32(E+C,P,x),_.setUint32(E+O,R,x)})(n,s-8,BigInt(8*this.length),i),this.process(n,0);const l=ym(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const m=p/4,v=this.get();if(m>v.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_>kv&k0)}:{h:0|Number(r>>kv&k0),l:0|Number(r&k0)}}const OH={fromBig:N8,split:function(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;sBigInt(r>>>0)<>>0),shrSH:(r,t,e)=>r>>>e,shrSL:(r,t,e)=>r<<32-e|t>>>e,rotrSH:(r,t,e)=>r>>>e|t<<32-e,rotrSL:(r,t,e)=>r<<32-e|t>>>e,rotrBH:(r,t,e)=>r<<64-e|t>>>e-32,rotrBL:(r,t,e)=>r>>>e-32|t<<64-e,rotr32H:(r,t)=>t,rotr32L:(r,t)=>r,rotlSH:(r,t,e)=>r<>>32-e,rotlSL:(r,t,e)=>t<>>32-e,rotlBH:(r,t,e)=>t<>>64-e,rotlBL:(r,t,e)=>r<>>64-e,add:function(r,t,e,n){const s=(t>>>0)+(n>>>0);return{h:r+e+(s/2**32|0)|0,l:0|s}},add3L:(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H:(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L:(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H:(r,t,e,n,s)=>t+e+n+s+(r/2**32|0)|0,add5H:(r,t,e,n,s,i)=>t+e+n+s+i+(r/2**32|0)|0,add5L:(r,t,e,n,s)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)};var er=OH;const[UH,NH]=er.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Ds=new Uint32Array(80),zs=new Uint32Array(80);class DH extends PS{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:s,Ch:i,Cl:c,Dh:l,Dl:p,Eh:m,El:v,Fh:_,Fl:E,Gh:w,Gl:x,Hh:A,Hl:B}=this;return[t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B]}set(t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|s,this.Ch=0|i,this.Cl=0|c,this.Dh=0|l,this.Dl=0|p,this.Eh=0|m,this.El=0|v,this.Fh=0|_,this.Fl=0|E,this.Gh=0|w,this.Gl=0|x,this.Hh=0|A,this.Hl=0|B}process(t,e){for(let C=0;C<16;C++,e+=4)Ds[C]=t.getUint32(e),zs[C]=t.getUint32(e+=4);for(let C=16;C<80;C++){const O=0|Ds[C-15],z=0|zs[C-15],H=er.rotrSH(O,z,1)^er.rotrSH(O,z,8)^er.shrSH(O,z,7),tt=er.rotrSL(O,z,1)^er.rotrSL(O,z,8)^er.shrSL(O,z,7),nt=0|Ds[C-2],G=0|zs[C-2],M=er.rotrSH(nt,G,19)^er.rotrBH(nt,G,61)^er.shrSH(nt,G,6),d=er.rotrSL(nt,G,19)^er.rotrBL(nt,G,61)^er.shrSL(nt,G,6),o=er.add4L(tt,d,zs[C-7],zs[C-16]),a=er.add4H(o,H,M,Ds[C-7],Ds[C-16]);Ds[C]=0|a,zs[C]=0|o}let{Ah:n,Al:s,Bh:i,Bl:c,Ch:l,Cl:p,Dh:m,Dl:v,Eh:_,El:E,Fh:w,Fl:x,Gh:A,Gl:B,Hh:P,Hl:R}=this;for(let C=0;C<80;C++){const O=er.rotrSH(_,E,14)^er.rotrSH(_,E,18)^er.rotrBH(_,E,41),z=er.rotrSL(_,E,14)^er.rotrSL(_,E,18)^er.rotrBL(_,E,41),H=_&w^~_&A,tt=E&x^~E&B,nt=er.add5L(R,z,tt,NH[C],zs[C]),G=er.add5H(nt,P,O,H,UH[C],Ds[C]),M=0|nt,d=er.rotrSH(n,s,28)^er.rotrBH(n,s,34)^er.rotrBH(n,s,39),o=er.rotrSL(n,s,28)^er.rotrBL(n,s,34)^er.rotrBL(n,s,39),a=n&i^n&l^i&l,f=s&c^s&p^c&p;P=0|A,R=0|B,A=0|w,B=0|x,w=0|_,x=0|E,{h:_,l:E}=er.add(0|m,0|v,0|G,0|M),m=0|l,v=0|p,l=0|i,p=0|c,i=0|n,c=0|s;const h=er.add3L(M,o,f);n=er.add3H(h,G,d,a),s=0|h}({h:n,l:s}=er.add(0|this.Ah,0|this.Al,0|n,0|s)),{h:i,l:c}=er.add(0|this.Bh,0|this.Bl,0|i,0|c),{h:l,l:p}=er.add(0|this.Ch,0|this.Cl,0|l,0|p),{h:m,l:v}=er.add(0|this.Dh,0|this.Dl,0|m,0|v),{h:_,l:E}=er.add(0|this.Eh,0|this.El,0|_,0|E),{h:w,l:x}=er.add(0|this.Fh,0|this.Fl,0|w,0|x),{h:A,l:B}=er.add(0|this.Gh,0|this.Gl,0|A,0|B),{h:P,l:R}=er.add(0|this.Hh,0|this.Hl,0|P,0|R),this.set(n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R)}roundClean(){Ds.fill(0),zs.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const zH=IS(()=>new DH),D8=BigInt(0),il=BigInt(1),qH=BigInt(2),Ld=r=>r instanceof Uint8Array,FH=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $a(r){if(!Ld(r))throw new Error("Uint8Array expected");let t="";for(let e=0;en+s.length,0));let e=0;return r.forEach(n=>{if(!Ld(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}const Xy=r=>(qH<new Uint8Array(r),q8=r=>Uint8Array.from(r);function RS(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=bm(r),s=bm(r),i=0;const c=()=>{n.fill(1),s.fill(0),i=0},l=(...v)=>e(s,n,...v),p=(v=bm())=>{s=l(q8([0]),v),n=l(),v.length!==0&&(s=l(q8([1]),v),n=l())},m=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let v=0;const _=[];for(;v{let E;for(c(),p(v);!(E=_(m()));)p();return c(),E}}const jH={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function gf(r,t,e={}){const n=(s,i,c)=>{const l=jH[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const p=r[s];if(!(c&&p===void 0||l(p,r)))throw new Error(`Invalid param ${String(s)}=${p} (${typeof p}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(e))n(s,i,!0);return r}var KH=Object.freeze({__proto__:null,bytesToHex:$a,numberToHexUnpadded:z8,hexToNumber:Yy,hexToBytes:vf,bytesToNumberBE:Aa,bytesToNumberLE:Xu,numberToBytesBE:Ju,numberToBytesLE:hh,numberToVarBytesBE:function(r){return vf(z8(r))},ensureBytes:pn,concatBytes:Ha,equalBytes:function(r,t){if(r.length!==t.length)return!1;for(let e=0;eD8;r>>=il,t+=1);return t},bitGet:function(r,t){return r>>BigInt(t)&il},bitSet:(r,t,e)=>r|(e?il:D8)<=Mn?e:t+e}function HH(r,t,e){if(e<=Mn||t 0");if(e===Hr)return Mn;let n=Hr;for(;t>Mn;)t&Hr&&(n=n*r%e),r=r*r%e,t>>=Hr;return n}function rn(r,t,e){let n=r;for(;t-- >Mn;)n*=n,n%=e;return n}function Iv(r,t){if(r===Mn||t<=Mn)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=$r(r,t),n=t,s=Mn,i=Hr;for(;e!==Mn;){const c=n%e,l=s-i*(n/e);n=e,e=c,s=i,i=l}if(n!==Hr)throw new Error("invert: does not exist");return $r(s,t)}BigInt(9),BigInt(16);const VH=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function CS(r,t){const e=t!==void 0?t:r.toString(2).length;return{nBitLength:e,nByteLength:Math.ceil(e/8)}}function TS(r,t,e=!1,n={}){if(r<=Mn)throw new Error(`Expected Field ORDER > 0, got ${r}`);const{nBitLength:s,nByteLength:i}=CS(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=function(p){if(p%wm===$H){const m=(p+Hr)/wm;return function(v,_){const E=v.pow(_,m);if(!v.eql(v.sqr(E),_))throw new Error("Cannot find square root");return E}}if(p%j8===F8){const m=(p-F8)/j8;return function(v,_){const E=v.mul(_,ga),w=v.pow(E,m),x=v.mul(_,w),A=v.mul(v.mul(x,ga),w),B=v.mul(x,v.sub(A,v.ONE));if(!v.eql(v.sqr(B),_))throw new Error("Cannot find square root");return B}}return function(m){const v=(m-Hr)/ga;let _,E,w;for(_=m-Hr,E=0;_%ga===Mn;_/=ga,E++);for(w=ga;w$r(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof p);return Mn<=p&&pp===Mn,isOdd:p=>(p&Hr)===Hr,neg:p=>$r(-p,r),eql:(p,m)=>p===m,sqr:p=>$r(p*p,r),add:(p,m)=>$r(p+m,r),sub:(p,m)=>$r(p-m,r),mul:(p,m)=>$r(p*m,r),pow:(p,m)=>function(v,_,E){if(E 0");if(E===Mn)return v.ONE;if(E===Hr)return _;let w=v.ONE,x=_;for(;E>Mn;)E&Hr&&(w=v.mul(w,x)),x=v.sqr(x),E>>=Hr;return w}(l,p,m),div:(p,m)=>$r(p*Iv(m,r),r),sqrN:p=>p*p,addN:(p,m)=>p+m,subN:(p,m)=>p-m,mulN:(p,m)=>p*m,inv:p=>Iv(p,r),sqrt:n.sqrt||(p=>c(l,p)),invertBatch:p=>function(m,v){const _=new Array(v.length),E=v.reduce((x,A,B)=>m.is0(A)?x:(_[B]=x,m.mul(x,A)),m.ONE),w=m.inv(E);return v.reduceRight((x,A,B)=>m.is0(A)?x:(_[B]=m.mul(x,_[B]),m.mul(x,A)),w),_}(l,p),cmov:(p,m,v)=>v?m:p,toBytes:p=>e?hh(p,i):Ju(p,i),fromBytes:p=>{if(p.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${p.length}`);return e?Xu(p):Aa(p)}});return Object.freeze(l)}function LS(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function K8(r){const t=LS(r);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ZH=BigInt(0),xm=BigInt(1);function OS(r,t){const e=(s,i)=>{const c=i.negate();return s?c:i},n=s=>({windows:Math.ceil(t/s)+1,windowSize:2**(s-1)});return{constTimeNegate:e,unsafeLadder(s,i){let c=r.ZERO,l=s;for(;i>ZH;)i&xm&&(c=c.add(l)),l=l.double(),i>>=xm;return c},precomputeWindow(s,i){const{windows:c,windowSize:l}=n(i),p=[];let m=s,v=m;for(let _=0;_>=w,B>p&&(B-=E,c+=xm);const P=A,R=A+Math.abs(B)-1,C=x%2!=0,O=B<0;B===0?v=v.add(e(C,i[P])):m=m.add(e(O,i[R]))}return{p:m,f:v}},wNAFCached(s,i,c,l){const p=s._WINDOW_SIZE||1;let m=i.get(s);return m||(m=this.precomputeWindow(s,p),p!==1&&i.set(s,l(m))),this.wNAF(p,m,c)}}}function Bv(r){return gf(r.Fp,VH.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),gf(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...CS(r.n,r.nBitLength),...r,p:r.Fp.ORDER});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */}const to=BigInt(0),vi=BigInt(1),I0=BigInt(2),WH=BigInt(8),GH={zip215:!0};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pv=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),$8=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const YH=BigInt(1),Rv=BigInt(2),XH=BigInt(5),H8=BigInt(10),JH=BigInt(20),QH=BigInt(40),V8=BigInt(80),cs=TS(Pv,void 0,!0),tV={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:cs,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:zH,randomBytes:BS,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,t){const e=Pv,n=$r(t*t*t,e),s=function(E){const w=Pv,x=E*E%w*E%w,A=rn(x,Rv,w)*x%w,B=rn(A,YH,w)*E%w,P=rn(B,XH,w)*B%w,R=rn(P,H8,w)*P%w,C=rn(R,JH,w)*R%w,O=rn(C,QH,w)*C%w,z=rn(O,V8,w)*O%w,H=rn(z,V8,w)*O%w,tt=rn(H,H8,w)*P%w;return{pow_p_5_8:rn(tt,Rv,w)*E%w,b2:x}}(r*$r(n*n*t,e)).pow_p_5_8;let i=$r(r*n*s,e);const c=$r(t*i*i,e),l=i,p=$r(i*$8,e),m=c===r,v=c===$r(-r,e),_=c===$r(-r*$8,e);return m&&(i=l),(v||_)&&(i=p),($r(i,e)&Hr)===Hr&&(i=$r(-i,e)),{isValid:m||v,value:i}}},eV=function(r){const t=function(f){const h=Bv(f);return gf(f,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...h})}(r),{Fp:e,n,prehash:s,hash:i,randomBytes:c,nByteLength:l,h:p}=t,m=I0<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:to}}}),E=t.adjustScalarBytes||(f=>f),w=t.domain||((f,h,g)=>{if(h.length||g)throw new Error("Contexts/pre-hash are not supported");return f}),x=f=>typeof f=="bigint"&&tox(f)&&x(h)&&ff===to||A(f,m);function P(f,h){if(A(f,h))return f;throw new Error(`Expected valid scalar < ${h}, got ${typeof f} ${f}`)}function R(f){return f===to?f:P(f,n)}const C=new Map;function O(f){if(!(f instanceof z))throw new Error("ExtendedPoint expected")}class z{constructor(h,g,S,I){if(this.ex=h,this.ey=g,this.ez=S,this.et=I,!B(h))throw new Error("x required");if(!B(g))throw new Error("y required");if(!B(S))throw new Error("z required");if(!B(I))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof z)throw new Error("extended point not allowed");const{x:g,y:S}=h||{};if(!B(g)||!B(S))throw new Error("invalid affine point");return new z(g,S,vi,v(g*S))}static normalizeZ(h){const g=e.invertBatch(h.map(S=>S.ez));return h.map((S,I)=>S.toAffine(g[I])).map(z.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,C.delete(this)}assertValidity(){const{a:h,d:g}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:S,ey:I,ez:y,et:u}=this,b=v(S*S),D=v(I*I),Z=v(y*y),F=v(Z*Z),q=v(b*h);if(v(Z*v(q+D))!==v(F+v(g*v(b*D))))throw new Error("bad point: equation left != right (1)");if(v(S*I)!==v(y*u))throw new Error("bad point: equation left != right (2)")}equals(h){O(h);const{ex:g,ey:S,ez:I}=this,{ex:y,ey:u,ez:b}=h,D=v(g*b),Z=v(y*I),F=v(S*b),q=v(u*I);return D===Z&&F===q}is0(){return this.equals(z.ZERO)}negate(){return new z(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){const{a:h}=t,{ex:g,ey:S,ez:I}=this,y=v(g*g),u=v(S*S),b=v(I0*v(I*I)),D=v(h*y),Z=g+S,F=v(v(Z*Z)-y-u),q=D+u,it=q-b,at=D-u,Bt=v(F*it),yt=v(q*at),pt=v(F*at),Ft=v(it*q);return new z(Bt,yt,Ft,pt)}add(h){O(h);const{a:g,d:S}=t,{ex:I,ey:y,ez:u,et:b}=this,{ex:D,ey:Z,ez:F,et:q}=h;if(g===BigInt(-1)){const L=v((y-I)*(Z+D)),j=v((y+I)*(Z-D)),rt=v(j-L);if(rt===to)return this.double();const Q=v(u*I0*q),ot=v(b*I0*F),qt=ot+Q,It=j+L,xt=ot-Q,Qt=v(qt*rt),Ct=v(It*xt),Dt=v(qt*xt),Se=v(rt*It);return new z(Qt,Ct,Se,Dt)}const it=v(I*D),at=v(y*Z),Bt=v(b*S*q),yt=v(u*F),pt=v((I+y)*(D+Z)-it-at),Ft=yt-Bt,lt=yt+Bt,ct=v(at-g*it),Tt=v(pt*Ft),kt=v(lt*ct),k=v(pt*ct),T=v(Ft*lt);return new z(Tt,kt,T,k)}subtract(h){return this.add(h.negate())}wNAF(h){return nt.wNAFCached(this,C,h,z.normalizeZ)}multiply(h){const{p:g,f:S}=this.wNAF(P(h,n));return z.normalizeZ([g,S])[0]}multiplyUnsafe(h){let g=R(h);return g===to?tt:this.equals(tt)||g===vi?this:this.equals(H)?this.wNAF(g).p:nt.unsafeLadder(this,g)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return nt.unsafeLadder(this,n).is0()}toAffine(h){const{ex:g,ey:S,ez:I}=this,y=this.is0();h==null&&(h=y?WH:e.inv(I));const u=v(g*h),b=v(S*h),D=v(I*h);if(y)return{x:to,y:vi};if(D!==vi)throw new Error("invZ was invalid");return{x:u,y:b}}clearCofactor(){const{h}=t;return h===vi?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){const{d:S,a:I}=t,y=e.BYTES,u=(h=pn("pointHex",h,y)).slice(),b=h[y-1];u[y-1]=-129&b;const D=Xu(u);D===to||P(D,g?m:e.ORDER);const Z=v(D*D),F=v(Z-vi),q=v(S*Z-I);let{isValid:it,value:at}=_(F,q);if(!it)throw new Error("Point.fromHex: invalid y coordinate");const Bt=(at&vi)===vi,yt=(128&b)!=0;if(!g&&at===to&&yt)throw new Error("Point.fromHex: x=0 and x_0=1");return yt!==Bt&&(at=v(-at)),z.fromAffine({x:at,y:D})}static fromPrivateKey(h){return d(h).point}toRawBytes(){const{x:h,y:g}=this.toAffine(),S=hh(g,e.BYTES);return S[S.length-1]|=h&vi?128:0,S}toHex(){return $a(this.toRawBytes())}}z.BASE=new z(t.Gx,t.Gy,vi,v(t.Gx*t.Gy)),z.ZERO=new z(to,vi,vi,to);const{BASE:H,ZERO:tt}=z,nt=OS(z,8*l);function G(f){return $r(f,n)}function M(f){return G(Xu(f))}function d(f){const h=l;f=pn("private key",f,h);const g=pn("hashed private key",i(f),2*h),S=E(g.slice(0,h)),I=g.slice(h,2*h),y=M(S),u=H.multiply(y),b=u.toRawBytes();return{head:S,prefix:I,scalar:y,point:u,pointBytes:b}}function o(f=new Uint8Array,...h){const g=Ha(...h);return M(i(w(g,pn("context",f),!!s)))}const a=GH;return H._setWindowSize(8),{CURVE:t,getPublicKey:function(f){return d(f).pointBytes},sign:function(f,h,g={}){f=pn("message",f),s&&(f=s(f));const{prefix:S,scalar:I,pointBytes:y}=d(h),u=o(g.context,S,f),b=H.multiply(u).toRawBytes(),D=G(u+o(g.context,b,y,f)*I);return R(D),pn("result",Ha(b,hh(D,e.BYTES)),2*l)},verify:function(f,h,g,S=a){const{context:I,zip215:y}=S,u=e.BYTES;f=pn("signature",f,2*u),h=pn("message",h),s&&(h=s(h));const b=Xu(f.slice(u,2*u));let D,Z,F;try{D=z.fromHex(g,y),Z=z.fromHex(f.slice(0,u),y),F=H.multiplyUnsafe(b)}catch{return!1}if(!y&&D.isSmallOrder())return!1;const q=o(I,Z.toRawBytes(),D.toRawBytes(),h);return Z.add(D.multiplyUnsafe(q)).subtract(F).clearCofactor().equals(z.ZERO)},ExtendedPoint:z,utils:{getExtendedPublicKey:d,randomPrivateKey:()=>c(e.BYTES),precompute:(f=8,h=z.BASE)=>(h._setWindowSize(f),h.multiply(BigInt(3)),h)}}}(tV),rV=(cs.ORDER+BigInt(3))/BigInt(8);cs.pow(Rv,rV),cs.sqrt(cs.neg(cs.ONE)),cs.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,t){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const e=r.sqrt(t);r.isOdd(e)&&r.neg(e)}(cs,cs.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Cv={exports:{}},nV=Wy(Object.freeze({__proto__:null,default:{}}));(function(r,t){function e(M,d){if(!M)throw new Error(d||"Assertion failed")}function n(M,d){M.super_=d;var o=function(){};o.prototype=d.prototype,M.prototype=new o,M.prototype.constructor=M}function s(M,d,o){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&(d!=="le"&&d!=="be"||(o=d,d=10),this._init(M||0,d||10,o||"be"))}var i;typeof Cv=="object"?Cv.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{i=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:nV.Buffer}catch{}function c(M,d){var o=M.charCodeAt(d);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void e(!1,"Invalid character in "+M)}function l(M,d,o){var a=c(M,o);return o-1>=d&&(a|=c(M,o-1)<<4),a}function p(M,d,o,a){for(var f=0,h=0,g=Math.min(M.length,o),S=d;S=49?I-49+10:I>=17?I-17+10:I,e(I>=0&&h0?M:d},s.min=function(M,d){return M.cmp(d)<0?M:d},s.prototype._init=function(M,d,o){if(typeof M=="number")return this._initNumber(M,d,o);if(typeof M=="object")return this._initArray(M,d,o);d==="hex"&&(d=16),e(d===(0|d)&&d>=2&&d<=36);var a=0;(M=M.toString().replace(/\s+/g,""))[0]==="-"&&(a++,this.negative=1),a=0;a-=3)h=M[a]|M[a-1]<<8|M[a-2]<<16,this.words[f]|=h<>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);else if(o==="le")for(a=0,f=0;a>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);return this._strip()},s.prototype._parseHex=function(M,d,o){this.length=Math.ceil((M.length-d)/6),this.words=new Array(this.length);for(var a=0;a=d;a-=2)f=l(M,d,a)<=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;else for(a=(M.length-d)%2==0?d+1:d;a=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;this._strip()},s.prototype._parseBase=function(M,d,o){this.words=[0],this.length=1;for(var a=0,f=1;f<=67108863;f*=d)a++;a--,f=f/d|0;for(var h=M.length-o,g=h%a,S=Math.min(h,h-g)+o,I=0,y=o;y1&&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")]=v}catch{s.prototype.inspect=v}else s.prototype.inspect=v;function v(){return(this.red?""}var _=["","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"],E=[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];function x(M,d,o){o.negative=d.negative^M.negative;var a=M.length+d.length|0;o.length=a,a=a-1|0;var f=0|M.words[0],h=0|d.words[0],g=f*h,S=67108863&g,I=g/67108864|0;o.words[0]=S;for(var y=1;y>>26,b=67108863&I,D=Math.min(y,d.length-1),Z=Math.max(0,y-M.length+1);Z<=D;Z++){var F=y-Z|0;u+=(g=(f=0|M.words[F])*(h=0|d.words[Z])+b)/67108864|0,b=67108863&g}o.words[y]=0|b,I=0|u}return I!==0?o.words[y]=0|I:o.length--,o._strip()}s.prototype.toString=function(M,d){var o;if(d=0|d||1,(M=M||10)===16||M==="hex"){o="";for(var a=0,f=0,h=0;h>>24-a&16777215,(a+=2)>=26&&(a-=26,h--),o=f!==0||h!==this.length-1?_[6-S.length]+S+o:S+o}for(f!==0&&(o=f.toString(16)+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(M===(0|M)&&M>=2&&M<=36){var I=E[M],y=w[M];o="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(y).toString(M);o=(u=u.idivn(y)).isZero()?b+o:_[I-b.length]+b+o}for(this.isZero()&&(o="0"+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}e(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var M=this.words[0];return this.length===2?M+=67108864*this.words[1]:this.length===3&&this.words[2]===1?M+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-M:M},s.prototype.toJSON=function(){return this.toString(16,2)},i&&(s.prototype.toBuffer=function(M,d){return this.toArrayLike(i,M,d)}),s.prototype.toArray=function(M,d){return this.toArrayLike(Array,M,d)},s.prototype.toArrayLike=function(M,d,o){this._strip();var a=this.byteLength(),f=o||Math.max(1,a);e(a<=f,"byte array longer than desired length"),e(f>0,"Requested array length <= 0");var h=function(g,S){return g.allocUnsafe?g.allocUnsafe(S):new g(S)}(M,f);return this["_toArrayLike"+(d==="le"?"LE":"BE")](h,a),h},s.prototype._toArrayLikeLE=function(M,d){for(var o=0,a=0,f=0,h=0;f>8&255),o>16&255),h===6?(o>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o=0&&(M[o--]=g>>8&255),o>=0&&(M[o--]=g>>16&255),h===6?(o>=0&&(M[o--]=g>>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o>=0)for(M[o--]=a;o>=0;)M[o--]=0},Math.clz32?s.prototype._countBits=function(M){return 32-Math.clz32(M)}:s.prototype._countBits=function(M){var d=M,o=0;return d>=4096&&(o+=13,d>>>=13),d>=64&&(o+=7,d>>>=7),d>=8&&(o+=4,d>>>=4),d>=2&&(o+=2,d>>>=2),o+d},s.prototype._zeroBits=function(M){if(M===0)return 26;var d=M,o=0;return!(8191&d)&&(o+=13,d>>>=13),!(127&d)&&(o+=7,d>>>=7),!(15&d)&&(o+=4,d>>>=4),!(3&d)&&(o+=2,d>>>=2),!(1&d)&&o++,o},s.prototype.bitLength=function(){var M=this.words[this.length-1],d=this._countBits(M);return 26*(this.length-1)+d},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var M=0,d=0;dM.length?this.clone().ior(M):M.clone().ior(this)},s.prototype.uor=function(M){return this.length>M.length?this.clone().iuor(M):M.clone().iuor(this)},s.prototype.iuand=function(M){var d;d=this.length>M.length?M:this;for(var o=0;oM.length?this.clone().iand(M):M.clone().iand(this)},s.prototype.uand=function(M){return this.length>M.length?this.clone().iuand(M):M.clone().iuand(this)},s.prototype.iuxor=function(M){var d,o;this.length>M.length?(d=this,o=M):(d=M,o=this);for(var a=0;aM.length?this.clone().ixor(M):M.clone().ixor(this)},s.prototype.uxor=function(M){return this.length>M.length?this.clone().iuxor(M):M.clone().iuxor(this)},s.prototype.inotn=function(M){e(typeof M=="number"&&M>=0);var d=0|Math.ceil(M/26),o=M%26;this._expand(d),o>0&&d--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},s.prototype.notn=function(M){return this.clone().inotn(M)},s.prototype.setn=function(M,d){e(typeof M=="number"&&M>=0);var o=M/26|0,a=M%26;return this._expand(o+1),this.words[o]=d?this.words[o]|1<M.length?(o=this,a=M):(o=M,a=this);for(var f=0,h=0;h>>26;for(;f!==0&&h>>26;if(this.length=o.length,f!==0)this.words[this.length]=f,this.length++;else if(o!==this)for(;hM.length?this.clone().iadd(M):M.clone().iadd(this)},s.prototype.isub=function(M){if(M.negative!==0){M.negative=0;var d=this.iadd(M);return M.negative=1,d._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(M),this.negative=1,this._normSign();var o,a,f=this.cmp(M);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(o=this,a=M):(o=M,a=this);for(var h=0,g=0;g>26,this.words[g]=67108863&d;for(;h!==0&&g>26,this.words[g]=67108863&d;if(h===0&&g>>13,Z=0|g[1],F=8191&Z,q=Z>>>13,it=0|g[2],at=8191&it,Bt=it>>>13,yt=0|g[3],pt=8191&yt,Ft=yt>>>13,lt=0|g[4],ct=8191<,Tt=lt>>>13,kt=0|g[5],k=8191&kt,T=kt>>>13,L=0|g[6],j=8191&L,rt=L>>>13,Q=0|g[7],ot=8191&Q,qt=Q>>>13,It=0|g[8],xt=8191&It,Qt=It>>>13,Ct=0|g[9],Dt=8191&Ct,Se=Ct>>>13,te=0|S[0],Ut=8191&te,Te=te>>>13,J=0|S[1],X=8191&J,st=J>>>13,N=0|S[2],$=8191&N,gt=N>>>13,ft=0|S[3],mt=8191&ft,vt=ft>>>13,At=0|S[4],_t=8191&At,Gt=At>>>13,Rt=0|S[5],wt=8191&Rt,se=Rt>>>13,Lt=0|S[6],Et=8191&Lt,de=Lt>>>13,Pt=0|S[7],Mt=8191&Pt,K=Pt>>>13,Y=0|S[8],V=8191&Y,U=Y>>>13,W=0|S[9],et=8191&W,dt=W>>>13;o.negative=M.negative^d.negative,o.length=19;var ut=(y+(a=Math.imul(b,Ut))|0)+((8191&(f=(f=Math.imul(b,Te))+Math.imul(D,Ut)|0))<<13)|0;y=((h=Math.imul(D,Te))+(f>>>13)|0)+(ut>>>26)|0,ut&=67108863,a=Math.imul(F,Ut),f=(f=Math.imul(F,Te))+Math.imul(q,Ut)|0,h=Math.imul(q,Te);var ht=(y+(a=a+Math.imul(b,X)|0)|0)+((8191&(f=(f=f+Math.imul(b,st)|0)+Math.imul(D,X)|0))<<13)|0;y=((h=h+Math.imul(D,st)|0)+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,a=Math.imul(at,Ut),f=(f=Math.imul(at,Te))+Math.imul(Bt,Ut)|0,h=Math.imul(Bt,Te),a=a+Math.imul(F,X)|0,f=(f=f+Math.imul(F,st)|0)+Math.imul(q,X)|0,h=h+Math.imul(q,st)|0;var zt=(y+(a=a+Math.imul(b,$)|0)|0)+((8191&(f=(f=f+Math.imul(b,gt)|0)+Math.imul(D,$)|0))<<13)|0;y=((h=h+Math.imul(D,gt)|0)+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,a=Math.imul(pt,Ut),f=(f=Math.imul(pt,Te))+Math.imul(Ft,Ut)|0,h=Math.imul(Ft,Te),a=a+Math.imul(at,X)|0,f=(f=f+Math.imul(at,st)|0)+Math.imul(Bt,X)|0,h=h+Math.imul(Bt,st)|0,a=a+Math.imul(F,$)|0,f=(f=f+Math.imul(F,gt)|0)+Math.imul(q,$)|0,h=h+Math.imul(q,gt)|0;var Wt=(y+(a=a+Math.imul(b,mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,vt)|0)+Math.imul(D,mt)|0))<<13)|0;y=((h=h+Math.imul(D,vt)|0)+(f>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,a=Math.imul(ct,Ut),f=(f=Math.imul(ct,Te))+Math.imul(Tt,Ut)|0,h=Math.imul(Tt,Te),a=a+Math.imul(pt,X)|0,f=(f=f+Math.imul(pt,st)|0)+Math.imul(Ft,X)|0,h=h+Math.imul(Ft,st)|0,a=a+Math.imul(at,$)|0,f=(f=f+Math.imul(at,gt)|0)+Math.imul(Bt,$)|0,h=h+Math.imul(Bt,gt)|0,a=a+Math.imul(F,mt)|0,f=(f=f+Math.imul(F,vt)|0)+Math.imul(q,mt)|0,h=h+Math.imul(q,vt)|0;var ye=(y+(a=a+Math.imul(b,_t)|0)|0)+((8191&(f=(f=f+Math.imul(b,Gt)|0)+Math.imul(D,_t)|0))<<13)|0;y=((h=h+Math.imul(D,Gt)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(k,Ut),f=(f=Math.imul(k,Te))+Math.imul(T,Ut)|0,h=Math.imul(T,Te),a=a+Math.imul(ct,X)|0,f=(f=f+Math.imul(ct,st)|0)+Math.imul(Tt,X)|0,h=h+Math.imul(Tt,st)|0,a=a+Math.imul(pt,$)|0,f=(f=f+Math.imul(pt,gt)|0)+Math.imul(Ft,$)|0,h=h+Math.imul(Ft,gt)|0,a=a+Math.imul(at,mt)|0,f=(f=f+Math.imul(at,vt)|0)+Math.imul(Bt,mt)|0,h=h+Math.imul(Bt,vt)|0,a=a+Math.imul(F,_t)|0,f=(f=f+Math.imul(F,Gt)|0)+Math.imul(q,_t)|0,h=h+Math.imul(q,Gt)|0;var Yt=(y+(a=a+Math.imul(b,wt)|0)|0)+((8191&(f=(f=f+Math.imul(b,se)|0)+Math.imul(D,wt)|0))<<13)|0;y=((h=h+Math.imul(D,se)|0)+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Ut),f=(f=Math.imul(j,Te))+Math.imul(rt,Ut)|0,h=Math.imul(rt,Te),a=a+Math.imul(k,X)|0,f=(f=f+Math.imul(k,st)|0)+Math.imul(T,X)|0,h=h+Math.imul(T,st)|0,a=a+Math.imul(ct,$)|0,f=(f=f+Math.imul(ct,gt)|0)+Math.imul(Tt,$)|0,h=h+Math.imul(Tt,gt)|0,a=a+Math.imul(pt,mt)|0,f=(f=f+Math.imul(pt,vt)|0)+Math.imul(Ft,mt)|0,h=h+Math.imul(Ft,vt)|0,a=a+Math.imul(at,_t)|0,f=(f=f+Math.imul(at,Gt)|0)+Math.imul(Bt,_t)|0,h=h+Math.imul(Bt,Gt)|0,a=a+Math.imul(F,wt)|0,f=(f=f+Math.imul(F,se)|0)+Math.imul(q,wt)|0,h=h+Math.imul(q,se)|0;var pe=(y+(a=a+Math.imul(b,Et)|0)|0)+((8191&(f=(f=f+Math.imul(b,de)|0)+Math.imul(D,Et)|0))<<13)|0;y=((h=h+Math.imul(D,de)|0)+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,a=Math.imul(ot,Ut),f=(f=Math.imul(ot,Te))+Math.imul(qt,Ut)|0,h=Math.imul(qt,Te),a=a+Math.imul(j,X)|0,f=(f=f+Math.imul(j,st)|0)+Math.imul(rt,X)|0,h=h+Math.imul(rt,st)|0,a=a+Math.imul(k,$)|0,f=(f=f+Math.imul(k,gt)|0)+Math.imul(T,$)|0,h=h+Math.imul(T,gt)|0,a=a+Math.imul(ct,mt)|0,f=(f=f+Math.imul(ct,vt)|0)+Math.imul(Tt,mt)|0,h=h+Math.imul(Tt,vt)|0,a=a+Math.imul(pt,_t)|0,f=(f=f+Math.imul(pt,Gt)|0)+Math.imul(Ft,_t)|0,h=h+Math.imul(Ft,Gt)|0,a=a+Math.imul(at,wt)|0,f=(f=f+Math.imul(at,se)|0)+Math.imul(Bt,wt)|0,h=h+Math.imul(Bt,se)|0,a=a+Math.imul(F,Et)|0,f=(f=f+Math.imul(F,de)|0)+Math.imul(q,Et)|0,h=h+Math.imul(q,de)|0;var ve=(y+(a=a+Math.imul(b,Mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,K)|0)+Math.imul(D,Mt)|0))<<13)|0;y=((h=h+Math.imul(D,K)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(xt,Ut),f=(f=Math.imul(xt,Te))+Math.imul(Qt,Ut)|0,h=Math.imul(Qt,Te),a=a+Math.imul(ot,X)|0,f=(f=f+Math.imul(ot,st)|0)+Math.imul(qt,X)|0,h=h+Math.imul(qt,st)|0,a=a+Math.imul(j,$)|0,f=(f=f+Math.imul(j,gt)|0)+Math.imul(rt,$)|0,h=h+Math.imul(rt,gt)|0,a=a+Math.imul(k,mt)|0,f=(f=f+Math.imul(k,vt)|0)+Math.imul(T,mt)|0,h=h+Math.imul(T,vt)|0,a=a+Math.imul(ct,_t)|0,f=(f=f+Math.imul(ct,Gt)|0)+Math.imul(Tt,_t)|0,h=h+Math.imul(Tt,Gt)|0,a=a+Math.imul(pt,wt)|0,f=(f=f+Math.imul(pt,se)|0)+Math.imul(Ft,wt)|0,h=h+Math.imul(Ft,se)|0,a=a+Math.imul(at,Et)|0,f=(f=f+Math.imul(at,de)|0)+Math.imul(Bt,Et)|0,h=h+Math.imul(Bt,de)|0,a=a+Math.imul(F,Mt)|0,f=(f=f+Math.imul(F,K)|0)+Math.imul(q,Mt)|0,h=h+Math.imul(q,K)|0;var ge=(y+(a=a+Math.imul(b,V)|0)|0)+((8191&(f=(f=f+Math.imul(b,U)|0)+Math.imul(D,V)|0))<<13)|0;y=((h=h+Math.imul(D,U)|0)+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,a=Math.imul(Dt,Ut),f=(f=Math.imul(Dt,Te))+Math.imul(Se,Ut)|0,h=Math.imul(Se,Te),a=a+Math.imul(xt,X)|0,f=(f=f+Math.imul(xt,st)|0)+Math.imul(Qt,X)|0,h=h+Math.imul(Qt,st)|0,a=a+Math.imul(ot,$)|0,f=(f=f+Math.imul(ot,gt)|0)+Math.imul(qt,$)|0,h=h+Math.imul(qt,gt)|0,a=a+Math.imul(j,mt)|0,f=(f=f+Math.imul(j,vt)|0)+Math.imul(rt,mt)|0,h=h+Math.imul(rt,vt)|0,a=a+Math.imul(k,_t)|0,f=(f=f+Math.imul(k,Gt)|0)+Math.imul(T,_t)|0,h=h+Math.imul(T,Gt)|0,a=a+Math.imul(ct,wt)|0,f=(f=f+Math.imul(ct,se)|0)+Math.imul(Tt,wt)|0,h=h+Math.imul(Tt,se)|0,a=a+Math.imul(pt,Et)|0,f=(f=f+Math.imul(pt,de)|0)+Math.imul(Ft,Et)|0,h=h+Math.imul(Ft,de)|0,a=a+Math.imul(at,Mt)|0,f=(f=f+Math.imul(at,K)|0)+Math.imul(Bt,Mt)|0,h=h+Math.imul(Bt,K)|0,a=a+Math.imul(F,V)|0,f=(f=f+Math.imul(F,U)|0)+Math.imul(q,V)|0,h=h+Math.imul(q,U)|0;var ie=(y+(a=a+Math.imul(b,et)|0)|0)+((8191&(f=(f=f+Math.imul(b,dt)|0)+Math.imul(D,et)|0))<<13)|0;y=((h=h+Math.imul(D,dt)|0)+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,a=Math.imul(Dt,X),f=(f=Math.imul(Dt,st))+Math.imul(Se,X)|0,h=Math.imul(Se,st),a=a+Math.imul(xt,$)|0,f=(f=f+Math.imul(xt,gt)|0)+Math.imul(Qt,$)|0,h=h+Math.imul(Qt,gt)|0,a=a+Math.imul(ot,mt)|0,f=(f=f+Math.imul(ot,vt)|0)+Math.imul(qt,mt)|0,h=h+Math.imul(qt,vt)|0,a=a+Math.imul(j,_t)|0,f=(f=f+Math.imul(j,Gt)|0)+Math.imul(rt,_t)|0,h=h+Math.imul(rt,Gt)|0,a=a+Math.imul(k,wt)|0,f=(f=f+Math.imul(k,se)|0)+Math.imul(T,wt)|0,h=h+Math.imul(T,se)|0,a=a+Math.imul(ct,Et)|0,f=(f=f+Math.imul(ct,de)|0)+Math.imul(Tt,Et)|0,h=h+Math.imul(Tt,de)|0,a=a+Math.imul(pt,Mt)|0,f=(f=f+Math.imul(pt,K)|0)+Math.imul(Ft,Mt)|0,h=h+Math.imul(Ft,K)|0,a=a+Math.imul(at,V)|0,f=(f=f+Math.imul(at,U)|0)+Math.imul(Bt,V)|0,h=h+Math.imul(Bt,U)|0;var ue=(y+(a=a+Math.imul(F,et)|0)|0)+((8191&(f=(f=f+Math.imul(F,dt)|0)+Math.imul(q,et)|0))<<13)|0;y=((h=h+Math.imul(q,dt)|0)+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,a=Math.imul(Dt,$),f=(f=Math.imul(Dt,gt))+Math.imul(Se,$)|0,h=Math.imul(Se,gt),a=a+Math.imul(xt,mt)|0,f=(f=f+Math.imul(xt,vt)|0)+Math.imul(Qt,mt)|0,h=h+Math.imul(Qt,vt)|0,a=a+Math.imul(ot,_t)|0,f=(f=f+Math.imul(ot,Gt)|0)+Math.imul(qt,_t)|0,h=h+Math.imul(qt,Gt)|0,a=a+Math.imul(j,wt)|0,f=(f=f+Math.imul(j,se)|0)+Math.imul(rt,wt)|0,h=h+Math.imul(rt,se)|0,a=a+Math.imul(k,Et)|0,f=(f=f+Math.imul(k,de)|0)+Math.imul(T,Et)|0,h=h+Math.imul(T,de)|0,a=a+Math.imul(ct,Mt)|0,f=(f=f+Math.imul(ct,K)|0)+Math.imul(Tt,Mt)|0,h=h+Math.imul(Tt,K)|0,a=a+Math.imul(pt,V)|0,f=(f=f+Math.imul(pt,U)|0)+Math.imul(Ft,V)|0,h=h+Math.imul(Ft,U)|0;var fe=(y+(a=a+Math.imul(at,et)|0)|0)+((8191&(f=(f=f+Math.imul(at,dt)|0)+Math.imul(Bt,et)|0))<<13)|0;y=((h=h+Math.imul(Bt,dt)|0)+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,a=Math.imul(Dt,mt),f=(f=Math.imul(Dt,vt))+Math.imul(Se,mt)|0,h=Math.imul(Se,vt),a=a+Math.imul(xt,_t)|0,f=(f=f+Math.imul(xt,Gt)|0)+Math.imul(Qt,_t)|0,h=h+Math.imul(Qt,Gt)|0,a=a+Math.imul(ot,wt)|0,f=(f=f+Math.imul(ot,se)|0)+Math.imul(qt,wt)|0,h=h+Math.imul(qt,se)|0,a=a+Math.imul(j,Et)|0,f=(f=f+Math.imul(j,de)|0)+Math.imul(rt,Et)|0,h=h+Math.imul(rt,de)|0,a=a+Math.imul(k,Mt)|0,f=(f=f+Math.imul(k,K)|0)+Math.imul(T,Mt)|0,h=h+Math.imul(T,K)|0,a=a+Math.imul(ct,V)|0,f=(f=f+Math.imul(ct,U)|0)+Math.imul(Tt,V)|0,h=h+Math.imul(Tt,U)|0;var ce=(y+(a=a+Math.imul(pt,et)|0)|0)+((8191&(f=(f=f+Math.imul(pt,dt)|0)+Math.imul(Ft,et)|0))<<13)|0;y=((h=h+Math.imul(Ft,dt)|0)+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,a=Math.imul(Dt,_t),f=(f=Math.imul(Dt,Gt))+Math.imul(Se,_t)|0,h=Math.imul(Se,Gt),a=a+Math.imul(xt,wt)|0,f=(f=f+Math.imul(xt,se)|0)+Math.imul(Qt,wt)|0,h=h+Math.imul(Qt,se)|0,a=a+Math.imul(ot,Et)|0,f=(f=f+Math.imul(ot,de)|0)+Math.imul(qt,Et)|0,h=h+Math.imul(qt,de)|0,a=a+Math.imul(j,Mt)|0,f=(f=f+Math.imul(j,K)|0)+Math.imul(rt,Mt)|0,h=h+Math.imul(rt,K)|0,a=a+Math.imul(k,V)|0,f=(f=f+Math.imul(k,U)|0)+Math.imul(T,V)|0,h=h+Math.imul(T,U)|0;var Kt=(y+(a=a+Math.imul(ct,et)|0)|0)+((8191&(f=(f=f+Math.imul(ct,dt)|0)+Math.imul(Tt,et)|0))<<13)|0;y=((h=h+Math.imul(Tt,dt)|0)+(f>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,a=Math.imul(Dt,wt),f=(f=Math.imul(Dt,se))+Math.imul(Se,wt)|0,h=Math.imul(Se,se),a=a+Math.imul(xt,Et)|0,f=(f=f+Math.imul(xt,de)|0)+Math.imul(Qt,Et)|0,h=h+Math.imul(Qt,de)|0,a=a+Math.imul(ot,Mt)|0,f=(f=f+Math.imul(ot,K)|0)+Math.imul(qt,Mt)|0,h=h+Math.imul(qt,K)|0,a=a+Math.imul(j,V)|0,f=(f=f+Math.imul(j,U)|0)+Math.imul(rt,V)|0,h=h+Math.imul(rt,U)|0;var oe=(y+(a=a+Math.imul(k,et)|0)|0)+((8191&(f=(f=f+Math.imul(k,dt)|0)+Math.imul(T,et)|0))<<13)|0;y=((h=h+Math.imul(T,dt)|0)+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,a=Math.imul(Dt,Et),f=(f=Math.imul(Dt,de))+Math.imul(Se,Et)|0,h=Math.imul(Se,de),a=a+Math.imul(xt,Mt)|0,f=(f=f+Math.imul(xt,K)|0)+Math.imul(Qt,Mt)|0,h=h+Math.imul(Qt,K)|0,a=a+Math.imul(ot,V)|0,f=(f=f+Math.imul(ot,U)|0)+Math.imul(qt,V)|0,h=h+Math.imul(qt,U)|0;var Jt=(y+(a=a+Math.imul(j,et)|0)|0)+((8191&(f=(f=f+Math.imul(j,dt)|0)+Math.imul(rt,et)|0))<<13)|0;y=((h=h+Math.imul(rt,dt)|0)+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(Dt,Mt),f=(f=Math.imul(Dt,K))+Math.imul(Se,Mt)|0,h=Math.imul(Se,K),a=a+Math.imul(xt,V)|0,f=(f=f+Math.imul(xt,U)|0)+Math.imul(Qt,V)|0,h=h+Math.imul(Qt,U)|0;var le=(y+(a=a+Math.imul(ot,et)|0)|0)+((8191&(f=(f=f+Math.imul(ot,dt)|0)+Math.imul(qt,et)|0))<<13)|0;y=((h=h+Math.imul(qt,dt)|0)+(f>>>13)|0)+(le>>>26)|0,le&=67108863,a=Math.imul(Dt,V),f=(f=Math.imul(Dt,U))+Math.imul(Se,V)|0,h=Math.imul(Se,U);var ae=(y+(a=a+Math.imul(xt,et)|0)|0)+((8191&(f=(f=f+Math.imul(xt,dt)|0)+Math.imul(Qt,et)|0))<<13)|0;y=((h=h+Math.imul(Qt,dt)|0)+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863;var ne=(y+(a=Math.imul(Dt,et))|0)+((8191&(f=(f=Math.imul(Dt,dt))+Math.imul(Se,et)|0))<<13)|0;return y=((h=Math.imul(Se,dt))+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,I[0]=ut,I[1]=ht,I[2]=zt,I[3]=Wt,I[4]=ye,I[5]=Yt,I[6]=pe,I[7]=ve,I[8]=ge,I[9]=ie,I[10]=ue,I[11]=fe,I[12]=ce,I[13]=Kt,I[14]=oe,I[15]=Jt,I[16]=le,I[17]=ae,I[18]=ne,y!==0&&(I[19]=y,o.length++),o};function B(M,d,o){o.negative=d.negative^M.negative,o.length=M.length+d.length;for(var a=0,f=0,h=0;h>>26)|0)>>>26,g&=67108863}o.words[h]=S,a=g,g=f}return a!==0?o.words[h]=a:o.length--,o._strip()}function P(M,d,o){return B(M,d,o)}Math.imul||(A=x),s.prototype.mulTo=function(M,d){var o=this.length+M.length;return this.length===10&&M.length===10?A(this,M,d):o<63?x(this,M,d):o<1024?B(this,M,d):P(this,M,d)},s.prototype.mul=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),this.mulTo(M,d)},s.prototype.mulf=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),P(this,M,d)},s.prototype.imul=function(M){return this.clone().mulTo(M,this)},s.prototype.imuln=function(M){var d=M<0;d&&(M=-M),e(typeof M=="number"),e(M<67108864);for(var o=0,a=0;a>=26,o+=f/67108864|0,o+=h>>>26,this.words[a]=67108863&h}return o!==0&&(this.words[a]=o,this.length++),d?this.ineg():this},s.prototype.muln=function(M){return this.clone().imuln(M)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(M){var d=function(h){for(var g=new Array(h.bitLength()),S=0;S>>y&1}return g}(M);if(d.length===0)return new s(1);for(var o=this,a=0;a=0);var d,o=M%26,a=(M-o)/26,f=67108863>>>26-o<<26-o;if(o!==0){var h=0;for(d=0;d>>26-o}h&&(this.words[d]=h,this.length++)}if(a!==0){for(d=this.length-1;d>=0;d--)this.words[d+a]=this.words[d];for(d=0;d=0),a=d?(d-d%26)/26:0;var f=M%26,h=Math.min((M-f)/26,this.length),g=67108863^67108863>>>f<h)for(this.length-=h,I=0;I=0&&(y!==0||I>=a);I--){var u=0|this.words[I];this.words[I]=y<<26-f|u>>>f,y=u&g}return S&&y!==0&&(S.words[S.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(M,d,o){return e(this.negative===0),this.iushrn(M,d,o)},s.prototype.shln=function(M){return this.clone().ishln(M)},s.prototype.ushln=function(M){return this.clone().iushln(M)},s.prototype.shrn=function(M){return this.clone().ishrn(M)},s.prototype.ushrn=function(M){return this.clone().iushrn(M)},s.prototype.testn=function(M){e(typeof M=="number"&&M>=0);var d=M%26,o=(M-d)/26,a=1<=0);var d=M%26,o=(M-d)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=o)return this;if(d!==0&&o++,this.length=Math.min(o,this.length),d!==0){var a=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(M){if(e(typeof M=="number"),e(M<67108864),M<0)return this.iaddn(-M);if(this.negative!==0)return this.negative=0,this.iaddn(M),this.negative=1,this;if(this.words[0]-=M,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(S/67108864|0),this.words[a+o]=67108863&f}for(;a>26,this.words[a+o]=67108863&f;if(g===0)return this._strip();for(e(g===-1),g=0,a=0;a>26,this.words[a]=67108863&f;return this.negative=1,this._strip()},s.prototype._wordDiv=function(M,d){var o=(this.length,M.length),a=this.clone(),f=M,h=0|f.words[f.length-1];(o=26-this._countBits(h))!=0&&(f=f.ushln(o),a.iushln(o),h=0|f.words[f.length-1]);var g,S=a.length-f.length;if(d!=="mod"){(g=new s(null)).length=S+1,g.words=new Array(g.length);for(var I=0;I=0;u--){var b=67108864*(0|a.words[f.length+u])+(0|a.words[f.length+u-1]);for(b=Math.min(b/h|0,67108863),a._ishlnsubmul(f,b,u);a.negative!==0;)b--,a.negative=0,a._ishlnsubmul(f,1,u),a.isZero()||(a.negative^=1);g&&(g.words[u]=b)}return g&&g._strip(),a._strip(),d!=="div"&&o!==0&&a.iushrn(o),{div:g||null,mod:a}},s.prototype.divmod=function(M,d,o){return e(!M.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:this.negative!==0&&M.negative===0?(h=this.neg().divmod(M,d),d!=="mod"&&(a=h.div.neg()),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.iadd(M)),{div:a,mod:f}):this.negative===0&&M.negative!==0?(h=this.divmod(M.neg(),d),d!=="mod"&&(a=h.div.neg()),{div:a,mod:h.mod}):this.negative&M.negative?(h=this.neg().divmod(M.neg(),d),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.isub(M)),{div:h.div,mod:f}):M.length>this.length||this.cmp(M)<0?{div:new s(0),mod:this}:M.length===1?d==="div"?{div:this.divn(M.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(M.words[0]))}:{div:this.divn(M.words[0]),mod:new s(this.modrn(M.words[0]))}:this._wordDiv(M,d);var a,f,h},s.prototype.div=function(M){return this.divmod(M,"div",!1).div},s.prototype.mod=function(M){return this.divmod(M,"mod",!1).mod},s.prototype.umod=function(M){return this.divmod(M,"mod",!0).mod},s.prototype.divRound=function(M){var d=this.divmod(M);if(d.mod.isZero())return d.div;var o=d.div.negative!==0?d.mod.isub(M):d.mod,a=M.ushrn(1),f=M.andln(1),h=o.cmp(a);return h<0||f===1&&h===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=(1<<26)%M,a=0,f=this.length-1;f>=0;f--)a=(o*a+(0|this.words[f]))%M;return d?-a:a},s.prototype.modn=function(M){return this.modrn(M)},s.prototype.idivn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var f=(0|this.words[a])+67108864*o;this.words[a]=f/M|0,o=f%M}return this._strip(),d?this.ineg():this},s.prototype.divn=function(M){return this.clone().idivn(M)},s.prototype.egcd=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a=new s(1),f=new s(0),h=new s(0),g=new s(1),S=0;d.isEven()&&o.isEven();)d.iushrn(1),o.iushrn(1),++S;for(var I=o.clone(),y=d.clone();!d.isZero();){for(var u=0,b=1;!(d.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(d.iushrn(u);u-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(I),f.isub(y)),a.iushrn(1),f.iushrn(1);for(var D=0,Z=1;!(o.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(o.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(I),g.isub(y)),h.iushrn(1),g.iushrn(1);d.cmp(o)>=0?(d.isub(o),a.isub(h),f.isub(g)):(o.isub(d),h.isub(a),g.isub(f))}return{a:h,b:g,gcd:o.iushln(S)}},s.prototype._invmp=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a,f=new s(1),h=new s(0),g=o.clone();d.cmpn(1)>0&&o.cmpn(1)>0;){for(var S=0,I=1;!(d.words[0]&I)&&S<26;++S,I<<=1);if(S>0)for(d.iushrn(S);S-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var y=0,u=1;!(o.words[0]&u)&&y<26;++y,u<<=1);if(y>0)for(o.iushrn(y);y-- >0;)h.isOdd()&&h.iadd(g),h.iushrn(1);d.cmp(o)>=0?(d.isub(o),f.isub(h)):(o.isub(d),h.isub(f))}return(a=d.cmpn(1)===0?f:h).cmpn(0)<0&&a.iadd(M),a},s.prototype.gcd=function(M){if(this.isZero())return M.abs();if(M.isZero())return this.abs();var d=this.clone(),o=M.clone();d.negative=0,o.negative=0;for(var a=0;d.isEven()&&o.isEven();a++)d.iushrn(1),o.iushrn(1);for(;;){for(;d.isEven();)d.iushrn(1);for(;o.isEven();)o.iushrn(1);var f=d.cmp(o);if(f<0){var h=d;d=o,o=h}else if(f===0||o.cmpn(1)===0)break;d.isub(o)}return o.iushln(a)},s.prototype.invm=function(M){return this.egcd(M).a.umod(M)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(M){return this.words[0]&M},s.prototype.bincn=function(M){e(typeof M=="number");var d=M%26,o=(M-d)/26,a=1<>>26,g&=67108863,this.words[h]=g}return f!==0&&(this.words[h]=f,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(M){var d,o=M<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;if(this._strip(),this.length>1)d=1;else{o&&(M=-M),e(M<=67108863,"Number is too big");var a=0|this.words[0];d=a===M?0:aM.length)return 1;if(this.length=0;o--){var a=0|this.words[o],f=0|M.words[o];if(a!==f){af&&(d=1);break}}return d},s.prototype.gtn=function(M){return this.cmpn(M)===1},s.prototype.gt=function(M){return this.cmp(M)===1},s.prototype.gten=function(M){return this.cmpn(M)>=0},s.prototype.gte=function(M){return this.cmp(M)>=0},s.prototype.ltn=function(M){return this.cmpn(M)===-1},s.prototype.lt=function(M){return this.cmp(M)===-1},s.prototype.lten=function(M){return this.cmpn(M)<=0},s.prototype.lte=function(M){return this.cmp(M)<=0},s.prototype.eqn=function(M){return this.cmpn(M)===0},s.prototype.eq=function(M){return this.cmp(M)===0},s.red=function(M){return new nt(M)},s.prototype.toRed=function(M){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),M.convertTo(this)._forceRed(M)},s.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(M){return this.red=M,this},s.prototype.forceRed=function(M){return e(!this.red,"Already a number in reduction context"),this._forceRed(M)},s.prototype.redAdd=function(M){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,M)},s.prototype.redIAdd=function(M){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,M)},s.prototype.redSub=function(M){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,M)},s.prototype.redISub=function(M){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,M)},s.prototype.redShl=function(M){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,M)},s.prototype.redMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.mul(this,M)},s.prototype.redIMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.imul(this,M)},s.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(M){return e(this.red&&!M.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,M)};var R={k256:null,p224:null,p192:null,p25519:null};function C(M,d){this.name=M,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function O(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function z(){C.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function H(){C.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function tt(){C.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function nt(M){if(typeof M=="string"){var d=s._prime(M);this.m=d.p,this.prime=d}else e(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}function G(M){nt.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)}C.prototype._tmp=function(){var M=new s(null);return M.words=new Array(Math.ceil(this.n/13)),M},C.prototype.ireduce=function(M){var d,o=M;do this.split(o,this.tmp),d=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength();while(d>this.n);var a=d0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},C.prototype.split=function(M,d){M.iushrn(this.n,0,d)},C.prototype.imulK=function(M){return M.imul(this.k)},n(O,C),O.prototype.split=function(M,d){for(var o=4194303,a=Math.min(M.length,9),f=0;f>>22,h=g}h>>>=22,M.words[f-10]=h,h===0&&M.length>10?M.length-=10:M.length-=9},O.prototype.imulK=function(M){M.words[M.length]=0,M.words[M.length+1]=0,M.length+=2;for(var d=0,o=0;o>>=26,M.words[o]=f,d=a}return d!==0&&(M.words[M.length++]=d),M},s._prime=function(M){if(R[M])return R[M];var d;if(M==="k256")d=new O;else if(M==="p224")d=new z;else if(M==="p192")d=new H;else{if(M!=="p25519")throw new Error("Unknown prime "+M);d=new tt}return R[M]=d,d},nt.prototype._verify1=function(M){e(M.negative===0,"red works only with positives"),e(M.red,"red works only with red numbers")},nt.prototype._verify2=function(M,d){e((M.negative|d.negative)==0,"red works only with positives"),e(M.red&&M.red===d.red,"red works only with red numbers")},nt.prototype.imod=function(M){return this.prime?this.prime.ireduce(M)._forceRed(this):(m(M,M.umod(this.m)._forceRed(this)),M)},nt.prototype.neg=function(M){return M.isZero()?M.clone():this.m.sub(M)._forceRed(this)},nt.prototype.add=function(M,d){this._verify2(M,d);var o=M.add(d);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},nt.prototype.iadd=function(M,d){this._verify2(M,d);var o=M.iadd(d);return o.cmp(this.m)>=0&&o.isub(this.m),o},nt.prototype.sub=function(M,d){this._verify2(M,d);var o=M.sub(d);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},nt.prototype.isub=function(M,d){this._verify2(M,d);var o=M.isub(d);return o.cmpn(0)<0&&o.iadd(this.m),o},nt.prototype.shl=function(M,d){return this._verify1(M),this.imod(M.ushln(d))},nt.prototype.imul=function(M,d){return this._verify2(M,d),this.imod(M.imul(d))},nt.prototype.mul=function(M,d){return this._verify2(M,d),this.imod(M.mul(d))},nt.prototype.isqr=function(M){return this.imul(M,M.clone())},nt.prototype.sqr=function(M){return this.mul(M,M)},nt.prototype.sqrt=function(M){if(M.isZero())return M.clone();var d=this.m.andln(3);if(e(d%2==1),d===3){var o=this.m.add(new s(1)).iushrn(2);return this.pow(M,o)}for(var a=this.m.subn(1),f=0;!a.isZero()&&a.andln(1)===0;)f++,a.iushrn(1);e(!a.isZero());var h=new s(1).toRed(this),g=h.redNeg(),S=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,S).cmp(g)!==0;)I.redIAdd(g);for(var y=this.pow(I,a),u=this.pow(M,a.addn(1).iushrn(1)),b=this.pow(M,a),D=f;b.cmp(h)!==0;){for(var Z=b,F=0;Z.cmp(h)!==0;F++)Z=Z.redSqr();e(F=0;a--){for(var I=d.words[a],y=S-1;y>=0;y--){var u=I>>y&1;f!==o[0]&&(f=this.sqr(f)),u!==0||h!==0?(h<<=1,h|=u,(++g==4||a===0&&y===0)&&(f=this.mul(f,o[h]),g=0,h=0)):g=0}S=26}return f},nt.prototype.convertTo=function(M){var d=M.umod(this.m);return d===M?d.clone():d},nt.prototype.convertFrom=function(M){var d=M.clone();return d.red=null,d},s.mont=function(M){return new G(M)},n(G,nt),G.prototype.convertTo=function(M){return this.imod(M.ushln(this.shift))},G.prototype.convertFrom=function(M){var d=this.imod(M.mul(this.rinv));return d.red=null,d},G.prototype.imul=function(M,d){if(M.isZero()||d.isZero())return M.words[0]=0,M.length=1,M;var o=M.imul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.mul=function(M,d){if(M.isZero()||d.isZero())return new s(0)._forceRed(this);var o=M.mul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.invm=function(M){return this.imod(M._invmp(this.m).mul(this.r2))._forceRed(this)}})(0,ho);var US=Cv.exports,Z8=ES(US),Tv={exports:{}};(function(r,t){var e=Vr,n=e.Buffer;function s(c,l){for(var p in c)l[p]=c[p]}function i(c,l,p){return n(c,l,p)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=e:(s(e,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(c,l,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,p)},i.alloc=function(c,l,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var m=n(c);return l!==void 0?typeof p=="string"?m.fill(l,p):m.fill(l):m.fill(0),m},i.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},i.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(c)}})(Tv,Tv.exports);var B0=Tv.exports.Buffer,NS=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(A);_[E];){var P=t[_.charCodeAt(E)];if(P===255)return;for(var R=0,C=A-1;(P!==0||R>>0,B[C]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=R,E++}for(var O=A-x;O!==A&&B[O]===0;)O++;var z=B0.allocUnsafe(w+(A-O));z.fill(0,0,w);for(var H=w;O!==A;)z[H++]=B[O++];return z}return{encode:function(_){if((Array.isArray(_)||_ instanceof Uint8Array)&&(_=B0.from(_)),!B0.isBuffer(_))throw new TypeError("Expected Buffer");if(_.length===0)return"";for(var E=0,w=0,x=0,A=_.length;x!==A&&_[x]===0;)x++,E++;for(var B=(A-x)*m+1>>>0,P=new Uint8Array(B);x!==A;){for(var R=_[x],C=0,O=B-1;(R!==0||C>>0,P[O]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=C,x++}for(var z=B-w;z!==B&&P[z]===0;)z++;for(var H=l.repeat(E);zr&t^r&e^t&e,oV=new Uint32Array([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]),qs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Fs=new Uint32Array(64);class sV extends PS{constructor(){super(64,32,8,!1),this.A=0|qs[0],this.B=0|qs[1],this.C=0|qs[2],this.D=0|qs[3],this.E=0|qs[4],this.F=0|qs[5],this.G=0|qs[6],this.H=0|qs[7]}get(){const{A:t,B:e,C:n,D:s,E:i,F:c,G:l,H:p}=this;return[t,e,n,s,i,c,l,p]}set(t,e,n,s,i,c,l,p){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|s,this.E=0|i,this.F=0|c,this.G=0|l,this.H=0|p}process(t,e){for(let E=0;E<16;E++,e+=4)Fs[E]=t.getUint32(e,!1);for(let E=16;E<64;E++){const w=Fs[E-15],x=Fs[E-2],A=_o(w,7)^_o(w,18)^w>>>3,B=_o(x,17)^_o(x,19)^x>>>10;Fs[E]=B+Fs[E-7]+A+Fs[E-16]|0}let{A:n,B:s,C:i,D:c,E:l,F:p,G:m,H:v}=this;for(let E=0;E<64;E++){const w=v+(_o(l,6)^_o(l,11)^_o(l,25))+((_=l)&p^~_&m)+oV[E]+Fs[E]|0,x=(_o(n,2)^_o(n,13)^_o(n,22))+iV(n,s,i)|0;v=m,m=p,p=l,l=c+w|0,c=i,i=s,s=n,n=w+x|0}var _;n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,c=c+this.D|0,l=l+this.E|0,p=p+this.F|0,m=m+this.G|0,v=v+this.H|0,this.set(n,s,i,c,l,p,m,v)}roundClean(){Fs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Lv=IS(()=>new sV);var Tn={};function Ms(r,t,e){return t<=r&&r<=e}function Ol(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function Ov(r){this.tokens=[].slice.call(r)}Ov.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var Cu=-1;function _m(r,t){if(r)throw TypeError("Decoder error");return t||65533}var Ul="utf-8";function Nl(r,t){if(!(this instanceof Nl))return new Nl(r,t);if((r=r!==void 0?String(r).toLowerCase():Ul)!==Ul)throw new Error("Encoding not supported. Only utf-8 is supported");t=Ol(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Dl(r,t){if(!(this instanceof Dl))return new Dl(r,t);if((r=r!==void 0?String(r).toLowerCase():Ul)!==Ul)throw new Error("Encoding not supported. Only utf-8 is supported");t=Ol(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function aV(r){var t=r.fatal,e=0,n=0,s=0,i=128,c=191;this.handler=function(l,p){if(p===-1&&s!==0)return s=0,_m(t);if(p===-1)return Cu;if(s===0){if(Ms(p,0,127))return p;if(Ms(p,194,223))s=1,e=p-192;else if(Ms(p,224,239))p===224&&(i=160),p===237&&(c=159),s=2,e=p-224;else{if(!Ms(p,240,244))return _m(t);p===240&&(i=144),p===244&&(c=143),s=3,e=p-240}return e<<=6*s,null}if(!Ms(p,i,c))return e=s=n=0,i=128,c=191,l.prepend(p),_m(t);if(i=128,c=191,e+=p-128<<6*(s-(n+=1)),n!==s)return null;var m=e;return e=s=n=0,m}}function uV(r){r.fatal,this.handler=function(t,e){if(e===-1)return Cu;if(Ms(e,0,127))return e;var n,s;Ms(e,128,2047)?(n=1,s=192):Ms(e,2048,65535)?(n=2,s=224):Ms(e,65536,1114111)&&(n=3,s=240);for(var i=[(e>>6*n)+s];n>0;){var c=e>>6*(n-1);i.push(128|63&c),n-=1}return i}}Nl.prototype={decode:function(r,t){var e;e=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),t=Ol(t),this._streaming||(this._decoder=new aV({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var n,s=new Ov(e),i=[];!s.endOfStream()&&(n=this._decoder.handler(s,s.read()))!==Cu;)n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n));if(!this._streaming){do{if((n=this._decoder.handler(s,s.read()))===Cu)break;n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n))}while(!s.endOfStream());this._decoder=null}return i.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0)),function(c){for(var l="",p=0;p>10),56320+(1023&m)))}return l}(i)}},Dl.prototype={encode:function(r,t){r=r?String(r):"",t=Ol(t),this._streaming||(this._encoder=new uV(this._options)),this._streaming=!!t.stream;for(var e,n=[],s=new Ov(function(i){for(var c=String(i),l=c.length,p=0,m=[];p57343)m.push(v);else if(56320<=v&&v<=57343)m.push(65533);else if(55296<=v&&v<=56319)if(p===l-1)m.push(65533);else{var _=i.charCodeAt(p+1);if(56320<=_&&_<=57343){var E=1023&v,w=1023&_;m.push(65536+(E<<10)+w),p+=1}else m.push(65533)}p+=1}return m}(r));!s.endOfStream()&&(e=this._encoder.handler(s,s.read()))!==Cu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);if(!this._streaming){for(;(e=this._encoder.handler(s,s.read()))!==Cu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);this._encoder=null}return new Uint8Array(n)}};var fV=Wy(Object.freeze({__proto__:null,TextEncoder:Dl,TextDecoder:Nl})),cV=ho&&ho.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),hV=ho&&ho.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Mo=ho&&ho.__decorate||function(r,t,e,n){var s,i=arguments.length,c=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,t,e,n);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(c=(i<3?s(c):i>3?s(t,e,c):s(t,e))||c);return i>3&&c&&Object.defineProperty(t,e,c),c},lV=ho&&ho.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&cV(t,r,e);return hV(t,r),t},DS=ho&&ho.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Tn,"__esModule",{value:!0});var zS=Tn.deserializeUnchecked=$S=Tn.deserialize=KS=Tn.serialize=Tn.BinaryReader=Tn.BinaryWriter=Tn.BorshError=Tn.baseDecode=Tn.baseEncode=void 0;const Zs=DS(US),G8=DS(NS),dV=lV(fV),pV=new(typeof TextDecoder!="function"?dV.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Tn.baseEncode=function(r){return typeof r=="string"&&(r=Zt.Buffer.from(r,"utf8")),G8.default.encode(Zt.Buffer.from(r))},Tn.baseDecode=function(r){return Zt.Buffer.from(G8.default.decode(r))};const Mm=1024;class Qn extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Tn.BorshError=Qn;class qS{constructor(){this.buf=Zt.Buffer.alloc(Mm),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Zt.Buffer.concat([this.buf,Zt.Buffer.alloc(Mm)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Zt.Buffer.concat([Zt.Buffer.from(this.buf.subarray(0,this.length)),t,Zt.Buffer.alloc(Mm)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Zt.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Zt.Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}}function Eo(r,t,e){const n=e.value;e.value=function(...s){try{return n.apply(this,s)}catch(i){if(i instanceof RangeError){const c=i.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new Qn("Reached the end of buffer when deserializing")}throw i}}}Tn.BinaryWriter=qS;class yi{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new Zs.default(t,"le")}readU128(){const t=this.readBuffer(16);return new Zs.default(t,"le")}readU256(){const t=this.readBuffer(32);return new Zs.default(t,"le")}readU512(){const t=this.readBuffer(64);return new Zs.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Qn(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return pV.decode(e)}catch(n){throw new Qn(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let s=0;s{Sa(r,t,i,n[0],s)});else if(n.kind!==void 0)switch(n.kind){case"option":e==null?s.writeU8(0):(s.writeU8(1),Sa(r,t,e,n.type,s));break;case"map":s.writeU32(e.size),e.forEach((i,c)=>{Sa(r,t,c,n.key,s),Sa(r,t,i,n.value,s)});break;default:throw new Qn(`FieldType ${n} unrecognized`)}else jS(r,e,s)}catch(i){throw i instanceof Qn&&i.addToFieldPath(t),i}}function jS(r,t,e){if(typeof t.borshSerialize=="function")return void t.borshSerialize(e);const n=r.get(t.constructor);if(!n)throw new Qn(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([s,i])=>{Sa(r,s,t[s],i,e)});else{if(n.kind!=="enum")throw new Qn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const s=t[n.field];for(let i=0;ika(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?ka(r,t,e.type,n):void 0;if(e.kind==="map"){let s=new Map;const i=n.readU32();for(let c=0;c=n.values.length)throw new Qn(`Enum index: ${s} is out of range`);const[i,c]=n.values[s];return new t({[i]:ka(r,i,c,e)})}throw new Qn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var $S=Tn.deserialize=function(r,t,e,n=yi){const s=new n(e),i=Jy(r,t,s);if(s.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function tb(r,t){return t.property?r+"["+t.property+"]":r}Vt.Layout=Lr,Vt.nameWithProperty=tb,Vt.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Lr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};class ii extends Lr{isCount(){throw new Error("ExternalLayout is abstract")}}Vt.ExternalLayout=ii;class HS extends ii{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){Nf(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}Vt.GreedyCount=HS;class eb extends ii{constructor(t,e=0,n){if(!(t instanceof Lr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Ki||this.layout instanceof ao}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}Vt.OffsetLayout=eb;class Ki extends Lr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ii&&this.count.encode(t.length,e,n),i}}Vt.Sequence=tk;class ek extends Lr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Lr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){Nf(t);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}Vt.Structure=ek;class rb{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}Vt.UnionDiscriminator=rb;class zl extends rb{constructor(t,e){if(!(t instanceof ii&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}Vt.UnionLayoutDiscriminator=zl;class nb extends Lr{constructor(t,e,n){let s;if(t instanceof Ki||t instanceof ao)s=new zl(new eb(t));else if(t instanceof ii&&t.isCount())s=new zl(t);else{if(!(t instanceof rb))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");s=t}if(e===void 0&&(e=null),!(e===null||e instanceof Lr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof Ki||t instanceof ao)&&(i+=s.layout.span)),super(i,n),this.discriminator=s,this.usesPrefixDiscriminator=t instanceof Ki||t instanceof ao,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const s=this.discriminator,i=s.decode(t,e),c=this.registry[i];if(c===void 0){const l=this.defaultLayout;let p=0;this.usesPrefixDiscriminator&&(p=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[l.property]=l.decode(t,e+p)}else n=c.decode(t,e);return n}encode(t,e,n=0){const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new rk(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}Vt.Union=nb;class rk extends Lr{constructor(t,e,n,s){if(!(t instanceof nb))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Lr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let s=0;return this.layout&&(s=this.layout.getSpan(t,e+n)),n+s}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Pu(r){return 0>r&&(r+=4294967296),r}Vt.VariantLayout=rk;class ib extends Lr{constructor(t,e,n){if(!(t instanceof Ki||t instanceof ao))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Pu(t&this.valueMask))throw new TypeError(tb("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Pu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),Mr(t).slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ii&&(s=t.length),!(t instanceof Uint8Array&&s===t.length))throw new TypeError(tb("Blob.encode",this)+" requires (length "+s+") Uint8Array as src");if(n+s>e.length)throw new RangeError("encoding overruns Uint8Array");const i=Mr(t);return Mr(e).write(i.toString("hex"),n,s,"hex"),this.length instanceof ii&&this.length.encode(s,e,n),s}}Vt.Blob=ik;class ok extends Lr{constructor(t){super(-1,t)}getSpan(t,e=0){Nf(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const c=Mr(e);return s.copy(c,n),c[n+i]=0,i+1}}Vt.CString=ok;class sk extends Lr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return Nf(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(Mr(e),n),i}}Vt.UTF8=sk;class ak extends Lr{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}Vt.Constant=ak,Vt.greedy=(r,t)=>new HS(r,t);var Va=Vt.offset=(r,t,e)=>new eb(r,t,e),cn=Vt.u8=r=>new Ki(1,r),Ti=Vt.u16=r=>new Ki(2,r);Vt.u24=r=>new Ki(3,r);var Ke=Vt.u32=r=>new Ki(4,r);Vt.u40=r=>new Ki(5,r),Vt.u48=r=>new Ki(6,r);var Bn=Vt.nu64=r=>new VS(r);Vt.u16be=r=>new ao(2,r),Vt.u24be=r=>new ao(3,r),Vt.u32be=r=>new ao(4,r),Vt.u40be=r=>new ao(5,r),Vt.u48be=r=>new ao(6,r),Vt.nu64be=r=>new ZS(r),Vt.s8=r=>new _a(1,r),Vt.s16=r=>new _a(2,r),Vt.s24=r=>new _a(3,r),Vt.s32=r=>new _a(4,r),Vt.s40=r=>new _a(5,r),Vt.s48=r=>new _a(6,r);var Ei=Vt.ns64=r=>new WS(r);Vt.s16be=r=>new Bu(2,r),Vt.s24be=r=>new Bu(3,r),Vt.s32be=r=>new Bu(4,r),Vt.s40be=r=>new Bu(5,r),Vt.s48be=r=>new Bu(6,r),Vt.ns64be=r=>new GS(r),Vt.f32=r=>new YS(r),Vt.f32be=r=>new XS(r),Vt.f64=r=>new JS(r),Vt.f64be=r=>new QS(r);var je=Vt.struct=(r,t,e)=>new ek(r,t,e);Vt.bits=(r,t,e)=>new ib(r,t,e);var qa=Vt.seq=(r,t,e)=>new tk(r,t,e);Vt.union=(r,t,e)=>new nb(r,t,e),Vt.unionLayoutDiscriminator=(r,t)=>new zl(r,t);var yf=Vt.blob=(r,t)=>new ik(r,t);Vt.cstr=r=>new ok(r),Vt.utf8=(r,t)=>new sk(r,t),Vt.constant=(r,t)=>new ak(r,t);var $h={};Object.defineProperty($h,"__esModule",{value:!0});var mV=$h.toBigIntLE=function(r){{const t=Zt.Buffer.from(r);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};$h.toBigIntBE=function(r){{const t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};var Em,vV=$h.toBufferLE=function(r,t){{const e=r.toString(16),n=Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};$h.toBufferBE=function(r,t){{const e=r.toString(16);return Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex")}};class gV extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function ea(r){return typeof r=="object"&&r!=null}function lo(r){return typeof r=="string"?JSON.stringify(r):""+r}function yV(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+lo(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*Y8(r,t,e,n){var s;ea(s=r)&&typeof s[Symbol.iterator]=="function"||(r=[r]);for(const i of r){const c=yV(i,t,e,n);c&&(yield c)}}function*sb(r,t,e={}){const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&ea(t.schema)&&ea(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=sb(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):ea(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class ts{constructor(t){const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,m)=>Y8(s(p,m),m,this,p):()=>[],this.refiner=i?(p,m)=>Y8(i(p,m),m,this,p):()=>[]}assert(t){return function(e,n){const s=Oc(e,n);if(s[0])throw s[0]}(t,this)}create(t){return Nd(t,this)}is(t){return uk(t,this)}mask(t){return function(e,n){const s=Oc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e={}){return Oc(t,this,e)}}function Nd(r,t){const e=Oc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function uk(r,t){return!Oc(r,t)[0]}function Oc(r,t,e={}){const n=sb(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new gV(s[0],function*(){for(const i of n)i[0]&&(yield i[0])}),void 0]:[void 0,s[1]]}function lu(r,t){return new ts({type:r,schema:null,validator:t})}function Oe(r){return new ts({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+lo(t)})}function Yo(){return lu("boolean",r=>typeof r=="boolean")}function ab(r){return lu("instance",t=>t instanceof r||"Expected a `"+r.name+"` instance, but received: "+lo(t))}function Gr(r){const t=lo(r),e=typeof r;return new ts({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+lo(n)})}function Le(r){return new ts({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function $t(){return lu("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+lo(r))}function He(r){return new ts({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function fk(r,t){return new ts({type:"record",schema:null,*entries(e){if(ea(e))for(const n in e){const s=e[n];yield[n,n,r],yield[n,s,t]}},validator:e=>ea(e)||"Expected an object, but received: "+lo(e)})}function Me(){return lu("string",r=>typeof r=="string"||"Expected a string, but received: "+lo(r))}function ub(r){const t=lu("never",()=>!1);return new ts({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const n=Math.max(r.length,e.length);for(let s=0;sArray.isArray(e)||"Expected an array, but received: "+lo(e)})}function be(r){const t=Object.keys(r);return new ts({type:"type",schema:r,*entries(e){if(ea(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>ea(e)||"Expected an object, but received: "+lo(e)})}function di(r){const t=r.map(e=>e.type).join(" | ");return new ts({type:"union",schema:null,validator(e,n){const s=[];for(const i of r){const[...c]=sb(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+lo(e),...s]}})}function Hh(){return lu("unknown",()=>!0)}function Vh(r,t,e){return new ts({...r,coercer:(n,s)=>uk(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}var bV=new Uint8Array(16);function X8(){if(!Em&&!(Em=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Em(bV)}var wV=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ql(r){return typeof r=="string"&&wV.test(r)}for(var J8,Am,kn=[],Sm=0;Sm<256;++Sm)kn.push((Sm+256).toString(16).substr(1));function ol(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(kn[r[t+0]]+kn[r[t+1]]+kn[r[t+2]]+kn[r[t+3]]+"-"+kn[r[t+4]]+kn[r[t+5]]+"-"+kn[r[t+6]]+kn[r[t+7]]+"-"+kn[r[t+8]]+kn[r[t+9]]+"-"+kn[r[t+10]]+kn[r[t+11]]+kn[r[t+12]]+kn[r[t+13]]+kn[r[t+14]]+kn[r[t+15]]).toLowerCase();if(!ql(e))throw TypeError("Stringified UUID is invalid");return e}var km=0,Im=0;function ck(r){if(!ql(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=255&t,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=255&t,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=255&t,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=255&t,e}function hk(r,t,e){function n(s,i,c,l){if(typeof s=="string"&&(s=function(v){v=unescape(encodeURIComponent(v));for(var _=[],E=0;E>>9<<4)+1}function Ws(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e}function Dd(r,t,e,n,s,i){return Ws((c=Ws(Ws(t,r),Ws(n,i)))<<(l=s)|c>>>32-l,e);var c,l}function Zn(r,t,e,n,s,i,c){return Dd(t&e|~t&n,r,t,s,i,c)}function Wn(r,t,e,n,s,i,c){return Dd(t&n|e&~n,r,t,s,i,c)}function Gn(r,t,e,n,s,i,c){return Dd(t^e^n,r,t,s,i,c)}function Yn(r,t,e,n,s,i,c){return Dd(e^(t|~n),r,t,s,i,c)}var xV=hk("v3",48,function(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>l%32&255,m=parseInt(c.charAt(p>>>4&15)+c.charAt(15&p),16);s.push(m)}return s}(function(n,s){n[s>>5]|=128<>5]|=(255&n[c/8])<>>32-t}var EV=hk("v5",80,function(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s>>0;C=R,R=P,P=Bm(B,30)>>>0,B=A,A=H}e[0]=e[0]+A>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+P>>>0,e[3]=e[3]+R>>>0,e[4]=e[4]+C>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}),AV=EV,SV=Object.freeze({__proto__:null,v1:function(r,t,e){var n=t&&e||0,s=t||new Array(16),i=(r=r||{}).node||J8,c=r.clockseq!==void 0?r.clockseq:Am;if(i==null||c==null){var l=r.random||(r.rng||X8)();i==null&&(i=J8=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),c==null&&(c=Am=16383&(l[6]<<8|l[7]))}var p=r.msecs!==void 0?r.msecs:Date.now(),m=r.nsecs!==void 0?r.nsecs:Im+1,v=p-km+(m-Im)/1e4;if(v<0&&r.clockseq===void 0&&(c=c+1&16383),(v<0||p>km)&&r.nsecs===void 0&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");km=p,Im=m,Am=c;var _=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;s[n++]=_>>>24&255,s[n++]=_>>>16&255,s[n++]=_>>>8&255,s[n++]=255&_;var E=p/4294967296*1e4&268435455;s[n++]=E>>>8&255,s[n++]=255&E,s[n++]=E>>>24&15|16,s[n++]=E>>>16&255,s[n++]=c>>>8|128,s[n++]=255&c;for(var w=0;w<6;++w)s[n+w]=i[w];return t||ol(s)},v3:_V,v4:function(r,t,e){var n=(r=r||{}).random||(r.rng||X8)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=n[s];return t}return ol(n)},v5:AV,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!ql(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:ql,stringify:ol,parse:ck}),tx=Wy(SV);tx.v4,tx.v4;var P0,lk={exports:{}};(P0=lk).exports=function(r){return r&&r.__esModule?r:{default:r}},P0.exports.__esModule=!0,P0.exports.default=P0.exports;var ex,rx,Pm,nx,ix=lk.exports,ox={exports:{}},sx={exports:{}};function lh(){return ex||(ex=1,function(r){function t(e){return r.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(sx)),sx.exports}var ax,ux,fx={exports:{}},cx={exports:{}};function hx(){return ux||(ux=1,function(r){r.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(cx)),cx.exports}var lx,dx,px,mx={exports:{}},vx={exports:{}},gx={exports:{}};function kV(){return dx||(dx=1,function(r){var t=lh().default,e=(lx||(lx=1,function(n){var s=lh().default;n.exports=function(i,c){if(s(i)!=="object"||i===null)return i;var l=i[Symbol.toPrimitive];if(l!==void 0){var p=l.call(i,c||"default");if(s(p)!=="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(i)},n.exports.__esModule=!0,n.exports.default=n.exports}(gx)),gx.exports);r.exports=function(n){var s=e(n,"string");return t(s)==="symbol"?s:String(s)},r.exports.__esModule=!0,r.exports.default=r.exports}(vx)),vx.exports}function yx(){return px||(px=1,function(r){var t=kV();function e(n,s){for(var i=0;i=0;--kt){var k=this.tryEntries[kt],T=k.completion;if(k.tryLoc==="root")return Tt("end");if(k.tryLoc<=this.prev){var L=C.call(k,"catchLoc"),j=C.call(k,"finallyLoc");if(L&&j){if(this.prev=0;--Tt){var kt=this.tryEntries[Tt];if(kt.tryLoc<=this.prev&&C.call(kt,"finallyLoc")&&this.prev=0;--ct){var Tt=this.tryEntries[ct];if(Tt.finallyLoc===lt)return this.complete(Tt.completion,Tt.afterLoc),yt(Tt),g}},catch:function(lt){for(var ct=this.tryEntries.length-1;ct>=0;--ct){var Tt=this.tryEntries[ct];if(Tt.tryLoc===lt){var kt=Tt.completion;if(kt.type==="throw"){var k=kt.arg;yt(Tt)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(lt,ct,Tt){return this.delegate={iterator:Ft(lt),resultName:ct,nextLoc:Tt},this.method==="next"&&(this.arg=B),g}},P}w.exports=A,w.exports.__esModule=!0,w.exports.default=w.exports}(ox)),ox.exports)();Pm=E;try{regeneratorRuntime=E}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=E:Function("r","regeneratorRuntime = r")(E)}return Pm}()),n=t((ax||(ax=1,function(E){function w(x,A,B,P,R,C,O){try{var z=x[C](O),H=z.value}catch(tt){return void B(tt)}z.done?A(H):Promise.resolve(H).then(P,R)}E.exports=function(x){return function(){var A=this,B=arguments;return new Promise(function(P,R){var C=x.apply(A,B);function O(H){w(C,P,R,O,z,"next",H)}function z(H){w(C,P,R,O,z,"throw",H)}O(void 0)})}},E.exports.__esModule=!0,E.exports.default=E.exports}(fx)),fx.exports)),s=t(lh()),i=t(hx()),c=t(yx()),l=t(Mx()),p=t(Ix()),m=t(Rx());function v(E){var w=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var x,A=(0,m.default)(E);if(w){var B=(0,m.default)(this).constructor;x=Reflect.construct(A,arguments,B)}else x=A.apply(this,arguments);return(0,p.default)(this,x)}}var _=function(E){(0,l.default)(R,E);var w,x,A,B,P=v(R);function R(C){var O,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},tt=arguments.length>3?arguments[3]:void 0;(0,i.default)(this,R);var nt=H.autoconnect,G=nt===void 0||nt,M=H.reconnect,d=M===void 0||M,o=H.reconnect_interval,a=o===void 0?1e3:o,f=H.max_reconnects,h=f===void 0?5:f,g=function(S,I){var y={};for(var u in S)Object.prototype.hasOwnProperty.call(S,u)&&I.indexOf(u)<0&&(y[u]=S[u]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function"){var b=0;for(u=Object.getOwnPropertySymbols(S);bz.current_reconnects||z.max_reconnects===0)&&(z.reconnect_timer_id=setTimeout(function(){return z._connect(C,O)},z.reconnect_interval)))})}}]),R}(Lx().EventEmitter);r.default=_})({}),function(r){var t=ix;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(m,v){return new p(m,v)};var e=t(hx()),n=t(yx()),s=t(Mx()),i=t(Ix()),c=t(Rx());function l(m){var v=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,E=(0,c.default)(m);if(v){var w=(0,c.default)(this).constructor;_=Reflect.construct(E,arguments,w)}else _=E.apply(this,arguments);return(0,i.default)(this,_)}}var p=function(m){(0,s.default)(_,m);var v=l(_);function _(E,w,x){var A;return(0,e.default)(this,_),(A=v.call(this)).socket=new window.WebSocket(E,x),A.socket.onopen=function(){return A.emit("open")},A.socket.onmessage=function(B){return A.emit("message",B.data)},A.socket.onerror=function(B){return A.emit("error",B)},A.socket.onclose=function(B){A.emit("close",B.code,B.reason)},A}return(0,n.default)(_,[{key:"send",value:function(E,w,x){var A=x||w;try{this.socket.send(E),A()}catch(B){A(B)}}},{key:"close",value:function(E,w){this.socket.close(E,w)}},{key:"addEventListener",value:function(E,w,x){this.socket.addEventListener(E,w,x)}}]),_}(Lx().EventEmitter)}({});const{bytesToNumberBE:IV,hexToBytes:BV}=KH,Fa={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:t}=Fa;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");const e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:IV(n),l:r.subarray(e+2)}},toSig(r){const{Err:t}=Fa,e=typeof r=="string"?BV(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=Fa._parseInt(e.subarray(2)),{d:c,l}=Fa._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:c}},hexFromSig(r){const t=m=>8&Number.parseInt(m[0],16)?"00"+m:m,e=m=>{const v=m.toString(16);return 1&v.length?`0${v}`:v},n=t(e(r.s)),s=t(e(r.r)),i=n.length/2,c=s.length/2,l=e(i),p=e(c);return`30${e(c+i+4)}02${p}${s}02${l}${n}`}},os=BigInt(0),Ci=BigInt(1);BigInt(2);const Ox=BigInt(3);function PV(r){const t=function(G){const M=Bv(G);return gf(M,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...M})}(r),{Fp:e,n}=t,s=e.BYTES+1,i=2*e.BYTES+1;function c(G){return $r(G,n)}function l(G){return Iv(G,n)}const{ProjectivePoint:p,normPrivateKeyToScalar:m,weierstrassEquation:v,isWithinCurveOrder:_}=function(G){const M=function(Z){const F=Bv(Z);gf(F,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:q,Fp:it,a:at}=F;if(q){if(!it.eql(at,it.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof q!="object"||typeof q.beta!="bigint"||typeof q.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...F})}(G),{Fp:d}=M,o=M.toBytes||((Z,F,q)=>{const it=F.toAffine();return Ha(Uint8Array.from([4]),d.toBytes(it.x),d.toBytes(it.y))}),a=M.fromBytes||(Z=>{const F=Z.subarray(1);return{x:d.fromBytes(F.subarray(0,d.BYTES)),y:d.fromBytes(F.subarray(d.BYTES,2*d.BYTES))}});function f(Z){const{a:F,b:q}=M,it=d.sqr(Z),at=d.mul(it,Z);return d.add(d.add(at,d.mul(Z,F)),q)}if(!d.eql(d.sqr(M.Gy),f(M.Gx)))throw new Error("bad generator point: equation left != right");function h(Z){return typeof Z=="bigint"&&osd.eql(Bt,d.ZERO);return at(q)&&at(it)?u.ZERO:new u(q,it,d.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(F){const q=d.invertBatch(F.map(it=>it.pz));return F.map((it,at)=>it.toAffine(q[at])).map(u.fromAffine)}static fromHex(F){const q=u.fromAffine(a(pn("pointHex",F)));return q.assertValidity(),q}static fromPrivateKey(F){return u.BASE.multiply(S(F))}_setWindowSize(F){this._WINDOW_SIZE=F,I.delete(this)}assertValidity(){if(this.is0()){if(M.allowInfinityPoint&&!d.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:F,y:q}=this.toAffine();if(!d.isValid(F)||!d.isValid(q))throw new Error("bad point: x or y not FE");const it=d.sqr(q),at=f(F);if(!d.eql(it,at))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:F}=this.toAffine();if(d.isOdd)return!d.isOdd(F);throw new Error("Field doesn't support isOdd")}equals(F){y(F);const{px:q,py:it,pz:at}=this,{px:Bt,py:yt,pz:pt}=F,Ft=d.eql(d.mul(q,pt),d.mul(Bt,at)),lt=d.eql(d.mul(it,pt),d.mul(yt,at));return Ft&<}negate(){return new u(this.px,d.neg(this.py),this.pz)}double(){const{a:F,b:q}=M,it=d.mul(q,Ox),{px:at,py:Bt,pz:yt}=this;let pt=d.ZERO,Ft=d.ZERO,lt=d.ZERO,ct=d.mul(at,at),Tt=d.mul(Bt,Bt),kt=d.mul(yt,yt),k=d.mul(at,Bt);return k=d.add(k,k),lt=d.mul(at,yt),lt=d.add(lt,lt),pt=d.mul(F,lt),Ft=d.mul(it,kt),Ft=d.add(pt,Ft),pt=d.sub(Tt,Ft),Ft=d.add(Tt,Ft),Ft=d.mul(pt,Ft),pt=d.mul(k,pt),lt=d.mul(it,lt),kt=d.mul(F,kt),k=d.sub(ct,kt),k=d.mul(F,k),k=d.add(k,lt),lt=d.add(ct,ct),ct=d.add(lt,ct),ct=d.add(ct,kt),ct=d.mul(ct,k),Ft=d.add(Ft,ct),kt=d.mul(Bt,yt),kt=d.add(kt,kt),ct=d.mul(kt,k),pt=d.sub(pt,ct),lt=d.mul(kt,Tt),lt=d.add(lt,lt),lt=d.add(lt,lt),new u(pt,Ft,lt)}add(F){y(F);const{px:q,py:it,pz:at}=this,{px:Bt,py:yt,pz:pt}=F;let Ft=d.ZERO,lt=d.ZERO,ct=d.ZERO;const Tt=M.a,kt=d.mul(M.b,Ox);let k=d.mul(q,Bt),T=d.mul(it,yt),L=d.mul(at,pt),j=d.add(q,it),rt=d.add(Bt,yt);j=d.mul(j,rt),rt=d.add(k,T),j=d.sub(j,rt),rt=d.add(q,at);let Q=d.add(Bt,pt);return rt=d.mul(rt,Q),Q=d.add(k,L),rt=d.sub(rt,Q),Q=d.add(it,at),Ft=d.add(yt,pt),Q=d.mul(Q,Ft),Ft=d.add(T,L),Q=d.sub(Q,Ft),ct=d.mul(Tt,rt),Ft=d.mul(kt,L),ct=d.add(Ft,ct),Ft=d.sub(T,ct),ct=d.add(T,ct),lt=d.mul(Ft,ct),T=d.add(k,k),T=d.add(T,k),L=d.mul(Tt,L),rt=d.mul(kt,rt),T=d.add(T,L),L=d.sub(k,L),L=d.mul(Tt,L),rt=d.add(rt,L),k=d.mul(T,rt),lt=d.add(lt,k),k=d.mul(Q,rt),Ft=d.mul(j,Ft),Ft=d.sub(Ft,k),k=d.mul(j,T),ct=d.mul(Q,ct),ct=d.add(ct,k),new u(Ft,lt,ct)}subtract(F){return this.add(F.negate())}is0(){return this.equals(u.ZERO)}wNAF(F){return D.wNAFCached(this,I,F,q=>{const it=d.invertBatch(q.map(at=>at.pz));return q.map((at,Bt)=>at.toAffine(it[Bt])).map(u.fromAffine)})}multiplyUnsafe(F){const q=u.ZERO;if(F===os)return q;if(g(F),F===Ci)return this;const{endo:it}=M;if(!it)return D.unsafeLadder(this,F);let{k1neg:at,k1:Bt,k2neg:yt,k2:pt}=it.splitScalar(F),Ft=q,lt=q,ct=this;for(;Bt>os||pt>os;)Bt&Ci&&(Ft=Ft.add(ct)),pt&Ci&&(lt=lt.add(ct)),ct=ct.double(),Bt>>=Ci,pt>>=Ci;return at&&(Ft=Ft.negate()),yt&&(lt=lt.negate()),lt=new u(d.mul(lt.px,it.beta),lt.py,lt.pz),Ft.add(lt)}multiply(F){g(F);let q,it,at=F;const{endo:Bt}=M;if(Bt){const{k1neg:yt,k1:pt,k2neg:Ft,k2:lt}=Bt.splitScalar(at);let{p:ct,f:Tt}=this.wNAF(pt),{p:kt,f:k}=this.wNAF(lt);ct=D.constTimeNegate(yt,ct),kt=D.constTimeNegate(Ft,kt),kt=new u(d.mul(kt.px,Bt.beta),kt.py,kt.pz),q=ct.add(kt),it=Tt.add(k)}else{const{p:yt,f:pt}=this.wNAF(at);q=yt,it=pt}return u.normalizeZ([q,it])[0]}multiplyAndAddUnsafe(F,q,it){const at=u.BASE,Bt=(pt,Ft)=>Ft!==os&&Ft!==Ci&&pt.equals(at)?pt.multiply(Ft):pt.multiplyUnsafe(Ft),yt=Bt(this,q).add(Bt(F,it));return yt.is0()?void 0:yt}toAffine(F){const{px:q,py:it,pz:at}=this,Bt=this.is0();F==null&&(F=Bt?d.ONE:d.inv(at));const yt=d.mul(q,F),pt=d.mul(it,F),Ft=d.mul(at,F);if(Bt)return{x:d.ZERO,y:d.ZERO};if(!d.eql(Ft,d.ONE))throw new Error("invZ was invalid");return{x:yt,y:pt}}isTorsionFree(){const{h:F,isTorsionFree:q}=M;if(F===Ci)return!0;if(q)return q(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:F,clearCofactor:q}=M;return F===Ci?this:q?q(u,this):this.multiplyUnsafe(M.h)}toRawBytes(F=!0){return this.assertValidity(),o(u,this,F)}toHex(F=!0){return $a(this.toRawBytes(F))}}u.BASE=new u(M.Gx,M.Gy,d.ONE),u.ZERO=new u(d.ZERO,d.ONE,d.ZERO);const b=M.nBitLength,D=OS(u,M.endo?Math.ceil(b/2):b);return{CURVE:M,ProjectivePoint:u,normPrivateKeyToScalar:S,weierstrassEquation:f,isWithinCurveOrder:h}}({...t,toBytes(G,M,d){const o=M.toAffine(),a=e.toBytes(o.x),f=Ha;return d?f(Uint8Array.from([M.hasEvenY()?2:3]),a):f(Uint8Array.from([4]),a,e.toBytes(o.y))},fromBytes(G){const M=G.length,d=G[0],o=G.subarray(1);if(M!==s||d!==2&&d!==3){if(M===i&&d===4)return{x:e.fromBytes(o.subarray(0,e.BYTES)),y:e.fromBytes(o.subarray(e.BYTES,2*e.BYTES))};throw new Error(`Point of length ${M} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const f=Aa(o);if(!(os<(a=f)&&a$a(Ju(G,t.nByteLength));function w(G){return G>n>>Ci}const x=(G,M,d)=>Aa(G.slice(M,d));class A{constructor(M,d,o){this.r=M,this.s=d,this.recovery=o,this.assertValidity()}static fromCompact(M){const d=t.nByteLength;return M=pn("compactSignature",M,2*d),new A(x(M,0,d),x(M,d,2*d))}static fromDER(M){const{r:d,s:o}=Fa.toSig(pn("DER",M));return new A(d,o)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(M){return new A(this.r,this.s,M)}recoverPublicKey(M){const{r:d,s:o,recovery:a}=this,f=C(pn("msgHash",M));if(a==null||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const h=a===2||a===3?d+t.n:d;if(h>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const g=1&a?"03":"02",S=p.fromHex(g+E(h)),I=l(h),y=c(-f*I),u=c(o*I),b=p.BASE.multiplyAndAddUnsafe(S,y,u);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return vf(this.toDERHex())}toDERHex(){return Fa.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return vf(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const B={isValidPrivateKey(G){try{return m(G),!0}catch{return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const G=K8(t.n);return function(M,d,o=!1){const a=M.length,f=LS(d),h=K8(d);if(a<16||a1024)throw new Error(`expected ${h}-1024 bytes of input, got ${a}`);const g=$r(o?Aa(M):Xu(M),d-Hr)+Hr;return o?hh(g,f):Ju(g,f)}(t.randomBytes(G),t.n)},precompute:(G=8,M=p.BASE)=>(M._setWindowSize(G),M.multiply(BigInt(3)),M)};function P(G){const M=G instanceof Uint8Array,d=typeof G=="string",o=(M||d)&&G.length;return M?o===s||o===i:d?o===2*s||o===2*i:G instanceof p}const R=t.bits2int||function(G){const M=Aa(G),d=8*G.length-t.nBitLength;return d>0?M>>BigInt(d):M},C=t.bits2int_modN||function(G){return c(R(G))},O=Xy(t.nBitLength);function z(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!(os<=G&&GD in d))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:a}=t;let{lowS:f,prehash:h,extraEntropy:g}=d;f==null&&(f=!0),G=pn("msgHash",G),h&&(G=pn("prehashed msgHash",o(G)));const S=C(G),I=m(M),y=[z(I),z(S)];if(g!=null){const D=g===!0?a(e.BYTES):g;y.push(pn("extraEntropy",D))}const u=Ha(...y),b=S;return{seed:u,k2sig:function(D){const Z=R(D);if(!_(Z))return;const F=l(Z),q=p.BASE.multiply(Z).toAffine(),it=c(q.x);if(it===os)return;const at=c(F*c(b+it*I));if(at===os)return;let Bt=(q.x===it?0:2)|Number(q.y&Ci),yt=at;return f&&w(at)&&(yt=function(pt){return w(pt)?c(-pt):pt}(at),Bt^=1),new A(it,yt,Bt)}}}const tt={lowS:t.lowS,prehash:!1},nt={lowS:t.lowS,prehash:!1};return p.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(G,M=!0){return p.fromPrivateKey(G).toRawBytes(M)},getSharedSecret:function(G,M,d=!0){if(P(G))throw new Error("first arg must be private key");if(!P(M))throw new Error("second arg must be public key");return p.fromHex(M).multiply(m(G)).toRawBytes(d)},sign:function(G,M,d=tt){const{seed:o,k2sig:a}=H(G,M,d),f=t;return RS(f.hash.outputLen,f.nByteLength,f.hmac)(o,a)},verify:function(G,M,d,o=nt){var q;const a=G;if(M=pn("msgHash",M),d=pn("publicKey",d),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:f,prehash:h}=o;let g,S;try{if(typeof a=="string"||a instanceof Uint8Array)try{g=A.fromDER(a)}catch(it){if(!(it instanceof Fa.Err))throw it;g=A.fromCompact(a)}else{if(typeof a!="object"||typeof a.r!="bigint"||typeof a.s!="bigint")throw new Error("PARSE");{const{r:it,s:at}=a;g=new A(it,at)}}S=p.fromHex(d)}catch(it){if(it.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(f&&g.hasHighS())return!1;h&&(M=t.hash(M));const{r:I,s:y}=g,u=C(M),b=l(y),D=c(u*b),Z=c(I*b),F=(q=p.BASE.multiplyAndAddUnsafe(S,D,Z))==null?void 0:q.toAffine();return!!F&&c(F.x)===I},ProjectivePoint:p,Signature:A,utils:B}}BigInt(4);class dk extends kS{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");U8(c.outputLen),U8(c.blockLen)}(t);const n=Gy(e);if(this.iHash=t.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(n.length>s?t.create().update(n).digest():n);for(let c=0;cnew dk(r,t).update(e).digest();function RV(r){return{hash:r,hmac:(t,...e)=>pk(r,t,function(...n){const s=new Uint8Array(n.reduce((c,l)=>c+l.length,0));let i=0;return n.forEach(c=>{if(!SS(c))throw new Error("Uint8Array expected");s.set(c,i),i+=c.length}),s}(...e)),randomBytes:BS}}pk.create=(r,t)=>new dk(r,t);const Ux=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Nx=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),CV=BigInt(1),Nv=BigInt(2),Dx=(r,t)=>(r+t/Nv)/t,Dv=TS(Ux,void 0,void 0,{sqrt:function(r){const t=Ux,e=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),c=BigInt(23),l=BigInt(44),p=BigInt(88),m=r*r*r%t,v=m*m*r%t,_=rn(v,e,t)*v%t,E=rn(_,e,t)*v%t,w=rn(E,Nv,t)*m%t,x=rn(w,s,t)*w%t,A=rn(x,i,t)*x%t,B=rn(A,l,t)*A%t,P=rn(B,p,t)*B%t,R=rn(P,l,t)*A%t,C=rn(R,e,t)*v%t,O=rn(C,c,t)*x%t,z=rn(O,n,t)*m%t,H=rn(z,Nv,t);if(!Dv.eql(Dv.sqr(H),r))throw new Error("Cannot find square root");return H}}),zv=function(r,t){const e=n=>PV({...r,...RV(n)});return Object.freeze({...e(t),create:e})}({a:BigInt(0),b:BigInt(7),Fp:Dv,n:Nx,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const t=Nx,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-CV*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),l=Dx(i*r,t),p=Dx(-n*r,t);let m=$r(r-l*e-p*s,t),v=$r(-l*n-p*i,t);const _=m>c,E=v>c;if(_&&(m=t-m),E&&(v=t-v),m>c||v>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:_,k1:m,k2neg:E,k2:v}}}},Lv);function zx(r){try{return eV.ExtendedPoint.fromHex(r),!0}catch{return!1}}BigInt(0),zv.ProjectivePoint;const TV=r=>Vr.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Vr.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Vr.Buffer.from(r);class LV{constructor(t){Object.assign(this,t)}encode(){return Vr.Buffer.from(KS(sl,this))}static decode(t){return $S(sl,this,t)}static decodeUnchecked(t){return zS(sl,this,t)}}const sl=new Map;var qx;let mk;const Rm=32;let Fx=1;mk=Symbol.toStringTag;class lr extends LV{constructor(t){if(super({}),this._bn=void 0,function(e){return e._bn!==void 0}(t))this._bn=t._bn;else{if(typeof t=="string"){const e=W8.decode(t);if(e.length!=Rm)throw new Error("Invalid public key input");this._bn=new Z8(e)}else this._bn=new Z8(t);if(this._bn.byteLength()>Rm)throw new Error("Invalid public key input")}}static unique(){const t=new lr(Fx);return Fx+=1,new lr(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return W8.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Vr.Buffer);if(t.length===Rm)return t;const e=Vr.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[mk](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const s=Vr.Buffer.concat([t.toBuffer(),Vr.Buffer.from(e),n.toBuffer()]),i=Lv(s);return new lr(i)}static createProgramAddressSync(t,e){let n=Vr.Buffer.alloc(0);t.forEach(function(i){if(i.length>32)throw new TypeError("Max seed length exceeded");n=Vr.Buffer.concat([n,TV(i)])}),n=Vr.Buffer.concat([n,e.toBuffer(),Vr.Buffer.from("ProgramDerivedAddress")]);const s=Lv(n);if(zx(s))throw new Error("Invalid seeds, address must fall off the curve");return new lr(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,s=255;for(;s!=0;){try{const i=t.concat(Vr.Buffer.from([s]));n=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;s--;continue}return[n,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return zx(new lr(t).toBytes())}}qx=lr,lr.default=new qx("11111111111111111111111111111111"),sl.set(lr,{kind:"struct",fields:[["_bn","u256"]]}),new lr("BPFLoader1111111111111111111111111111111111");const kr=(r="publicKey")=>yf(32,r),Tu=(r="string")=>{const t=je([Ke("length"),Ke("lengthPadding"),yf(Va(Ke(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),s=t;return s.decode=(i,c)=>e(i,c).chars.toString(),s.encode=(i,c,l)=>{const p={chars:Vr.Buffer.from(i,"utf8")};return n(p,c,l)},s.alloc=i=>Ke().span+Ke().span+Vr.Buffer.from(i,"utf8").length,s};Vr.Buffer.alloc(64).fill(0);new lr("SysvarC1ock11111111111111111111111111111111"),new lr("SysvarEpochSchedu1e111111111111111111111111"),new lr("Sysvar1nstructions1111111111111111111111111");new lr("SysvarRecentB1ockHashes11111111111111111111");new lr("SysvarRent111111111111111111111111111111111");new lr("SysvarRewards111111111111111111111111111111"),new lr("SysvarS1otHashes111111111111111111111111111"),new lr("SysvarS1otHistory11111111111111111111111111"),new lr("SysvarStakeHistory1111111111111111111111111");const OV=Bn("lamportsPerSignature");je([Ke("version"),Ke("state"),kr("authorizedPubkey"),kr("nonce"),je([OV],"feeCalculator")]).span;const Qu=r=>{const t=yf(8,r),{encode:e,decode:n}=(i=>({decode:i.decode.bind(i),encode:i.encode.bind(i)}))(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return mV(Vr.Buffer.from(l))},s.encode=(i,c,l)=>{const p=vV(i,8);return e(p,c,l)},s};Object.freeze({Create:{index:0,layout:je([Ke("instruction"),Ei("lamports"),Ei("space"),kr("programId")])},Assign:{index:1,layout:je([Ke("instruction"),kr("programId")])},Transfer:{index:2,layout:je([Ke("instruction"),Qu("lamports")])},CreateWithSeed:{index:3,layout:je([Ke("instruction"),kr("base"),Tu("seed"),Ei("lamports"),Ei("space"),kr("programId")])},AdvanceNonceAccount:{index:4,layout:je([Ke("instruction")])},WithdrawNonceAccount:{index:5,layout:je([Ke("instruction"),Ei("lamports")])},InitializeNonceAccount:{index:6,layout:je([Ke("instruction"),kr("authorized")])},AuthorizeNonceAccount:{index:7,layout:je([Ke("instruction"),kr("authorized")])},Allocate:{index:8,layout:je([Ke("instruction"),Ei("space")])},AllocateWithSeed:{index:9,layout:je([Ke("instruction"),kr("base"),Tu("seed"),Ei("space"),kr("programId")])},AssignWithSeed:{index:10,layout:je([Ke("instruction"),kr("base"),Tu("seed"),kr("programId")])},TransferWithSeed:{index:11,layout:je([Ke("instruction"),Qu("lamports"),Tu("seed"),kr("programId")])},UpgradeNonceAccount:{index:12,layout:je([Ke("instruction")])}});new lr("11111111111111111111111111111111"),new lr("BPFLoader2111111111111111111111111111111111"),je([Ke("typeIndex"),Qu("deactivationSlot"),Bn("lastExtendedSlot"),cn("lastExtendedStartIndex"),cn(),qa(kr(),Va(cn(),-1),"authority")]);const gn=Vh(ab(lr),Me(),r=>new lr(r)),vk=ub([Me(),Gr("base64")]),fb=Vh(ab(Vr.Buffer),vk,r=>Vr.Buffer.from(r[0],"base64"));function gk(r){return di([be({jsonrpc:Gr("2.0"),id:Me(),result:r}),be({jsonrpc:Gr("2.0"),id:Me(),error:be({code:Hh(),message:Me(),data:He(lu("any",()=>!0))})})])}const UV=gk(Hh());function Nr(r){return Vh(gk(r),UV,t=>"error"in t?t:{...t,result:Nd(t.result,r)})}function Fi(r){return Nr(be({context:be({slot:$t()}),value:r}))}function zd(r){return be({context:be({slot:$t()}),value:r})}const NV=be({foundation:$t(),foundationTerm:$t(),initial:$t(),taper:$t(),terminal:$t()});Nr(Oe(Le(be({epoch:$t(),effectiveSlot:$t(),amount:$t(),postBalance:$t(),commission:He(Le($t()))}))));const DV=Oe(be({slot:$t(),prioritizationFee:$t()})),zV=be({total:$t(),validator:$t(),foundation:$t(),epoch:$t()}),qV=be({epoch:$t(),slotIndex:$t(),slotsInEpoch:$t(),absoluteSlot:$t(),blockHeight:He($t()),transactionCount:He($t())}),FV=be({slotsPerEpoch:$t(),leaderScheduleSlotOffset:$t(),warmup:Yo(),firstNormalEpoch:$t(),firstNormalSlot:$t()}),jV=fk(Me(),Oe($t())),iu=Le(di([be({}),Me()])),KV=be({err:iu}),$V=Gr("receivedSignature");be({"solana-core":Me(),"feature-set":He($t())}),Fi(be({err:Le(di([be({}),Me()])),logs:Le(Oe(Me())),accounts:He(Le(Oe(Le(be({executable:Yo(),owner:Me(),lamports:$t(),data:Oe(Me()),rentEpoch:He($t())}))))),unitsConsumed:He($t()),returnData:He(Le(be({programId:Me(),data:ub([Me(),Gr("base64")])})))})),Fi(be({byIdentity:fk(Me(),Oe($t())),range:be({firstSlot:$t(),lastSlot:$t()})})),Nr(NV),Nr(zV),Nr(DV),Nr(qV),Nr(FV),Nr(jV),Nr($t()),Fi(be({total:$t(),circulating:$t(),nonCirculating:$t(),nonCirculatingAccounts:Oe(gn)}));const HV=be({amount:Me(),uiAmount:Le($t()),decimals:$t(),uiAmountString:He(Me())});Fi(Oe(be({address:gn,amount:Me(),uiAmount:Le($t()),decimals:$t(),uiAmountString:He(Me())}))),Fi(Oe(be({pubkey:gn,account:be({executable:Yo(),owner:gn,lamports:$t(),data:fb,rentEpoch:$t()})})));const qv=be({program:Me(),parsed:Hh(),space:$t()});Fi(Oe(be({pubkey:gn,account:be({executable:Yo(),owner:gn,lamports:$t(),data:qv,rentEpoch:$t()})}))),Fi(Oe(be({lamports:$t(),address:gn})));const cb=be({executable:Yo(),owner:gn,lamports:$t(),data:fb,rentEpoch:$t()});be({pubkey:gn,account:cb});const VV=Vh(di([ab(Vr.Buffer),qv]),di([vk,qv]),r=>Array.isArray(r)?Nd(r,fb):r),ZV=be({executable:Yo(),owner:gn,lamports:$t(),data:VV,rentEpoch:$t()});be({pubkey:gn,account:ZV}),be({state:di([Gr("active"),Gr("inactive"),Gr("activating"),Gr("deactivating")]),active:$t(),inactive:$t()}),Nr(Oe(be({signature:Me(),slot:$t(),err:iu,memo:Le(Me()),blockTime:He(Le($t()))}))),Nr(Oe(be({signature:Me(),slot:$t(),err:iu,memo:Le(Me()),blockTime:He(Le($t()))}))),be({subscription:$t(),result:zd(cb)});const WV=be({pubkey:gn,account:cb});be({subscription:$t(),result:zd(WV)});const GV=be({parent:$t(),slot:$t(),root:$t()});be({subscription:$t(),result:GV});const YV=di([be({type:di([Gr("firstShredReceived"),Gr("completed"),Gr("optimisticConfirmation"),Gr("root")]),slot:$t(),timestamp:$t()}),be({type:Gr("createdBank"),parent:$t(),slot:$t(),timestamp:$t()}),be({type:Gr("frozen"),slot:$t(),timestamp:$t(),stats:be({numTransactionEntries:$t(),numSuccessfulTransactions:$t(),numFailedTransactions:$t(),maxTransactionsPerEntry:$t()})}),be({type:Gr("dead"),slot:$t(),timestamp:$t(),err:Me()})]);be({subscription:$t(),result:YV}),be({subscription:$t(),result:zd(di([KV,$V]))}),be({subscription:$t(),result:$t()}),be({pubkey:Me(),gossip:Le(Me()),tpu:Le(Me()),rpc:Le(Me()),version:Le(Me())});const jx=be({votePubkey:Me(),nodePubkey:Me(),activatedStake:$t(),epochVoteAccount:Yo(),epochCredits:Oe(ub([$t(),$t(),$t()])),commission:$t(),lastVote:$t(),rootSlot:Le($t())});Nr(be({current:Oe(jx),delinquent:Oe(jx)}));const XV=di([Gr("processed"),Gr("confirmed"),Gr("finalized")]),JV=be({slot:$t(),confirmations:Le($t()),err:iu,confirmationStatus:He(XV)});Fi(Oe(Le(JV))),Nr($t());const yk=be({accountKey:gn,writableIndexes:Oe($t()),readonlyIndexes:Oe($t())}),Cm=be({signatures:Oe(Me()),message:be({accountKeys:Oe(Me()),header:be({numRequiredSignatures:$t(),numReadonlySignedAccounts:$t(),numReadonlyUnsignedAccounts:$t()}),instructions:Oe(be({accounts:Oe($t()),data:Me(),programIdIndex:$t()})),recentBlockhash:Me(),addressTableLookups:He(Oe(yk))})}),bk=be({pubkey:gn,signer:Yo(),writable:Yo(),source:He(di([Gr("transaction"),Gr("lookupTable")]))}),Kx=be({accountKeys:Oe(bk),signatures:Oe(Me())}),$x=be({parsed:Hh(),program:Me(),programId:gn}),Hx=be({accounts:Oe(gn),data:Me(),programId:gn}),wk=Vh(di([Hx,$x]),di([be({parsed:Hh(),program:Me(),programId:Me()}),be({accounts:Oe(Me()),data:Me(),programId:Me()})]),r=>Nd(r,"accounts"in r?Hx:$x)),Vx=be({signatures:Oe(Me()),message:be({accountKeys:Oe(bk),instructions:Oe(wk),recentBlockhash:Me(),addressTableLookups:He(Le(Oe(yk)))})}),Fl=be({accountIndex:$t(),mint:Me(),owner:He(Me()),uiTokenAmount:HV}),xk=be({writable:Oe(gn),readonly:Oe(gn)}),R0=be({err:iu,fee:$t(),innerInstructions:He(Le(Oe(be({index:$t(),instructions:Oe(be({accounts:Oe($t()),data:Me(),programIdIndex:$t()}))})))),preBalances:Oe($t()),postBalances:Oe($t()),logMessages:He(Le(Oe(Me()))),preTokenBalances:He(Le(Oe(Fl))),postTokenBalances:He(Le(Oe(Fl))),loadedAddresses:He(xk),computeUnitsConsumed:He($t())}),Tm=be({err:iu,fee:$t(),innerInstructions:He(Le(Oe(be({index:$t(),instructions:Oe(wk)})))),preBalances:Oe($t()),postBalances:Oe($t()),logMessages:He(Le(Oe(Me()))),preTokenBalances:He(Le(Oe(Fl))),postTokenBalances:He(Le(Oe(Fl))),loadedAddresses:He(xk),computeUnitsConsumed:He($t())}),wu=di([Gr(0),Gr("legacy")]),ya=be({pubkey:Me(),lamports:$t(),postBalance:Le($t()),rewardType:Le(Me()),commission:He(Le($t()))});Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Cm,meta:Le(R0),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Kx,meta:Le(R0),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Vx,meta:Le(Tm),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Kx,meta:Le(Tm),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Cm,meta:Le(R0)})),rewards:He(Oe(ya)),blockTime:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),signatures:Oe(Me()),blockTime:Le($t())}))),Nr(Le(be({slot:$t(),meta:R0,blockTime:He(Le($t())),transaction:Cm,version:He(wu)}))),Nr(Le(be({slot:$t(),transaction:Vx,meta:Le(Tm),blockTime:He(Le($t())),version:He(wu)}))),Fi(be({blockhash:Me(),feeCalculator:be({lamportsPerSignature:$t()})})),Fi(be({blockhash:Me(),lastValidBlockHeight:$t()})),Fi(Yo()),Nr(Oe(be({slot:$t(),numTransactions:$t(),numSlots:$t(),samplePeriodSecs:$t()}))),Fi(Le(be({feeCalculator:be({lamportsPerSignature:$t()})}))),Nr(Me()),Nr(Me());const QV=be({err:iu,logs:Oe(Me()),signature:Me()});var Zx;be({result:zd(QV),subscription:$t()}),Object.freeze({CreateLookupTable:{index:0,layout:je([Ke("instruction"),Qu("recentSlot"),cn("bumpSeed")])},FreezeLookupTable:{index:1,layout:je([Ke("instruction")])},ExtendLookupTable:{index:2,layout:je([Ke("instruction"),Qu(),qa(kr(),Va(Ke(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:je([Ke("instruction")])},CloseLookupTable:{index:4,layout:je([Ke("instruction")])}}),new lr("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:je([cn("instruction"),Ke("units"),Ke("additionalFee")])},RequestHeapFrame:{index:1,layout:je([cn("instruction"),Ke("bytes")])},SetComputeUnitLimit:{index:2,layout:je([cn("instruction"),Ke("units")])},SetComputeUnitPrice:{index:3,layout:je([cn("instruction"),Qu("microLamports")])}}),new lr("ComputeBudget111111111111111111111111111111"),je([cn("numSignatures"),cn("padding"),Ti("signatureOffset"),Ti("signatureInstructionIndex"),Ti("publicKeyOffset"),Ti("publicKeyInstructionIndex"),Ti("messageDataOffset"),Ti("messageDataSize"),Ti("messageInstructionIndex")]),new lr("Ed25519SigVerify111111111111111111111111111"),zv.utils.isValidPrivateKey,zv.getPublicKey,je([cn("numSignatures"),Ti("signatureOffset"),cn("signatureInstructionIndex"),Ti("ethAddressOffset"),cn("ethAddressInstructionIndex"),Ti("messageDataOffset"),Ti("messageDataSize"),cn("messageInstructionIndex"),yf(20,"ethAddress"),yf(64,"signature"),cn("recoveryId")]),new lr("KeccakSecp256k11111111111111111111111111111"),new lr("StakeConfig11111111111111111111111111111111");class Wx{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}Zx=Wx,Wx.default=new Zx(0,0,lr.default),Object.freeze({Initialize:{index:0,layout:je([Ke("instruction"),((r="authorized")=>je([kr("staker"),kr("withdrawer")],r))(),((r="lockup")=>je([Ei("unixTimestamp"),Ei("epoch"),kr("custodian")],r))()])},Authorize:{index:1,layout:je([Ke("instruction"),kr("newAuthorized"),Ke("stakeAuthorizationType")])},Delegate:{index:2,layout:je([Ke("instruction")])},Split:{index:3,layout:je([Ke("instruction"),Ei("lamports")])},Withdraw:{index:4,layout:je([Ke("instruction"),Ei("lamports")])},Deactivate:{index:5,layout:je([Ke("instruction")])},Merge:{index:7,layout:je([Ke("instruction")])},AuthorizeWithSeed:{index:8,layout:je([Ke("instruction"),kr("newAuthorized"),Ke("stakeAuthorizationType"),Tu("authoritySeed"),kr("authorityOwner")])}}),new lr("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:je([Ke("instruction"),((r="voteInit")=>je([kr("nodePubkey"),kr("authorizedVoter"),kr("authorizedWithdrawer"),cn("commission")],r))()])},Authorize:{index:1,layout:je([Ke("instruction"),kr("newAuthorized"),Ke("voteAuthorizationType")])},Withdraw:{index:3,layout:je([Ke("instruction"),Ei("lamports")])},AuthorizeWithSeed:{index:10,layout:je([Ke("instruction"),((r="voteAuthorizeWithSeedArgs")=>je([Ke("voteAuthorizationType"),kr("currentAuthorityDerivedKeyOwnerPubkey"),Tu("currentAuthorityDerivedKeySeed"),kr("newAuthorized")],r))()])}}),new lr("Vote111111111111111111111111111111111111111"),new lr("Va1idator1nfo111111111111111111111111111111"),be({name:Me(),website:He(Me()),details:He(Me()),keybaseUsername:He(Me())}),new lr("Vote111111111111111111111111111111111111111"),je([kr("nodePubkey"),kr("authorizedWithdrawer"),cn("commission"),Bn(),qa(je([Bn("slot"),Ke("confirmationCount")]),Va(Ke(),-8),"votes"),cn("rootSlotValid"),Bn("rootSlot"),Bn(),qa(je([Bn("epoch"),kr("authorizedVoter")]),Va(Ke(),-8),"authorizedVoters"),je([qa(je([kr("authorizedPubkey"),Bn("epochOfLastAuthorizedSwitch"),Bn("targetEpoch")]),32,"buf"),Bn("idx"),cn("isEmpty")],"priorVoters"),Bn(),qa(je([Bn("epoch"),Bn("credits"),Bn("prevCredits")]),Va(Ke(),-8),"epochCredits"),je([Bn("slot"),Bn("timestamp")],"lastTimestamp")]);var C0,tZ=(C0=function(r,t){return C0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])},C0(r,t)},function(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}C0(r,t),r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)});(function(r){function t(e,n){var s="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(n);return r.call(this,s)||this}return tZ(t,r),t})(Error);const Gx=new lr("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ");lr.findProgramAddressSync([Gx.toBuffer()],Gx);var Yx;(function(r){r[r.None=0]="None",r[r.Solana=1]="Solana",r[r.Ethereum=2]="Ethereum",r[r.UnverifiedSolana=3]="UnverifiedSolana"})(Yx||(Yx={}));var cr;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(cr||(cr={}));cr.SOL,cr.ETH,cr.BSC,cr.Injective,cr.A,cr.AAAA,cr.Background;var Xx;(function(r){r[r.V1=1]="V1",r[r.V2=2]="V2"})(Xx||(Xx={}));var eZ="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",rZ="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",hb=0,_k=-3;function dh(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function nZ(r,t){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new dh,this.dtree=new dh}var Mk=new dh,Ek=new dh,Fv=new Uint8Array(30),jv=new Uint16Array(30),Ak=new Uint8Array(30),Sk=new Uint16Array(30),iZ=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jx=new dh,Ao=new Uint8Array(320);function Qx(r,t,e,n){var s,i;for(s=0;s>>=1,t}function Ro(r,t,e){if(!t)return e;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>16-t;return r.tag>>>=t,r.bitcount-=t,n+e}function Kv(r,t){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>=1,++s,e+=t.table[s],n-=t.table[s];while(n>=0);return r.tag=i,r.bitcount-=s,t.trans[e+n]}function sZ(r,t,e){var n,s,i,c,l,p;for(n=Ro(r,5,257),s=Ro(r,5,1),i=Ro(r,4,4),c=0;c<19;++c)Ao[c]=0;for(c=0;c8;)r.sourceIndex--,r.bitcount-=8;if((t=256*(t=r.source[r.sourceIndex+1])+r.source[r.sourceIndex])!==(65535&~(256*r.source[r.sourceIndex+3]+r.source[r.sourceIndex+2])))return _k;for(r.sourceIndex+=4,e=t;e;--e)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,hb}(function(r,t){var e;for(e=0;e<7;++e)r.table[e]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,e=0;e<24;++e)r.trans[e]=256+e;for(e=0;e<144;++e)r.trans[24+e]=e;for(e=0;e<8;++e)r.trans[168+e]=280+e;for(e=0;e<112;++e)r.trans[176+e]=144+e;for(e=0;e<5;++e)t.table[e]=0;for(t.table[5]=32,e=0;e<32;++e)t.trans[e]=e})(Mk,Ek),Qx(Fv,jv,4,3),Qx(Ak,Sk,2,1),Fv[28]=0,jv[28]=258;var uZ=function(r,t){var e,n,s=new nZ(r,t);do{switch(e=oZ(s),Ro(s,2,0)){case 0:n=aZ(s);break;case 1:n=e7(s,Mk,Ek);break;case 2:sZ(s,s.ltree,s.dtree),n=e7(s,s.ltree,s.dtree);break;default:n=_k}if(n!==hb)throw new Error("Data error")}while(!e);return s.destLen{let n=r[t];r[t]=r[e],r[e]=n};var cZ={swap32LE:r=>{fZ&&(t=>{const e=t.length;for(let n=0;n1114111?this.errorValue:r<55296||r>56319&&r<=65535?(t=(this.data[r>>5]<<2)+(31&r),this.data[t]):r<=65535?(t=(this.data[2048+(r-55296>>5)]<<2)+(31&r),this.data[t]):r>11)],t=this.data[t+(r>>5&63)],t=(t<<2)+(31&r),this.data[t]):this.data[this.data.length-4]}},kk={exports:{}};kk.exports=function(){var r="3.7.5",t=r,e=typeof atob=="function",n=typeof btoa=="function",s=typeof Zt.Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,c=typeof TextEncoder=="function"?new TextEncoder:void 0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=Array.prototype.slice.call(l),m=function(q){var it={};return q.forEach(function(at,Bt){return it[at]=Bt}),it}(p),v=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_=String.fromCharCode.bind(String),E=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q){return new Uint8Array(Array.prototype.slice.call(q,0))},w=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(it){return it=="+"?"-":"_"})},x=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},A=function(q){for(var it,at,Bt,yt,pt="",Ft=q.length%3,lt=0;lt255||(Bt=q.charCodeAt(lt++))>255||(yt=q.charCodeAt(lt++))>255)throw new TypeError("invalid character found");pt+=p[(it=at<<16|Bt<<8|yt)>>18&63]+p[it>>12&63]+p[it>>6&63]+p[63&it]}return Ft?pt.slice(0,Ft-3)+"===".substring(Ft):pt},B=n?function(q){return btoa(q)}:s?function(q){return Zt.Buffer.from(q,"binary").toString("base64")}:A,P=s?function(q){return Zt.Buffer.from(q).toString("base64")}:function(q){for(var it=4096,at=[],Bt=0,yt=q.length;Bt>>6)+_(128|63&it):_(224|it>>>12&15)+_(128|it>>>6&63)+_(128|63&it);var it=65536+1024*(q.charCodeAt(0)-55296)+(q.charCodeAt(1)-56320);return _(240|it>>>18&7)+_(128|it>>>12&63)+_(128|it>>>6&63)+_(128|63&it)},O=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,z=function(q){return q.replace(O,C)},H=s?function(q){return Zt.Buffer.from(q,"utf8").toString("base64")}:c?function(q){return P(c.encode(q))}:function(q){return B(z(q))},tt=function(q,it){return it===void 0&&(it=!1),it?w(H(q)):H(q)},nt=function(q){return tt(q,!0)},G=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,M=function(q){switch(q.length){case 4:var it=((7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3))-65536;return _(55296+(it>>>10))+_(56320+(1023&it));case 3:return _((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return _((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},d=function(q){return q.replace(G,M)},o=function(q){if(q=q.replace(/\s+/g,""),!v.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(3&q.length));for(var it,at,Bt,yt="",pt=0;pt>16&255):Bt===64?_(it>>16&255,it>>8&255):_(it>>16&255,it>>8&255,255&it);return yt},a=e?function(q){return atob(x(q))}:s?function(q){return Zt.Buffer.from(q,"base64").toString("binary")}:o,f=s?function(q){return E(Zt.Buffer.from(q,"base64"))}:function(q){return E(a(q).split("").map(function(it){return it.charCodeAt(0)}))},h=function(q){return f(S(q))},g=s?function(q){return Zt.Buffer.from(q,"base64").toString("utf8")}:i?function(q){return i.decode(f(q))}:function(q){return d(a(q))},S=function(q){return x(q.replace(/[-_]/g,function(it){return it=="-"?"+":"/"}))},I=function(q){return g(S(q))},y=function(q){if(typeof q!="string")return!1;var it=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(it)||!/[^\s0-9a-zA-Z\-_]/.test(it)},u=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},b=function(){var q=function(it,at){return Object.defineProperty(String.prototype,it,u(at))};q("fromBase64",function(){return I(this)}),q("toBase64",function(it){return tt(this,it)}),q("toBase64URI",function(){return tt(this,!0)}),q("toBase64URL",function(){return tt(this,!0)}),q("toUint8Array",function(){return h(this)})},D=function(){var q=function(it,at){return Object.defineProperty(Uint8Array.prototype,it,u(at))};q("toBase64",function(it){return R(this,it)}),q("toBase64URI",function(){return R(this,!0)}),q("toBase64URL",function(){return R(this,!0)})},Z=function(){b(),D()},F={version:r,VERSION:t,atob:a,atobPolyfill:o,btoa:B,btoaPolyfill:A,fromBase64:I,toBase64:tt,encode:tt,encodeURI:nt,encodeURL:nt,utob:z,btou:d,decode:I,isValid:y,fromUint8Array:R,toUint8Array:h,extendString:b,extendUint8Array:D,extendBuiltins:Z,Base64:{}};return Object.keys(F).forEach(function(q){return F.Base64[q]=F[q]}),F}();const Ar={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},dZ=eZ,pZ=rZ,Ik=lZ,Bk=kk.exports.Base64,mZ=new Ik(Bk.toUint8Array(dZ)),vZ=new Ik(Bk.toUint8Array(pZ));function un(r,t){return(r&t)!=0}const T0=0,Om=1,Um=2;function gZ(r,t){const e=r.length;let n=0,s=T0;for(let i=t;i+165535?2:1,e.push(s)}for(let s=0;s{const t=PK+r,e=BK(Ae.Buffer.from(t,"utf8")).slice(2);return Ae.Buffer.from(e,"hex")},o7=(r,t,e)=>{const n=[r];t?n.push(t.toBuffer()):n.push(Ae.Buffer.alloc(32)),e?n.push(e.toBuffer()):n.push(Ae.Buffer.alloc(32));const[s]=Xt.findProgramAddressSync(n,TA);return s},Pk=r=>{switch(bZ(r).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}};var Es={},Lu={};function s7(r,t,e,n,s){var i=(1<=n;)l-=n,e[p]=c>>l&i,p+=1}),s)l>0&&(e[p]=c<=t)throw new Error("Excessive padding: ".concat(l," (max ").concat(t-1," allowed)"));if(c%(1<8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return s7(r,t,e,8,!1),e},Lu.toBits=function(r,t,e){if(t>8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return s7(r,8,e,t,!0),e};var eo={};Object.defineProperty(eo,"__esModule",{value:!0}),eo.CHECKSUM_LENGTH=void 0,eo.createChecksum=function(r,t){var e;switch(t){case"bech32":e=1;break;case"bech32m":e=a7;break;default:throw Error("Invalid encoding value: ".concat(t,"; expected bech32 or bech32m"))}for(var n=c7(r)^e,s=0;s>i&31}},eo.decode=l7,eo.decodeWithPrefix=function(r,t){var e=t.length+2*r.length+1,n=(0,Rk.createBitArray)(e);return h7(r,n.subarray(0,2*r.length+1)),l7(t,n.subarray(2*r.length+1)),n},eo.detectCase=function(r){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"message",e=!1,n=!1,s=0;sf7)throw new TypeError("Invalid char in ".concat(t,": ").concat(i,"; ")+"should be in ASCII range ".concat(u7,"-").concat(f7));n=n||i>=65&&i<=90,e=e||i>=97&&i<=122}if(e&&n)throw new TypeError("Mixed-case ".concat(t));return n?"upper":e?"lower":null},eo.encode=function(r){return r.reduce(function(t,e){return t+$v[e]},"")},eo.expandPrefix=h7,eo.verifyChecksum=function(r){switch(c7(r)){case 1:return"bech32";case a7:return"bech32m";default:return}};var Rk=Lu,$v="qpzry9x8gf2tvdw0s3jn54khce6mua7l",a7=734539939,u7=33,f7=126,Hv=6;eo.CHECKSUM_LENGTH=Hv;var wZ=function(){for(var r=new Map,t=0;t<$v.length;t+=1)r.set($v[t],t);return r}(),xZ=[996825010,642813549,513874426,1027748829,705979059];function c7(r){return r.reduce(function(t,e){var n=t>>25,s=(33554431&t)<<5^e;return xZ.reduce(function(i,c,l){return n>>l&1?i^c:i},s)},1)}function h7(r,t){for(var e=0;e>5,t[e+r.length+1]=31&n}t[r.length]=0}function l7(r,t){for(var e=t||(0,Rk.createBitArray)(r.length),n=0;n2&&arguments[2]!==void 0?arguments[2]:"bech32";return pb(r,lb(t),e)};Es.encode5BitArray=pb,Es.from5BitArray=db,Es.to5BitArray=lb;var ph=Lu,zi=eo;function d7(r,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:"bech32",s=2*r.length+1+t.length+zi.CHECKSUM_LENGTH;if(s-r.length>jl)throw new Error("Message to be produced is too long (max ".concat(jl," supported)"));var i=(e=(0,zi.detectCase)(r,"prefix"))!==null&&e!==void 0?e:"lower",c=(0,ph.createBitArray)(s);(0,zi.expandPrefix)(r.toLowerCase(),c.subarray(0,2*r.length+1)),c.subarray(2*r.length+1,c.length-zi.CHECKSUM_LENGTH).set(t),(0,zi.createChecksum)(c,n);var l=(0,zi.encode)(c.subarray(2*r.length+1));return i==="upper"&&(l=l.toUpperCase()),"".concat(r,"1").concat(l)}function mb(r){if(r.length>jl)throw new TypeError("Message too long; max ".concat(jl," expected"));(0,zi.detectCase)(r);var t=r.toLowerCase(),e=t.lastIndexOf("1");if(e<0)throw new Error('No separator char ("1") found');if(e>r.length-zi.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(zi.CHECKSUM_LENGTH," chars expected)"));var n=t.substring(0,e),s=(0,zi.decodeWithPrefix)(n,t.substring(e+1)),i=(0,zi.verifyChecksum)(s);if(i===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:i,data:s.subarray(2*n.length+1,s.length-zi.CHECKSUM_LENGTH)}}var _Z=function(){function r(s,i,c){if(function(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}(this,r),s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(i<0||i>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(c.length<2||c.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(i===0&&c.length!==20&&c.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=s,this.scriptVersion=i,this.data=c}var t,e,n;return t=r,e=[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var s=Math.ceil(8*this.data.length/5),i=(0,ph.createBitArray)(s+1);i[0]=this.scriptVersion,lb(this.data,i.subarray(1));var c=this.scriptVersion===0?"bech32":"bech32m";return pb(this.prefix,i,c)}}],n=[{key:"decode",value:function(s){var i=mb(s),c=i.prefix,l=i.data,p=i.encoding;if(c!=="bc"&&c!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var m=l[0];if(m===0&&p!=="bech32")throw Error("Unexpected encoding ".concat(p," used for version 0 script"));if(m>0&&p!=="bech32m")throw Error("Unexpected encoding ".concat(p," used for version ").concat(m," script"));return new this(c,m,db(l.subarray(1)))}}],e&&d7(t.prototype,e),n&&d7(t,n),Object.defineProperty(t,"prototype",{writable:!1}),r}();Es.BitcoinAddress=_Z;var Ck={exports:{}};(function(r){(function(t){const e="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},s=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",l="(?:[0-9a-f]+::?)+",p={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${l})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${l})|(?:::)(?:${l})?)${e}\\.${e}\\.${e}\\.${e}(${c})?$`,"i")};function m(x,A){if(x.indexOf("::")!==x.lastIndexOf("::"))return null;let B,P,R=0,C=-1,O=(x.match(p.zoneIndex)||[])[0];for(O&&(O=O.substring(1),x=x.replace(/%.+$/,""));(C=x.indexOf(":",C+1))>=0;)R++;if(x.substr(0,2)==="::"&&R--,x.substr(-2,2)==="::"&&R--,R>A)return null;for(P=A-R,B=":";P--;)B+="0:";return(x=x.replace("::",B))[0]===":"&&(x=x.slice(1)),x[x.length-1]===":"&&(x=x.slice(0,-1)),A=function(){const z=x.split(":"),H=[];for(let tt=0;tt0;){if(R=B-P,R<0&&(R=0),x[C]>>R!=A[C]>>R)return!1;P-=B,C+=1}return!0}function _(x){if(i.test(x))return parseInt(x,16);if(x[0]==="0"&&!isNaN(parseInt(x[1],10))){if(s.test(x))return parseInt(x,8);throw new Error(`ipaddr: cannot parse ${x} as octal`)}return parseInt(x,10)}function E(x,A){for(;x.length=0;R-=1){if(C=this.octets[R],!(C in P)||(O=P[C],B&&O!==0))return null;O!==8&&(B=!0),A+=O}return 32-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){return this.octets.slice(0)},x.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},x.prototype.toNormalizedString=function(){return this.toString()},x.prototype.toString=function(){return this.octets.join(".")},x}(),w.IPv4.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<4;)R.push(parseInt(B[C],10)|255^parseInt(P[C],10)),C++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(x){return this.parser(x)!==null},w.IPv4.isValid=function(x){try{return new this(this.parser(x)),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(x){return!(!w.IPv4.isValid(x)||!x.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(x){const A=this.parser(x);if(A===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(A)},w.IPv4.parseCIDR=function(x){let A;if(A=x.match(/^(.+)\/(\d+)$/)){const B=parseInt(A[2]);if(B>=0&&B<=32){const P=[this.parse(A[1]),B];return Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(x){let A,B,P;if(A=x.match(n.fourOctet))return function(){const R=A.slice(1,6),C=[];for(let O=0;O4294967295||P<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let C;for(C=0;C<=24;C+=8)R.push(P>>C&255);return R}().reverse()}return(A=x.match(n.twoOctet))?function(){const R=A.slice(1,4),C=[];if(P=_(R[1]),P>16777215||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(P>>16&255),C.push(P>>8&255),C.push(255&P),C}():(A=x.match(n.threeOctet))?function(){const R=A.slice(1,5),C=[];if(P=_(R[2]),P>65535||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(_(R[1])),C.push(P>>8&255),C.push(255&P),C}():null},w.IPv4.subnetMaskFromPrefixLength=function(x){if((x=parseInt(x))<0||x>32)throw new Error("ipaddr: invalid IPv4 prefix length");const A=[0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B=0;O-=1){if(R=this.parts[O],!(R in P)||(C=P[R],B&&C!==0))return null;C!==16&&(B=!0),A+=C}return 128-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){let A;const B=[],P=this.parts;for(let R=0;R>8),B.push(255&A);return B},x.prototype.toFixedLengthString=function(){const A=(function(){const P=[];for(let R=0;R>8,255&B,P>>8,255&P])},x.prototype.toNormalizedString=function(){const A=(function(){const P=[];for(let R=0;RC&&(R=P.index,C=P[0].length);return C<0?B:`${B.substring(0,R)}::${B.substring(R+C)}`},x.prototype.toString=function(){return this.toRFC5952String()},x}(),w.IPv6.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<16;)R.push(parseInt(B[C],10)|255^parseInt(P[C],10)),C++;return new this(R)}catch(A){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${A})`)}},w.IPv6.isIPv6=function(x){return this.parser(x)!==null},w.IPv6.isValid=function(x){if(typeof x=="string"&&x.indexOf(":")===-1)return!1;try{const A=this.parser(x);return new this(A.parts,A.zoneId),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch(O){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${O})`)}},w.IPv6.parse=function(x){const A=this.parser(x);if(A.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(A.parts,A.zoneId)},w.IPv6.parseCIDR=function(x){let A,B,P;if((B=x.match(/^(.+)\/(\d+)$/))&&(A=parseInt(B[2]),A>=0&&A<=128))return P=[this.parse(B[1]),A],Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(x){let A,B,P,R,C,O;if(P=x.match(p.deprecatedTransitional))return this.parser(`::ffff:${P[1]}`);if(p.native.test(x))return m(x,8);if((P=x.match(p.transitional))&&(O=P[6]||"",A=m(P[1].slice(0,-1)+O,6),A.parts)){for(C=[parseInt(P[2]),parseInt(P[3]),parseInt(P[4]),parseInt(P[5])],B=0;B128)throw new Error("ipaddr: invalid IPv6 prefix length");const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B>24&255,J[X+1]=st>>16&255,J[X+2]=st>>8&255,J[X+3]=255&st,J[X+4]=N>>24&255,J[X+5]=N>>16&255,J[X+6]=N>>8&255,J[X+7]=255&N}function x(J,X,st,N,$){var gt,ft=0;for(gt=0;gt<$;gt++)ft|=J[X+gt]^st[N+gt];return(1&ft-1>>>8)-1}function A(J,X,st,N){return x(J,X,st,N,16)}function B(J,X,st,N){return x(J,X,st,N,32)}function P(J,X,st,N){(function($,gt,ft,mt){for(var vt,At=255&mt[0]|(255&mt[1])<<8|(255&mt[2])<<16|(255&mt[3])<<24,_t=255&ft[0]|(255&ft[1])<<8|(255&ft[2])<<16|(255&ft[3])<<24,Gt=255&ft[4]|(255&ft[5])<<8|(255&ft[6])<<16|(255&ft[7])<<24,Rt=255&ft[8]|(255&ft[9])<<8|(255&ft[10])<<16|(255&ft[11])<<24,wt=255&ft[12]|(255&ft[13])<<8|(255&ft[14])<<16|(255&ft[15])<<24,se=255&mt[4]|(255&mt[5])<<8|(255&mt[6])<<16|(255&mt[7])<<24,Lt=255>[0]|(255>[1])<<8|(255>[2])<<16|(255>[3])<<24,Et=255>[4]|(255>[5])<<8|(255>[6])<<16|(255>[7])<<24,de=255>[8]|(255>[9])<<8|(255>[10])<<16|(255>[11])<<24,Pt=255>[12]|(255>[13])<<8|(255>[14])<<16|(255>[15])<<24,Mt=255&mt[8]|(255&mt[9])<<8|(255&mt[10])<<16|(255&mt[11])<<24,K=255&ft[16]|(255&ft[17])<<8|(255&ft[18])<<16|(255&ft[19])<<24,Y=255&ft[20]|(255&ft[21])<<8|(255&ft[22])<<16|(255&ft[23])<<24,V=255&ft[24]|(255&ft[25])<<8|(255&ft[26])<<16|(255&ft[27])<<24,U=255&ft[28]|(255&ft[29])<<8|(255&ft[30])<<16|(255&ft[31])<<24,W=255&mt[12]|(255&mt[13])<<8|(255&mt[14])<<16|(255&mt[15])<<24,et=At,dt=_t,ut=Gt,ht=Rt,zt=wt,Wt=se,ye=Lt,Yt=Et,pe=de,ve=Pt,ge=Mt,ie=K,ue=Y,fe=V,ce=U,Kt=W,oe=0;oe<20;oe+=2)et^=(vt=(ue^=(vt=(pe^=(vt=(zt^=(vt=et+ue|0)<<7|vt>>>25)+et|0)<<9|vt>>>23)+zt|0)<<13|vt>>>19)+pe|0)<<18|vt>>>14,Wt^=(vt=(dt^=(vt=(fe^=(vt=(ve^=(vt=Wt+dt|0)<<7|vt>>>25)+Wt|0)<<9|vt>>>23)+ve|0)<<13|vt>>>19)+fe|0)<<18|vt>>>14,ge^=(vt=(ye^=(vt=(ut^=(vt=(ce^=(vt=ge+ye|0)<<7|vt>>>25)+ge|0)<<9|vt>>>23)+ce|0)<<13|vt>>>19)+ut|0)<<18|vt>>>14,Kt^=(vt=(ie^=(vt=(Yt^=(vt=(ht^=(vt=Kt+ie|0)<<7|vt>>>25)+Kt|0)<<9|vt>>>23)+ht|0)<<13|vt>>>19)+Yt|0)<<18|vt>>>14,et^=(vt=(ht^=(vt=(ut^=(vt=(dt^=(vt=et+ht|0)<<7|vt>>>25)+et|0)<<9|vt>>>23)+dt|0)<<13|vt>>>19)+ut|0)<<18|vt>>>14,Wt^=(vt=(zt^=(vt=(Yt^=(vt=(ye^=(vt=Wt+zt|0)<<7|vt>>>25)+Wt|0)<<9|vt>>>23)+ye|0)<<13|vt>>>19)+Yt|0)<<18|vt>>>14,ge^=(vt=(ve^=(vt=(pe^=(vt=(ie^=(vt=ge+ve|0)<<7|vt>>>25)+ge|0)<<9|vt>>>23)+ie|0)<<13|vt>>>19)+pe|0)<<18|vt>>>14,Kt^=(vt=(ce^=(vt=(fe^=(vt=(ue^=(vt=Kt+ce|0)<<7|vt>>>25)+Kt|0)<<9|vt>>>23)+ue|0)<<13|vt>>>19)+fe|0)<<18|vt>>>14;et=et+At|0,dt=dt+_t|0,ut=ut+Gt|0,ht=ht+Rt|0,zt=zt+wt|0,Wt=Wt+se|0,ye=ye+Lt|0,Yt=Yt+Et|0,pe=pe+de|0,ve=ve+Pt|0,ge=ge+Mt|0,ie=ie+K|0,ue=ue+Y|0,fe=fe+V|0,ce=ce+U|0,Kt=Kt+W|0,$[0]=et>>>0&255,$[1]=et>>>8&255,$[2]=et>>>16&255,$[3]=et>>>24&255,$[4]=dt>>>0&255,$[5]=dt>>>8&255,$[6]=dt>>>16&255,$[7]=dt>>>24&255,$[8]=ut>>>0&255,$[9]=ut>>>8&255,$[10]=ut>>>16&255,$[11]=ut>>>24&255,$[12]=ht>>>0&255,$[13]=ht>>>8&255,$[14]=ht>>>16&255,$[15]=ht>>>24&255,$[16]=zt>>>0&255,$[17]=zt>>>8&255,$[18]=zt>>>16&255,$[19]=zt>>>24&255,$[20]=Wt>>>0&255,$[21]=Wt>>>8&255,$[22]=Wt>>>16&255,$[23]=Wt>>>24&255,$[24]=ye>>>0&255,$[25]=ye>>>8&255,$[26]=ye>>>16&255,$[27]=ye>>>24&255,$[28]=Yt>>>0&255,$[29]=Yt>>>8&255,$[30]=Yt>>>16&255,$[31]=Yt>>>24&255,$[32]=pe>>>0&255,$[33]=pe>>>8&255,$[34]=pe>>>16&255,$[35]=pe>>>24&255,$[36]=ve>>>0&255,$[37]=ve>>>8&255,$[38]=ve>>>16&255,$[39]=ve>>>24&255,$[40]=ge>>>0&255,$[41]=ge>>>8&255,$[42]=ge>>>16&255,$[43]=ge>>>24&255,$[44]=ie>>>0&255,$[45]=ie>>>8&255,$[46]=ie>>>16&255,$[47]=ie>>>24&255,$[48]=ue>>>0&255,$[49]=ue>>>8&255,$[50]=ue>>>16&255,$[51]=ue>>>24&255,$[52]=fe>>>0&255,$[53]=fe>>>8&255,$[54]=fe>>>16&255,$[55]=fe>>>24&255,$[56]=ce>>>0&255,$[57]=ce>>>8&255,$[58]=ce>>>16&255,$[59]=ce>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255})(J,X,st,N)}function R(J,X,st,N){(function($,gt,ft,mt){for(var vt,At=255&mt[0]|(255&mt[1])<<8|(255&mt[2])<<16|(255&mt[3])<<24,_t=255&ft[0]|(255&ft[1])<<8|(255&ft[2])<<16|(255&ft[3])<<24,Gt=255&ft[4]|(255&ft[5])<<8|(255&ft[6])<<16|(255&ft[7])<<24,Rt=255&ft[8]|(255&ft[9])<<8|(255&ft[10])<<16|(255&ft[11])<<24,wt=255&ft[12]|(255&ft[13])<<8|(255&ft[14])<<16|(255&ft[15])<<24,se=255&mt[4]|(255&mt[5])<<8|(255&mt[6])<<16|(255&mt[7])<<24,Lt=255>[0]|(255>[1])<<8|(255>[2])<<16|(255>[3])<<24,Et=255>[4]|(255>[5])<<8|(255>[6])<<16|(255>[7])<<24,de=255>[8]|(255>[9])<<8|(255>[10])<<16|(255>[11])<<24,Pt=255>[12]|(255>[13])<<8|(255>[14])<<16|(255>[15])<<24,Mt=255&mt[8]|(255&mt[9])<<8|(255&mt[10])<<16|(255&mt[11])<<24,K=255&ft[16]|(255&ft[17])<<8|(255&ft[18])<<16|(255&ft[19])<<24,Y=255&ft[20]|(255&ft[21])<<8|(255&ft[22])<<16|(255&ft[23])<<24,V=255&ft[24]|(255&ft[25])<<8|(255&ft[26])<<16|(255&ft[27])<<24,U=255&ft[28]|(255&ft[29])<<8|(255&ft[30])<<16|(255&ft[31])<<24,W=255&mt[12]|(255&mt[13])<<8|(255&mt[14])<<16|(255&mt[15])<<24,et=0;et<20;et+=2)At^=(vt=(Y^=(vt=(de^=(vt=(wt^=(vt=At+Y|0)<<7|vt>>>25)+At|0)<<9|vt>>>23)+wt|0)<<13|vt>>>19)+de|0)<<18|vt>>>14,se^=(vt=(_t^=(vt=(V^=(vt=(Pt^=(vt=se+_t|0)<<7|vt>>>25)+se|0)<<9|vt>>>23)+Pt|0)<<13|vt>>>19)+V|0)<<18|vt>>>14,Mt^=(vt=(Lt^=(vt=(Gt^=(vt=(U^=(vt=Mt+Lt|0)<<7|vt>>>25)+Mt|0)<<9|vt>>>23)+U|0)<<13|vt>>>19)+Gt|0)<<18|vt>>>14,W^=(vt=(K^=(vt=(Et^=(vt=(Rt^=(vt=W+K|0)<<7|vt>>>25)+W|0)<<9|vt>>>23)+Rt|0)<<13|vt>>>19)+Et|0)<<18|vt>>>14,At^=(vt=(Rt^=(vt=(Gt^=(vt=(_t^=(vt=At+Rt|0)<<7|vt>>>25)+At|0)<<9|vt>>>23)+_t|0)<<13|vt>>>19)+Gt|0)<<18|vt>>>14,se^=(vt=(wt^=(vt=(Et^=(vt=(Lt^=(vt=se+wt|0)<<7|vt>>>25)+se|0)<<9|vt>>>23)+Lt|0)<<13|vt>>>19)+Et|0)<<18|vt>>>14,Mt^=(vt=(Pt^=(vt=(de^=(vt=(K^=(vt=Mt+Pt|0)<<7|vt>>>25)+Mt|0)<<9|vt>>>23)+K|0)<<13|vt>>>19)+de|0)<<18|vt>>>14,W^=(vt=(U^=(vt=(V^=(vt=(Y^=(vt=W+U|0)<<7|vt>>>25)+W|0)<<9|vt>>>23)+Y|0)<<13|vt>>>19)+V|0)<<18|vt>>>14;$[0]=At>>>0&255,$[1]=At>>>8&255,$[2]=At>>>16&255,$[3]=At>>>24&255,$[4]=se>>>0&255,$[5]=se>>>8&255,$[6]=se>>>16&255,$[7]=se>>>24&255,$[8]=Mt>>>0&255,$[9]=Mt>>>8&255,$[10]=Mt>>>16&255,$[11]=Mt>>>24&255,$[12]=W>>>0&255,$[13]=W>>>8&255,$[14]=W>>>16&255,$[15]=W>>>24&255,$[16]=Lt>>>0&255,$[17]=Lt>>>8&255,$[18]=Lt>>>16&255,$[19]=Lt>>>24&255,$[20]=Et>>>0&255,$[21]=Et>>>8&255,$[22]=Et>>>16&255,$[23]=Et>>>24&255,$[24]=de>>>0&255,$[25]=de>>>8&255,$[26]=de>>>16&255,$[27]=de>>>24&255,$[28]=Pt>>>0&255,$[29]=Pt>>>8&255,$[30]=Pt>>>16&255,$[31]=Pt>>>24&255})(J,X,st,N)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(J,X,st,N,$,gt,ft){var mt,vt,At=new Uint8Array(16),_t=new Uint8Array(64);for(vt=0;vt<16;vt++)At[vt]=0;for(vt=0;vt<8;vt++)At[vt]=gt[vt];for(;$>=64;){for(P(_t,At,ft,C),vt=0;vt<64;vt++)J[X+vt]=st[N+vt]^_t[vt];for(mt=1,vt=8;vt<16;vt++)mt=mt+(255&At[vt])|0,At[vt]=255&mt,mt>>>=8;$-=64,X+=64,N+=64}if($>0)for(P(_t,At,ft,C),vt=0;vt<$;vt++)J[X+vt]=st[N+vt]^_t[vt];return 0}function z(J,X,st,N,$){var gt,ft,mt=new Uint8Array(16),vt=new Uint8Array(64);for(ft=0;ft<16;ft++)mt[ft]=0;for(ft=0;ft<8;ft++)mt[ft]=N[ft];for(;st>=64;){for(P(vt,mt,$,C),ft=0;ft<64;ft++)J[X+ft]=vt[ft];for(gt=1,ft=8;ft<16;ft++)gt=gt+(255&mt[ft])|0,mt[ft]=255>,gt>>>=8;st-=64,X+=64}if(st>0)for(P(vt,mt,$,C),ft=0;ft>>13|st<<3),N=255&J[4]|(255&J[5])<<8,this.r[2]=7939&(st>>>10|N<<6),$=255&J[6]|(255&J[7])<<8,this.r[3]=8191&(N>>>7|$<<9),gt=255&J[8]|(255&J[9])<<8,this.r[4]=255&($>>>4|gt<<12),this.r[5]=gt>>>1&8190,ft=255&J[10]|(255&J[11])<<8,this.r[6]=8191&(gt>>>14|ft<<2),mt=255&J[12]|(255&J[13])<<8,this.r[7]=8065&(ft>>>11|mt<<5),vt=255&J[14]|(255&J[15])<<8,this.r[8]=8191&(mt>>>8|vt<<8),this.r[9]=vt>>>5&127,this.pad[0]=255&J[16]|(255&J[17])<<8,this.pad[1]=255&J[18]|(255&J[19])<<8,this.pad[2]=255&J[20]|(255&J[21])<<8,this.pad[3]=255&J[22]|(255&J[23])<<8,this.pad[4]=255&J[24]|(255&J[25])<<8,this.pad[5]=255&J[26]|(255&J[27])<<8,this.pad[6]=255&J[28]|(255&J[29])<<8,this.pad[7]=255&J[30]|(255&J[31])<<8};function G(J,X,st,N,$,gt){var ft=new nt(gt);return ft.update(st,N,$),ft.finish(J,X),0}function M(J,X,st,N,$,gt){var ft=new Uint8Array(16);return G(ft,0,st,N,$,gt),A(J,X,ft,0)}function d(J,X,st,N,$){var gt;if(st<32)return-1;for(tt(J,0,X,0,st,N,$),G(J,16,J,32,st-32,J),gt=0;gt<16;gt++)J[gt]=0;return 0}function o(J,X,st,N,$){var gt,ft=new Uint8Array(32);if(st<32||(H(ft,0,32,N,$),M(X,16,X,32,st-32,ft)!==0))return-1;for(tt(J,0,X,0,st,N,$),gt=0;gt<32;gt++)J[gt]=0;return 0}function a(J,X){var st;for(st=0;st<16;st++)J[st]=0|X[st]}function f(J){var X,st,N=1;for(X=0;X<16;X++)st=J[X]+N+65535,N=Math.floor(st/65536),J[X]=st-65536*N;J[0]+=N-1+37*(N-1)}function h(J,X,st){for(var N,$=~(st-1),gt=0;gt<16;gt++)N=$&(J[gt]^X[gt]),J[gt]^=N,X[gt]^=N}function g(J,X){var st,N,$,gt=t(),ft=t();for(st=0;st<16;st++)ft[st]=X[st];for(f(ft),f(ft),f(ft),N=0;N<2;N++){for(gt[0]=ft[0]-65517,st=1;st<15;st++)gt[st]=ft[st]-65535-(gt[st-1]>>16&1),gt[st-1]&=65535;gt[15]=ft[15]-32767-(gt[14]>>16&1),$=gt[15]>>16&1,gt[14]&=65535,h(ft,gt,1-$)}for(st=0;st<16;st++)J[2*st]=255&ft[st],J[2*st+1]=ft[st]>>8}function S(J,X){var st=new Uint8Array(32),N=new Uint8Array(32);return g(st,J),g(N,X),B(st,0,N,0)}function I(J){var X=new Uint8Array(32);return g(X,J),1&X[0]}function y(J,X){var st;for(st=0;st<16;st++)J[st]=X[2*st]+(X[2*st+1]<<8);J[15]&=32767}function u(J,X,st){for(var N=0;N<16;N++)J[N]=X[N]+st[N]}function b(J,X,st){for(var N=0;N<16;N++)J[N]=X[N]-st[N]}function D(J,X,st){var N,$,gt=0,ft=0,mt=0,vt=0,At=0,_t=0,Gt=0,Rt=0,wt=0,se=0,Lt=0,Et=0,de=0,Pt=0,Mt=0,K=0,Y=0,V=0,U=0,W=0,et=0,dt=0,ut=0,ht=0,zt=0,Wt=0,ye=0,Yt=0,pe=0,ve=0,ge=0,ie=st[0],ue=st[1],fe=st[2],ce=st[3],Kt=st[4],oe=st[5],Jt=st[6],le=st[7],ae=st[8],ne=st[9],Ot=st[10],Nt=st[11],he=st[12],ee=st[13],re=st[14],me=st[15];gt+=(N=X[0])*ie,ft+=N*ue,mt+=N*fe,vt+=N*ce,At+=N*Kt,_t+=N*oe,Gt+=N*Jt,Rt+=N*le,wt+=N*ae,se+=N*ne,Lt+=N*Ot,Et+=N*Nt,de+=N*he,Pt+=N*ee,Mt+=N*re,K+=N*me,ft+=(N=X[1])*ie,mt+=N*ue,vt+=N*fe,At+=N*ce,_t+=N*Kt,Gt+=N*oe,Rt+=N*Jt,wt+=N*le,se+=N*ae,Lt+=N*ne,Et+=N*Ot,de+=N*Nt,Pt+=N*he,Mt+=N*ee,K+=N*re,Y+=N*me,mt+=(N=X[2])*ie,vt+=N*ue,At+=N*fe,_t+=N*ce,Gt+=N*Kt,Rt+=N*oe,wt+=N*Jt,se+=N*le,Lt+=N*ae,Et+=N*ne,de+=N*Ot,Pt+=N*Nt,Mt+=N*he,K+=N*ee,Y+=N*re,V+=N*me,vt+=(N=X[3])*ie,At+=N*ue,_t+=N*fe,Gt+=N*ce,Rt+=N*Kt,wt+=N*oe,se+=N*Jt,Lt+=N*le,Et+=N*ae,de+=N*ne,Pt+=N*Ot,Mt+=N*Nt,K+=N*he,Y+=N*ee,V+=N*re,U+=N*me,At+=(N=X[4])*ie,_t+=N*ue,Gt+=N*fe,Rt+=N*ce,wt+=N*Kt,se+=N*oe,Lt+=N*Jt,Et+=N*le,de+=N*ae,Pt+=N*ne,Mt+=N*Ot,K+=N*Nt,Y+=N*he,V+=N*ee,U+=N*re,W+=N*me,_t+=(N=X[5])*ie,Gt+=N*ue,Rt+=N*fe,wt+=N*ce,se+=N*Kt,Lt+=N*oe,Et+=N*Jt,de+=N*le,Pt+=N*ae,Mt+=N*ne,K+=N*Ot,Y+=N*Nt,V+=N*he,U+=N*ee,W+=N*re,et+=N*me,Gt+=(N=X[6])*ie,Rt+=N*ue,wt+=N*fe,se+=N*ce,Lt+=N*Kt,Et+=N*oe,de+=N*Jt,Pt+=N*le,Mt+=N*ae,K+=N*ne,Y+=N*Ot,V+=N*Nt,U+=N*he,W+=N*ee,et+=N*re,dt+=N*me,Rt+=(N=X[7])*ie,wt+=N*ue,se+=N*fe,Lt+=N*ce,Et+=N*Kt,de+=N*oe,Pt+=N*Jt,Mt+=N*le,K+=N*ae,Y+=N*ne,V+=N*Ot,U+=N*Nt,W+=N*he,et+=N*ee,dt+=N*re,ut+=N*me,wt+=(N=X[8])*ie,se+=N*ue,Lt+=N*fe,Et+=N*ce,de+=N*Kt,Pt+=N*oe,Mt+=N*Jt,K+=N*le,Y+=N*ae,V+=N*ne,U+=N*Ot,W+=N*Nt,et+=N*he,dt+=N*ee,ut+=N*re,ht+=N*me,se+=(N=X[9])*ie,Lt+=N*ue,Et+=N*fe,de+=N*ce,Pt+=N*Kt,Mt+=N*oe,K+=N*Jt,Y+=N*le,V+=N*ae,U+=N*ne,W+=N*Ot,et+=N*Nt,dt+=N*he,ut+=N*ee,ht+=N*re,zt+=N*me,Lt+=(N=X[10])*ie,Et+=N*ue,de+=N*fe,Pt+=N*ce,Mt+=N*Kt,K+=N*oe,Y+=N*Jt,V+=N*le,U+=N*ae,W+=N*ne,et+=N*Ot,dt+=N*Nt,ut+=N*he,ht+=N*ee,zt+=N*re,Wt+=N*me,Et+=(N=X[11])*ie,de+=N*ue,Pt+=N*fe,Mt+=N*ce,K+=N*Kt,Y+=N*oe,V+=N*Jt,U+=N*le,W+=N*ae,et+=N*ne,dt+=N*Ot,ut+=N*Nt,ht+=N*he,zt+=N*ee,Wt+=N*re,ye+=N*me,de+=(N=X[12])*ie,Pt+=N*ue,Mt+=N*fe,K+=N*ce,Y+=N*Kt,V+=N*oe,U+=N*Jt,W+=N*le,et+=N*ae,dt+=N*ne,ut+=N*Ot,ht+=N*Nt,zt+=N*he,Wt+=N*ee,ye+=N*re,Yt+=N*me,Pt+=(N=X[13])*ie,Mt+=N*ue,K+=N*fe,Y+=N*ce,V+=N*Kt,U+=N*oe,W+=N*Jt,et+=N*le,dt+=N*ae,ut+=N*ne,ht+=N*Ot,zt+=N*Nt,Wt+=N*he,ye+=N*ee,Yt+=N*re,pe+=N*me,Mt+=(N=X[14])*ie,K+=N*ue,Y+=N*fe,V+=N*ce,U+=N*Kt,W+=N*oe,et+=N*Jt,dt+=N*le,ut+=N*ae,ht+=N*ne,zt+=N*Ot,Wt+=N*Nt,ye+=N*he,Yt+=N*ee,pe+=N*re,ve+=N*me,K+=(N=X[15])*ie,ft+=38*(V+=N*fe),mt+=38*(U+=N*ce),vt+=38*(W+=N*Kt),At+=38*(et+=N*oe),_t+=38*(dt+=N*Jt),Gt+=38*(ut+=N*le),Rt+=38*(ht+=N*ae),wt+=38*(zt+=N*ne),se+=38*(Wt+=N*Ot),Lt+=38*(ye+=N*Nt),Et+=38*(Yt+=N*he),de+=38*(pe+=N*ee),Pt+=38*(ve+=N*re),Mt+=38*(ge+=N*me),gt=(N=(gt+=38*(Y+=N*ue))+($=1)+65535)-65536*($=Math.floor(N/65536)),ft=(N=ft+$+65535)-65536*($=Math.floor(N/65536)),mt=(N=mt+$+65535)-65536*($=Math.floor(N/65536)),vt=(N=vt+$+65535)-65536*($=Math.floor(N/65536)),At=(N=At+$+65535)-65536*($=Math.floor(N/65536)),_t=(N=_t+$+65535)-65536*($=Math.floor(N/65536)),Gt=(N=Gt+$+65535)-65536*($=Math.floor(N/65536)),Rt=(N=Rt+$+65535)-65536*($=Math.floor(N/65536)),wt=(N=wt+$+65535)-65536*($=Math.floor(N/65536)),se=(N=se+$+65535)-65536*($=Math.floor(N/65536)),Lt=(N=Lt+$+65535)-65536*($=Math.floor(N/65536)),Et=(N=Et+$+65535)-65536*($=Math.floor(N/65536)),de=(N=de+$+65535)-65536*($=Math.floor(N/65536)),Pt=(N=Pt+$+65535)-65536*($=Math.floor(N/65536)),Mt=(N=Mt+$+65535)-65536*($=Math.floor(N/65536)),K=(N=K+$+65535)-65536*($=Math.floor(N/65536)),gt=(N=(gt+=$-1+37*($-1))+($=1)+65535)-65536*($=Math.floor(N/65536)),ft=(N=ft+$+65535)-65536*($=Math.floor(N/65536)),mt=(N=mt+$+65535)-65536*($=Math.floor(N/65536)),vt=(N=vt+$+65535)-65536*($=Math.floor(N/65536)),At=(N=At+$+65535)-65536*($=Math.floor(N/65536)),_t=(N=_t+$+65535)-65536*($=Math.floor(N/65536)),Gt=(N=Gt+$+65535)-65536*($=Math.floor(N/65536)),Rt=(N=Rt+$+65535)-65536*($=Math.floor(N/65536)),wt=(N=wt+$+65535)-65536*($=Math.floor(N/65536)),se=(N=se+$+65535)-65536*($=Math.floor(N/65536)),Lt=(N=Lt+$+65535)-65536*($=Math.floor(N/65536)),Et=(N=Et+$+65535)-65536*($=Math.floor(N/65536)),de=(N=de+$+65535)-65536*($=Math.floor(N/65536)),Pt=(N=Pt+$+65535)-65536*($=Math.floor(N/65536)),Mt=(N=Mt+$+65535)-65536*($=Math.floor(N/65536)),K=(N=K+$+65535)-65536*($=Math.floor(N/65536)),gt+=$-1+37*($-1),J[0]=gt,J[1]=ft,J[2]=mt,J[3]=vt,J[4]=At,J[5]=_t,J[6]=Gt,J[7]=Rt,J[8]=wt,J[9]=se,J[10]=Lt,J[11]=Et,J[12]=de,J[13]=Pt,J[14]=Mt,J[15]=K}function Z(J,X){D(J,X,X)}function F(J,X){var st,N=t();for(st=0;st<16;st++)N[st]=X[st];for(st=253;st>=0;st--)Z(N,N),st!==2&&st!==4&&D(N,N,X);for(st=0;st<16;st++)J[st]=N[st]}function q(J,X){var st,N=t();for(st=0;st<16;st++)N[st]=X[st];for(st=250;st>=0;st--)Z(N,N),st!==1&&D(N,N,X);for(st=0;st<16;st++)J[st]=N[st]}function it(J,X,st){var N,$,gt=new Uint8Array(32),ft=new Float64Array(80),mt=t(),vt=t(),At=t(),_t=t(),Gt=t(),Rt=t();for($=0;$<31;$++)gt[$]=X[$];for(gt[31]=127&X[31]|64,gt[0]&=248,y(ft,st),$=0;$<16;$++)vt[$]=ft[$],_t[$]=mt[$]=At[$]=0;for(mt[0]=_t[0]=1,$=254;$>=0;--$)h(mt,vt,N=gt[$>>>3]>>>(7&$)&1),h(At,_t,N),u(Gt,mt,At),b(mt,mt,At),u(At,vt,_t),b(vt,vt,_t),Z(_t,Gt),Z(Rt,mt),D(mt,At,mt),D(At,vt,Gt),u(Gt,mt,At),b(mt,mt,At),Z(vt,mt),b(At,_t,Rt),D(mt,At,l),u(mt,mt,_t),D(At,At,mt),D(mt,_t,Rt),D(_t,vt,ft),Z(vt,Gt),h(mt,vt,N),h(At,_t,N);for($=0;$<16;$++)ft[$+16]=mt[$],ft[$+32]=At[$],ft[$+48]=vt[$],ft[$+64]=_t[$];var wt=ft.subarray(32),se=ft.subarray(16);return F(wt,wt),D(se,se,wt),g(J,se),0}function at(J,X){return it(J,X,s)}function Bt(J,X){return e(X,32),at(J,X)}function yt(J,X,st){var N=new Uint8Array(32);return it(N,st,X),R(J,n,N,C)}nt.prototype.blocks=function(J,X,st){for(var N,$,gt,ft,mt,vt,At,_t,Gt,Rt,wt,se,Lt,Et,de,Pt,Mt,K,Y,V=this.fin?0:2048,U=this.h[0],W=this.h[1],et=this.h[2],dt=this.h[3],ut=this.h[4],ht=this.h[5],zt=this.h[6],Wt=this.h[7],ye=this.h[8],Yt=this.h[9],pe=this.r[0],ve=this.r[1],ge=this.r[2],ie=this.r[3],ue=this.r[4],fe=this.r[5],ce=this.r[6],Kt=this.r[7],oe=this.r[8],Jt=this.r[9];st>=16;)Rt=Gt=0,Rt+=(U+=8191&(N=255&J[X+0]|(255&J[X+1])<<8))*pe,Rt+=(W+=8191&(N>>>13|($=255&J[X+2]|(255&J[X+3])<<8)<<3))*(5*Jt),Rt+=(et+=8191&($>>>10|(gt=255&J[X+4]|(255&J[X+5])<<8)<<6))*(5*oe),Rt+=(dt+=8191&(gt>>>7|(ft=255&J[X+6]|(255&J[X+7])<<8)<<9))*(5*Kt),Gt=(Rt+=(ut+=8191&(ft>>>4|(mt=255&J[X+8]|(255&J[X+9])<<8)<<12))*(5*ce))>>>13,Rt&=8191,Rt+=(ht+=mt>>>1&8191)*(5*fe),Rt+=(zt+=8191&(mt>>>14|(vt=255&J[X+10]|(255&J[X+11])<<8)<<2))*(5*ue),Rt+=(Wt+=8191&(vt>>>11|(At=255&J[X+12]|(255&J[X+13])<<8)<<5))*(5*ie),Rt+=(ye+=8191&(At>>>8|(_t=255&J[X+14]|(255&J[X+15])<<8)<<8))*(5*ge),wt=Gt+=(Rt+=(Yt+=_t>>>5|V)*(5*ve))>>>13,wt+=U*ve,wt+=W*pe,wt+=et*(5*Jt),wt+=dt*(5*oe),Gt=(wt+=ut*(5*Kt))>>>13,wt&=8191,wt+=ht*(5*ce),wt+=zt*(5*fe),wt+=Wt*(5*ue),wt+=ye*(5*ie),Gt+=(wt+=Yt*(5*ge))>>>13,wt&=8191,se=Gt,se+=U*ge,se+=W*ve,se+=et*pe,se+=dt*(5*Jt),Gt=(se+=ut*(5*oe))>>>13,se&=8191,se+=ht*(5*Kt),se+=zt*(5*ce),se+=Wt*(5*fe),se+=ye*(5*ue),Lt=Gt+=(se+=Yt*(5*ie))>>>13,Lt+=U*ie,Lt+=W*ge,Lt+=et*ve,Lt+=dt*pe,Gt=(Lt+=ut*(5*Jt))>>>13,Lt&=8191,Lt+=ht*(5*oe),Lt+=zt*(5*Kt),Lt+=Wt*(5*ce),Lt+=ye*(5*fe),Et=Gt+=(Lt+=Yt*(5*ue))>>>13,Et+=U*ue,Et+=W*ie,Et+=et*ge,Et+=dt*ve,Gt=(Et+=ut*pe)>>>13,Et&=8191,Et+=ht*(5*Jt),Et+=zt*(5*oe),Et+=Wt*(5*Kt),Et+=ye*(5*ce),de=Gt+=(Et+=Yt*(5*fe))>>>13,de+=U*fe,de+=W*ue,de+=et*ie,de+=dt*ge,Gt=(de+=ut*ve)>>>13,de&=8191,de+=ht*pe,de+=zt*(5*Jt),de+=Wt*(5*oe),de+=ye*(5*Kt),Pt=Gt+=(de+=Yt*(5*ce))>>>13,Pt+=U*ce,Pt+=W*fe,Pt+=et*ue,Pt+=dt*ie,Gt=(Pt+=ut*ge)>>>13,Pt&=8191,Pt+=ht*ve,Pt+=zt*pe,Pt+=Wt*(5*Jt),Pt+=ye*(5*oe),Mt=Gt+=(Pt+=Yt*(5*Kt))>>>13,Mt+=U*Kt,Mt+=W*ce,Mt+=et*fe,Mt+=dt*ue,Gt=(Mt+=ut*ie)>>>13,Mt&=8191,Mt+=ht*ge,Mt+=zt*ve,Mt+=Wt*pe,Mt+=ye*(5*Jt),K=Gt+=(Mt+=Yt*(5*oe))>>>13,K+=U*oe,K+=W*Kt,K+=et*ce,K+=dt*fe,Gt=(K+=ut*ue)>>>13,K&=8191,K+=ht*ie,K+=zt*ge,K+=Wt*ve,K+=ye*pe,Y=Gt+=(K+=Yt*(5*Jt))>>>13,Y+=U*Jt,Y+=W*oe,Y+=et*Kt,Y+=dt*ce,Gt=(Y+=ut*fe)>>>13,Y&=8191,Y+=ht*ue,Y+=zt*ie,Y+=Wt*ge,Y+=ye*ve,U=Rt=8191&(Gt=(Gt=((Gt+=(Y+=Yt*pe)>>>13)<<2)+Gt|0)+(Rt&=8191)|0),W=wt+=Gt>>>=13,et=se&=8191,dt=Lt&=8191,ut=Et&=8191,ht=de&=8191,zt=Pt&=8191,Wt=Mt&=8191,ye=K&=8191,Yt=Y&=8191,X+=16,st-=16;this.h[0]=U,this.h[1]=W,this.h[2]=et,this.h[3]=dt,this.h[4]=ut,this.h[5]=ht,this.h[6]=zt,this.h[7]=Wt,this.h[8]=ye,this.h[9]=Yt},nt.prototype.finish=function(J,X){var st,N,$,gt,ft=new Uint16Array(10);if(this.leftover){for(gt=this.leftover,this.buffer[gt++]=1;gt<16;gt++)this.buffer[gt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(st=this.h[1]>>>13,this.h[1]&=8191,gt=2;gt<10;gt++)this.h[gt]+=st,st=this.h[gt]>>>13,this.h[gt]&=8191;for(this.h[0]+=5*st,st=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=st,st=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=st,ft[0]=this.h[0]+5,st=ft[0]>>>13,ft[0]&=8191,gt=1;gt<10;gt++)ft[gt]=this.h[gt]+st,st=ft[gt]>>>13,ft[gt]&=8191;for(ft[9]-=8192,N=(1^st)-1,gt=0;gt<10;gt++)ft[gt]&=N;for(N=~N,gt=0;gt<10;gt++)this.h[gt]=this.h[gt]&N|ft[gt];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),$=this.h[0]+this.pad[0],this.h[0]=65535&$,gt=1;gt<8;gt++)$=(this.h[gt]+this.pad[gt]|0)+($>>>16)|0,this.h[gt]=65535&$;J[X+0]=this.h[0]>>>0&255,J[X+1]=this.h[0]>>>8&255,J[X+2]=this.h[1]>>>0&255,J[X+3]=this.h[1]>>>8&255,J[X+4]=this.h[2]>>>0&255,J[X+5]=this.h[2]>>>8&255,J[X+6]=this.h[3]>>>0&255,J[X+7]=this.h[3]>>>8&255,J[X+8]=this.h[4]>>>0&255,J[X+9]=this.h[4]>>>8&255,J[X+10]=this.h[5]>>>0&255,J[X+11]=this.h[5]>>>8&255,J[X+12]=this.h[6]>>>0&255,J[X+13]=this.h[6]>>>8&255,J[X+14]=this.h[7]>>>0&255,J[X+15]=this.h[7]>>>8&255},nt.prototype.update=function(J,X,st){var N,$;if(this.leftover){for(($=16-this.leftover)>st&&($=st),N=0;N<$;N++)this.buffer[this.leftover+N]=J[X+N];if(st-=$,X+=$,this.leftover+=$,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(st>=16&&($=st-st%16,this.blocks(J,X,$),X+=$,st-=$),st){for(N=0;N=128;){for(V=0;V<16;V++)U=8*V+he,Wt[V]=st[U+0]<<24|st[U+1]<<16|st[U+2]<<8|st[U+3],ye[V]=st[U+4]<<24|st[U+5]<<16|st[U+6]<<8|st[U+7];for(V=0;V<80;V++)if($=Yt,gt=pe,ft=ve,mt=ge,vt=ie,At=ue,_t=fe,Rt=Kt,wt=oe,se=Jt,Lt=le,Et=ae,de=ne,Pt=Ot,dt=65535&(et=Nt),ut=et>>>16,ht=65535&(W=ce),zt=W>>>16,dt+=65535&(et=(ae>>>14|ie<<18)^(ae>>>18|ie<<14)^(ie>>>9|ae<<23)),ut+=et>>>16,ht+=65535&(W=(ie>>>14|ae<<18)^(ie>>>18|ae<<14)^(ae>>>9|ie<<23)),zt+=W>>>16,dt+=65535&(et=ae&ne^~ae&Ot),ut+=et>>>16,ht+=65535&(W=ie&ue^~ie&fe),zt+=W>>>16,W=lt[2*V],dt+=65535&(et=lt[2*V+1]),ut+=et>>>16,ht+=65535&W,zt+=W>>>16,W=Wt[V%16],ut+=(et=ye[V%16])>>>16,ht+=65535&W,zt+=W>>>16,ht+=(ut+=(dt+=65535&et)>>>16)>>>16,dt=65535&(et=Y=65535&dt|ut<<16),ut=et>>>16,ht=65535&(W=K=65535&ht|(zt+=ht>>>16)<<16),zt=W>>>16,dt+=65535&(et=(Kt>>>28|Yt<<4)^(Yt>>>2|Kt<<30)^(Yt>>>7|Kt<<25)),ut+=et>>>16,ht+=65535&(W=(Yt>>>28|Kt<<4)^(Kt>>>2|Yt<<30)^(Kt>>>7|Yt<<25)),zt+=W>>>16,ut+=(et=Kt&oe^Kt&Jt^oe&Jt)>>>16,ht+=65535&(W=Yt&pe^Yt&ve^pe&ve),zt+=W>>>16,Gt=65535&(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)|(zt+=ht>>>16)<<16,Mt=65535&dt|ut<<16,dt=65535&(et=Lt),ut=et>>>16,ht=65535&(W=mt),zt=W>>>16,ut+=(et=Y)>>>16,ht+=65535&(W=K),zt+=W>>>16,pe=$,ve=gt,ge=ft,ie=mt=65535&(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)|(zt+=ht>>>16)<<16,ue=vt,fe=At,ce=_t,Yt=Gt,oe=Rt,Jt=wt,le=se,ae=Lt=65535&dt|ut<<16,ne=Et,Ot=de,Nt=Pt,Kt=Mt,V%16==15)for(U=0;U<16;U++)W=Wt[U],dt=65535&(et=ye[U]),ut=et>>>16,ht=65535&W,zt=W>>>16,W=Wt[(U+9)%16],dt+=65535&(et=ye[(U+9)%16]),ut+=et>>>16,ht+=65535&W,zt+=W>>>16,K=Wt[(U+1)%16],dt+=65535&(et=((Y=ye[(U+1)%16])>>>1|K<<31)^(Y>>>8|K<<24)^(Y>>>7|K<<25)),ut+=et>>>16,ht+=65535&(W=(K>>>1|Y<<31)^(K>>>8|Y<<24)^K>>>7),zt+=W>>>16,K=Wt[(U+14)%16],ut+=(et=((Y=ye[(U+14)%16])>>>19|K<<13)^(K>>>29|Y<<3)^(Y>>>6|K<<26))>>>16,ht+=65535&(W=(K>>>19|Y<<13)^(Y>>>29|K<<3)^K>>>6),zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,Wt[U]=65535&ht|zt<<16,ye[U]=65535&dt|ut<<16;dt=65535&(et=Kt),ut=et>>>16,ht=65535&(W=Yt),zt=W>>>16,W=J[0],ut+=(et=X[0])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[0]=Yt=65535&ht|zt<<16,X[0]=Kt=65535&dt|ut<<16,dt=65535&(et=oe),ut=et>>>16,ht=65535&(W=pe),zt=W>>>16,W=J[1],ut+=(et=X[1])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[1]=pe=65535&ht|zt<<16,X[1]=oe=65535&dt|ut<<16,dt=65535&(et=Jt),ut=et>>>16,ht=65535&(W=ve),zt=W>>>16,W=J[2],ut+=(et=X[2])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[2]=ve=65535&ht|zt<<16,X[2]=Jt=65535&dt|ut<<16,dt=65535&(et=le),ut=et>>>16,ht=65535&(W=ge),zt=W>>>16,W=J[3],ut+=(et=X[3])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[3]=ge=65535&ht|zt<<16,X[3]=le=65535&dt|ut<<16,dt=65535&(et=ae),ut=et>>>16,ht=65535&(W=ie),zt=W>>>16,W=J[4],ut+=(et=X[4])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[4]=ie=65535&ht|zt<<16,X[4]=ae=65535&dt|ut<<16,dt=65535&(et=ne),ut=et>>>16,ht=65535&(W=ue),zt=W>>>16,W=J[5],ut+=(et=X[5])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[5]=ue=65535&ht|zt<<16,X[5]=ne=65535&dt|ut<<16,dt=65535&(et=Ot),ut=et>>>16,ht=65535&(W=fe),zt=W>>>16,W=J[6],ut+=(et=X[6])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[6]=fe=65535&ht|zt<<16,X[6]=Ot=65535&dt|ut<<16,dt=65535&(et=Nt),ut=et>>>16,ht=65535&(W=ce),zt=W>>>16,W=J[7],ut+=(et=X[7])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[7]=ce=65535&ht|zt<<16,X[7]=Nt=65535&dt|ut<<16,he+=128,N-=128}return N}function Tt(J,X,st){var N,$=new Int32Array(8),gt=new Int32Array(8),ft=new Uint8Array(256),mt=st;for($[0]=1779033703,$[1]=3144134277,$[2]=1013904242,$[3]=2773480762,$[4]=1359893119,$[5]=2600822924,$[6]=528734635,$[7]=1541459225,gt[0]=4089235720,gt[1]=2227873595,gt[2]=4271175723,gt[3]=1595750129,gt[4]=2917565137,gt[5]=725511199,gt[6]=4215389547,gt[7]=327033209,ct($,gt,X,st),st%=128,N=0;N=0;--$)k(J,X,N=st[$/8|0]>>(7&$)&1),kt(X,J),kt(J,J),k(J,X,N)}function j(J,X){var st=[t(),t(),t(),t()];a(st[0],v),a(st[1],_),a(st[2],c),D(st[3],v,_),L(J,st,X)}function rt(J,X,st){var N,$=new Uint8Array(64),gt=[t(),t(),t(),t()];for(st||e(X,32),Tt($,X,32),$[0]&=248,$[31]&=127,$[31]|=64,j(gt,$),T(J,gt),N=0;N<32;N++)X[N+32]=J[N];return 0}var Q=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 ot(J,X){var st,N,$,gt;for(N=63;N>=32;--N){for(st=0,$=N-32,gt=N-12;$>4)*Q[$],st=X[$]>>8,X[$]&=255;for($=0;$<32;$++)X[$]-=st*Q[$];for(N=0;N<32;N++)X[N+1]+=X[N]>>8,J[N]=255&X[N]}function qt(J){var X,st=new Float64Array(64);for(X=0;X<64;X++)st[X]=J[X];for(X=0;X<64;X++)J[X]=0;ot(J,st)}function It(J,X,st,N){var $,gt,ft=new Uint8Array(64),mt=new Uint8Array(64),vt=new Uint8Array(64),At=new Float64Array(64),_t=[t(),t(),t(),t()];Tt(ft,N,32),ft[0]&=248,ft[31]&=127,ft[31]|=64;var Gt=st+64;for($=0;$>7&&b(At[0],i,At[0]),D(At[3],At[0],At[1]),0)}(vt,N))return-1;for($=0;$=0},r.sign.keyPair=function(){var J=new Uint8Array(Dt),X=new Uint8Array(Se);return rt(J,X),{publicKey:J,secretKey:X}},r.sign.keyPair.fromSecretKey=function(J){if(Ut(J),J.length!==Se)throw new Error("bad secret key size");for(var X=new Uint8Array(Dt),st=0;st{if(t.includes(".")||t.trim().toLowerCase()!==t)throw new Bl(Il.InvalidDomain);const[l]=Xt.findProgramAddressSync([v0.toBuffer()],v0),p=i7(t),m=o7(p,void 0,T4),v=i7(m.toBase58()),_=o7(v,l),[E]=Xt.findProgramAddressSync([m.toBuffer()],v0),w=LA.findIndex(tt=>c==null?void 0:c.equals(tt));let x;const A=[];if(w!==-1&&c){x=m4(i,c,!0);const tt=await r.getAccountInfo(x);if(!(tt!=null&&tt.data)){const nt=kj(n,x,c,i);A.push(nt)}}const B=new T8.PythHttpClient(r,T8.getPythProgramKeyForCluster("mainnet-beta")),P=await B.getData(),R=CK.get(i.toBase58());if(!R)throw new Bl(Il.SymbolNotFound,`No symbol found for mint ${i.toBase58()}`);const C=P.productPrice.get("Crypto."+R+"/USD"),O=P.productFromSymbol.get("Crypto."+R+"/USD"),z=m4(i,LK),H=new oh({name:t,space:e,referrerIdxOpt:w!=-1?w:null}).getInstruction(v0,TA,T4,m,_,an.programId,l,n,s,TK,C.productAccountKey,new Xt(O.price_account),z,kl,na,E,x);return A.push(H),[[],A]};new Xt("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var m7;(function(r){r.DegenPoet1="DegenPoet#1",r.Rgb0x001="rgb0x00#1"})(m7||(m7={}));new Xt("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");new Xt("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g");const AZ=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),L0=(r,t)=>{const e=AZ.format(r);return t?e.replace("$",""):e},mh=[{decimals:6,tokenSymbol:"USDC",mintAddress:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",tokenName:"USD Coin",pythFeed:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",icon:"https://raw.githubusercontent.com/trustwallet/assets/f3ffd0b9ae2165336279ce2f8db1981a55ce30f8/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{decimals:9,tokenSymbol:"SOL",mintAddress:"So11111111111111111111111111111111111111112",pythFeed:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",tokenName:"Wrapped SOL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{decimals:6,tokenSymbol:"FIDA",mintAddress:"EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",tokenName:"Bonfida Token",pythFeed:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp/logo.svg"},{decimals:6,tokenSymbol:"USDT",mintAddress:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",tokenName:"USDT",pythFeed:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/D3KdBta3p53RV5FoahnJM5tP45h6Fd3AyFYgXTJvGCaK/logo.svg"},{decimals:9,tokenSymbol:"mSOL",mintAddress:"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",tokenName:"mSOL",pythFeed:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So/logo.png"},{decimals:5,tokenSymbol:"BONK",mintAddress:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",tokenName:"BONK",pythFeed:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",icon:"https://solana.fm/api/image-proxy?imageUrl=https://arweave.net/hQiPZOsRZXGXBJd_82PhVdlM_hACsT_q6wqwf5cSY7I"},{decimals:8,tokenSymbol:"BAT",mintAddress:"EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",tokenName:"BAT",pythFeed:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz/logo.png"}],SZ=r=>{var t;return(t=mh.find(e=>e.tokenSymbol===r))==null?void 0:t.icon},O0="EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",Tk=1232,kZ=(r,t,e="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{const n=[];let s=[];for(const i of r)IZ([...s,i],t,e)>Tk?(n.push(s),s=[i]):s.push(i);return s.length>0&&n.push(s),n},IZ=(r,t,e="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{try{const n=new Zl().add(...r);return n.recentBlockhash=e,n.feePayer=t,n.serialize({requireAllSignatures:!1,verifySignatures:!1}).length}catch{return Tk+1}},BZ=async(r,t,e,n)=>{let s=n;const i=[],c=await r.getBalance(e),l=await r.getAccountInfo(t);if(!l||!l.data){const m=gT(e,t,e,wg);i.push(m)}else{const m=await r.getTokenAccountBalance(t,"processed");if(c+parseInt(m.value.amount)[mT(r,t,t)];function RZ(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var CZ="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",TZ="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",vb=0,Lk=-3;function vh(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function LZ(r,t){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new vh,this.dtree=new vh}var Ok=new vh,Uk=new vh,Vv=new Uint8Array(30),Zv=new Uint16Array(30),Nk=new Uint8Array(30),Dk=new Uint16Array(30),OZ=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),v7=new vh,So=new Uint8Array(320);function g7(r,t,e,n){var s,i;for(s=0;s>>=1,t}function Co(r,t,e){if(!t)return e;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>16-t;return r.tag>>>=t,r.bitcount-=t,n+e}function Wv(r,t){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>=1,++s,e+=t.table[s],n-=t.table[s];while(n>=0);return r.tag=i,r.bitcount-=s,t.trans[e+n]}function NZ(r,t,e){var n,s,i,c,l,p;for(n=Co(r,5,257),s=Co(r,5,1),i=Co(r,4,4),c=0;c<19;++c)So[c]=0;for(c=0;c8;)r.sourceIndex--,r.bitcount-=8;if((t=256*(t=r.source[r.sourceIndex+1])+r.source[r.sourceIndex])!==(65535&~(256*r.source[r.sourceIndex+3]+r.source[r.sourceIndex+2])))return Lk;for(r.sourceIndex+=4,e=t;e;--e)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,vb}(function(r,t){var e;for(e=0;e<7;++e)r.table[e]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,e=0;e<24;++e)r.trans[e]=256+e;for(e=0;e<144;++e)r.trans[24+e]=e;for(e=0;e<8;++e)r.trans[168+e]=280+e;for(e=0;e<112;++e)r.trans[176+e]=144+e;for(e=0;e<5;++e)t.table[e]=0;for(t.table[5]=32,e=0;e<32;++e)t.trans[e]=e})(Ok,Uk),g7(Vv,Zv,4,3),g7(Nk,Dk,2,1),Vv[28]=0,Zv[28]=258;var zZ=function(r,t){var e,n,s=new LZ(r,t);do{switch(e=UZ(s),Co(s,2,0)){case 0:n=DZ(s);break;case 1:n=b7(s,Ok,Uk);break;case 2:NZ(s,s.ltree,s.dtree),n=b7(s,s.ltree,s.dtree);break;default:n=Lk}if(n!==vb)throw new Error("Data error")}while(!e);return s.destLen{let n=r[t];r[t]=r[e],r[e]=n};var FZ={swap32LE:r=>{qZ&&(t=>{const e=t.length;for(let n=0;n1114111?this.errorValue:r<55296||r>56319&&r<=65535?(t=(this.data[r>>5]<<2)+(31&r),this.data[t]):r<=65535?(t=(this.data[2048+(r-55296>>5)]<<2)+(31&r),this.data[t]):r>11)],t=this.data[t+(r>>5&63)],t=(t<<2)+(31&r),this.data[t]):this.data[this.data.length-4]}},zk={exports:{}};zk.exports=(M7=_7="3.7.5",E7=typeof atob=="function",A7=typeof btoa=="function",ba=typeof Zt.Buffer=="function",Dm=typeof TextDecoder=="function"?new TextDecoder:void 0,zm=typeof TextEncoder=="function"?new TextEncoder:void 0,S7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",xu=Array.prototype.slice.call(S7),r2={},xu.forEach(function(r,t){return r2[r]=t}),bc=r2,k7=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bn=String.fromCharCode.bind(String),qm=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},Fm=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,function(t){return t=="+"?"-":"_"})},jm=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},Km=function(r){for(var t,e,n,s,i="",c=r.length%3,l=0;l255||(n=r.charCodeAt(l++))>255||(s=r.charCodeAt(l++))>255)throw new TypeError("invalid character found");i+=xu[(t=e<<16|n<<8|s)>>18&63]+xu[t>>12&63]+xu[t>>6&63]+xu[63&t]}return c?i.slice(0,c-3)+"===".substring(c):i},U0=ba?function(r){return Zt.Buffer.from(r).toString("base64")}:function(r){for(var t=4096,e=[],n=0,s=r.length;n>>6)+bn(128|63&t):bn(224|t>>>12&15)+bn(128|t>>>6&63)+bn(128|63&t);var t=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return bn(240|t>>>18&7)+bn(128|t>>>12&63)+bn(128|t>>>6&63)+bn(128|63&t)},B7=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Hm=ba?function(r){return Zt.Buffer.from(r,"utf8").toString("base64")}:zm?function(r){return U0(zm.encode(r))}:function(r){return $m(P7(r))},Vm=function(r){return _u(r,!0)},R7=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,C7=function(r){switch(r.length){case 4:var t=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return bn(55296+(t>>>10))+bn(56320+(1023&t));case 3:return bn((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return bn((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},Zm=function(r){if(r=r.replace(/\s+/g,""),!k7.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var t,e,n,s="",i=0;i>16&255):n===64?bn(t>>16&255,t>>8&255):bn(t>>16&255,t>>8&255,255&t);return s},Gm=ba?function(r){return qm(Zt.Buffer.from(r,"base64"))}:function(r){return qm(Wm(r).split("").map(function(t){return t.charCodeAt(0)}))},Ym=function(r){return Gm(Xm(r))},L7=ba?function(r){return Zt.Buffer.from(r,"base64").toString("utf8")}:Dm?function(r){return Dm.decode(Gm(r))}:function(r){return T7(Wm(r))},Xm=function(r){return jm(r.replace(/[-_]/g,function(t){return t=="-"?"+":"/"}))},Qm=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},t2=function(){var r=function(t,e){return Object.defineProperty(String.prototype,t,Qm(e))};r("fromBase64",function(){return Jm(this)}),r("toBase64",function(t){return _u(this,t)}),r("toBase64URI",function(){return _u(this,!0)}),r("toBase64URL",function(){return _u(this,!0)}),r("toUint8Array",function(){return Ym(this)})},e2=function(){var r=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,Qm(e))};r("toBase64",function(t){return N0(this,t)}),r("toBase64URI",function(){return N0(this,!0)}),r("toBase64URL",function(){return N0(this,!0)})},O7=function(){t2(),e2()},wc={version:_7,VERSION:M7,atob:Wm=E7?function(r){return atob(jm(r))}:ba?function(r){return Zt.Buffer.from(r,"base64").toString("binary")}:Zm,atobPolyfill:Zm,btoa:$m=A7?function(r){return btoa(r)}:ba?function(r){return Zt.Buffer.from(r,"binary").toString("base64")}:Km,btoaPolyfill:Km,fromBase64:Jm=function(r){return L7(Xm(r))},toBase64:_u=function(r,t){return t===void 0&&(t=!1),t?Fm(Hm(r)):Hm(r)},encode:_u,encodeURI:Vm,encodeURL:Vm,utob:P7=function(r){return r.replace(B7,I7)},btou:T7=function(r){return r.replace(R7,C7)},decode:Jm,isValid:function(r){if(typeof r!="string")return!1;var t=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:N0=function(r,t){return t===void 0&&(t=!1),t?Fm(U0(r)):U0(r)},toUint8Array:Ym,extendString:t2,extendUint8Array:e2,extendBuiltins:O7,Base64:{}},Object.keys(wc).forEach(function(r){return wc.Base64[r]=wc[r]}),wc);const Sr={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},$Z=CZ,HZ=TZ,qk=KZ,Fk=zk.exports.Base64,VZ=new qk(Fk.toUint8Array($Z)),ZZ=new qk(Fk.toUint8Array(HZ));function fn(r,t){return(r&t)!=0}const D0=0,n2=1,i2=2;function WZ(r,t){const e=r.length;let n=0,s=D0;for(let i=t;i+165535?2:1,e.push(s)}for(let s=0;sXZ.has(r),jk=/a-z/,Kk=/абвгдеёжзийклмнопрстуфхцчшщъыьэюя/,$k=/\u4e00-\u9fa5/,Hk=/ぁ-んァ-ン/,fa=/0-9/,ca=/\_\-/,Vk=/\u1100-\u115E\u1161-\u11FF\u302E\u302F\u3131-\u3163\u3165-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD158\uD160-\uD172\uD17B-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA1-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/,Zk=/\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061D-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F/,QZ=new RegExp("^["+(jk.source+Kk.source+$k.source+Hk.source+Vk.source+Zk.source+fa.source+ca.source)+"]+$"),Rs=(r,t)=>r?!!t.test(r):!0,yb=r=>Rs(r,QZ),tW=r=>{const t=new RegExp("^["+jk.source+fa.source+ca.source+"]+$");return Rs(r,t)},eW=r=>{const t=new RegExp("^["+$k.source+fa.source+ca.source+"]+$");return Rs(r,t)},rW=r=>{const t=new RegExp("^["+Hk.source+fa.source+ca.source+"]+$");return Rs(r,t)},nW=r=>{const t=new RegExp("^["+Kk.source+fa.source+ca.source+"]+$");return Rs(r,t)},iW=r=>{const t=new RegExp("^["+fa.source+"]+$");return Rs(r,t)},oW=r=>{const t=new RegExp("^["+ca.source+"]+$");return Rs(r,t)},sW=r=>{const t=new RegExp("^["+Vk.source+fa.source+ca.source+"]+$");return Rs(r,t)},aW=r=>{const t=new RegExp("^["+Zk.source+fa.source+ca.source+"]+$");return Rs(r,t)},uW=["🥷","🦣","🦬"],U7=r=>GZ.has(r),Wk=r=>{if(!r)return!1;if(U7(r))return!0;const t=gb(r);for(let e of t){if(uW.includes(e)||e.length===0||JZ(e)||YZ.has(e))return!1;if(!yb(e)&&!U7(e))return!1}return!0};var Bo;(function(r){r[r.English=0]="English",r[r.Cyrillic=1]="Cyrillic",r[r.Chinese=2]="Chinese",r[r.Japanese=3]="Japanese",r[r.Emoji=4]="Emoji",r[r.Unauthorized=5]="Unauthorized",r[r.Korean=6]="Korean",r[r.Arabic=7]="Arabic"})(Bo||(Bo={}));const Gk=r=>gb(r).length>1?Bo.Unauthorized:tW(r)?Bo.English:eW(r)?Bo.Chinese:nW(r)?Bo.Cyrillic:rW(r)?Bo.Japanese:sW(r)?Bo.Korean:aW(r)?Bo.Arabic:Bo.Unauthorized,fW=(r,t)=>{const e=gb(r);for(let n of e){const s=yb(n),i=Wk(n);if((s||!i)&&!oW(n)&&!iW(n)&&t!==Gk(n))return!1}return!0},cW=["","."],hW=({value:r,prev:t,onError:e})=>{if(cW.includes(r))return"";r.endsWith(".sol")&&(r=r.split(".sol")[0]);const n=r.toLowerCase().trim(),s=n.split(".");if(s.length>2)return e==null||e(),t;for(const c of s){const l=yb(c),p=Wk(c);if(!l&&!p||!fW(c,Gk(r[0]||"")))return e==null||e(),t}return n},Yk=(r,t,e=5)=>r?r.length<=t?r:r.slice(0,t-e)+"..."+r.slice(-e):"",Xk=({domain:r,available:t=!1,price:e,children:n})=>St.jsxs("div",{className:"flex flex-row items-center gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary min-h-[72px]",children:[St.jsxs("div",{className:"flex flex-col mr-auto",children:[St.jsx("span",{className:"text-base text-content-secondary font-primary",children:Yk(`${r}.sol`,25,3)}),t&&St.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium",children:[St.jsx("img",{className:"w-4 h-4",src:SZ("USDC"),alt:"$"}),e]})]}),n]}),N7=({domain:r,available:t=!1,price:e})=>{const{cart:n,addToCart:s,removeFromCart:i}=xe.useContext(Ah);e=e??Pk(r);const c=!!n[r],[l,p]=xe.useState(c),m=v=>{p(!1),i(v)};return xe.useEffect(()=>{let v;return c&&!l&&(v=setTimeout(()=>{p(!0)},1500)),()=>clearTimeout(v)},[c,l]),St.jsxs(Xk,{domain:r,available:t,price:e,children:[!t&&St.jsx("div",{className:"px-3 rounded-lg bg-accent bg-opacity-10",children:St.jsx("span",{className:"text-xs font-semibold leading-6 tracking-widest text-accent",children:"Registered"})}),t&&St.jsx("div",{className:sn("flex items-center flex-row justify-between min-w-[93px]",t?"gap-2":"gap-1"),children:St.jsx("button",{type:"button",className:sn("flex items-center gap-2 px-3 py-1 text-sm text-base-button-content rounded-lg font-primary bg-theme-primary",c&&l&&"bg-transparent text-theme-primary dark:text-theme-secondary"),tabIndex:0,onClick:()=>c?m(r):s({domain:r,storage:1e3,price:Number(e)}),children:c?St.jsx(St.Fragment,{children:l?St.jsxs(St.Fragment,{children:["Remove",St.jsx(VM,{width:24,height:24})]}):St.jsxs(St.Fragment,{children:["Added",St.jsx(lz,{width:24,height:24})]})}):St.jsxs(St.Fragment,{children:["Add to cart",St.jsx(hz,{width:20,height:20})]})})})]})},D7=()=>St.jsxs("div",{className:"flex flex-row items-center justify-between gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary h-[72px] animate-pulse",children:[St.jsx("div",{className:"w-[80px] h-4 rounded-full bg-background-skeleton"}),St.jsx("div",{className:"h-4 rounded-full w-[120px] bg-background-skeleton"})]}),Gv=({className:r,children:t,size:e="full",disabled:n,...s})=>St.jsx("button",{type:"button",disabled:n,...s,tabIndex:0,className:sn("flex items-center gap-2 px-3 justify-center text-white font-primary bg-theme-primary",e==="full"&&"py-2.5 rounded-xl tracking-wide",e==="small"&&"text-sm py-1 rounded-lg",n&&"bg-theme-secondary",r),children:t}),z7=()=>St.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 69 20",className:"h-full",children:[St.jsx("path",{d:"m8.843.27-.124.001.005 4.563h.124L8.843.27ZM16.8 14.917l-3.71-2.271.062-.125 3.71 2.27-.063.126ZM.788 14.917l-.061-.125 3.709-2.271.062.125-3.71 2.27Z"}),St.jsx("path",{d:"M8.784 10.104c-.021 0-.042 0-.042-.02L4.415 7.478a.159.159 0 0 1-.041-.083c0-.042.02-.063.041-.084l4.327-2.604c.021-.02.062-.02.103 0l4.328 2.625c.02.021.04.063.04.084 0 .041-.02.062-.04.083l-4.328 2.604h-.061Zm-4.142-2.73 4.121 2.5 4.121-2.478-4.121-2.5-4.121 2.479Z"}),St.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021l-4.327-2.584a.159.159 0 0 1-.041-.083V7.396c0-.042.02-.063.041-.083.02-.021.062-.021.103 0l4.327 2.604c.021.02.042.062.042.083v5.188c0 .041-.021.062-.042.083-.04.02-.061.02-.061.02Zm-4.225-2.75 4.122 2.479v-4.959l-4.122-2.5v4.98Z"}),St.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021a.159.159 0 0 1-.04-.084V10c0-.042.02-.063.04-.083l4.328-2.604c.02-.021.062-.021.103 0 .02.02.04.062.04.083v5.229c0 .042-.02.063-.04.083l-4.328 2.584h-.061Zm.082-5.23v4.959l4.121-2.459v-5l-4.12 2.5Z"}),St.jsx("path",{d:"M8.784 20 .5 15V5l8.284-5 8.283 5v10l-8.283 5Zm-7.83-5.27 7.809 4.728 7.81-4.729V5.271L8.783.563.954 5.27v9.458Z"}),St.jsx("path",{d:"M8.763 10.292.623 5.354C.522 5.292.48 5.146.542 5.021c.062-.125.206-.146.31-.084L8.762 9.73l7.954-4.792c.103-.062.247-.02.31.084.06.125.02.27-.083.333l-8.181 4.938Z"}),St.jsx("path",{d:"M8.784 19.958c-.124 0-.227-.104-.227-.25V10c0-.125.103-.25.227-.25.123 0 .226.104.226.25v9.708c0 .146-.103.25-.226.25ZM30.4 12.125c0 1.5-1.154 2.438-3.01 2.438h-3.585V5.979h3.38c1.834 0 2.988.854 2.988 2.25a1.97 1.97 0 0 1-1.32 1.875c.949.271 1.546 1.063 1.546 2.021Zm-3.215-2.562c.886 0 1.422-.438 1.422-1.167 0-.688-.536-1.125-1.422-1.125H25.35v2.292h1.834Zm.165 3.708c.886 0 1.442-.458 1.442-1.208 0-.73-.577-1.209-1.525-1.209h-1.916v2.417h1.999ZM31.327 11.167c0-2.209 1.277-3.542 3.38-3.542 2.1 0 3.378 1.333 3.378 3.542 0 2.208-1.277 3.541-3.379 3.541-2.102 0-3.38-1.333-3.38-3.541Zm3.38 2.333c1.194 0 1.915-.896 1.915-2.333 0-1.459-.72-2.334-1.916-2.334-1.195 0-1.937.896-1.937 2.334 0 1.458.742 2.333 1.937 2.333ZM42.825 8.875c-.804 0-1.463.5-1.937 1.604v4.084h-1.463V7.77h1.401l.041 1c.557-.77 1.36-1.167 2.205-1.167 1.525 0 2.473 1.042 2.473 2.625v4.313h-1.443v-4.209c.021-.895-.494-1.458-1.277-1.458ZM49.09 14.563h-1.443V8.957H46.43V7.771h1.216v-.73c0-1.374.783-2.229 2.06-2.229h1.628V6h-1.133c-.804 0-1.113.25-1.113 1v.75h4.08v6.792h-1.442V8.958h-2.638v5.604ZM59.763 8.604V5.5h1.443v9.063h-1.381l-.041-.855c-.454.625-1.237 1-2.123 1-1.772 0-3.008-1.5-3.008-3.541 0-2.042 1.236-3.542 3.008-3.542.886 0 1.628.375 2.102.98ZM57.991 13.5c.824 0 1.463-.52 1.772-1.333v-2c-.288-.813-.948-1.334-1.772-1.334-1.133 0-1.916.98-1.916 2.334.02 1.354.783 2.333 1.916 2.333ZM67.078 13.646c-.453.708-1.236 1.062-2.184 1.062-1.298 0-2.164-.791-2.164-2 0-1.395 1.092-2.208 2.926-2.208h1.402v-.417c0-.854-.577-1.395-1.525-1.395-.907 0-1.505.479-1.566 1.25h-1.422c.103-1.438 1.277-2.334 3.05-2.334 1.792 0 2.905.938 2.905 2.542v4.396h-1.38l-.042-.896Zm-1.854-.104c.803 0 1.421-.438 1.834-1.188v-.791l-1.443.02c-.906 0-1.442.355-1.442 1.063 0 .52.35.896 1.05.896Z"})]}),lW=({domain:r,onEdit:t})=>{const{cart:e,removeFromCart:n}=xe.useContext(Ah),s=e[r];return St.jsx(Xk,{domain:s.domain,available:!0,price:s.price,children:St.jsxs("div",{className:"flex flex-col items-end gap-2 text-sm",children:[St.jsxs("div",{className:"flex flex-row gap-2",children:[St.jsxs("span",{children:["Storage: ",s.storage/1e3,"kB"]}),St.jsxs("button",{type:"button",className:"flex items-center text-theme-primary dark:text-theme-secondary gap-0.5",tabIndex:0,onClick:t,children:["Edit",St.jsx(cz,{width:16,height:16})]})]}),St.jsxs("button",{type:"button",className:"flex items-center gap-2 text-theme-primary dark:text-theme-secondary",tabIndex:0,onClick:()=>n(r),children:["Remove",St.jsx(VM,{width:20,height:20})]})]})})},q7=({children:r,isVisible:t,toggleVisibility:e})=>{const n=xe.useRef(null),s=c=>{c.preventDefault(),c.target===n.current&&e(!t)},i=xe.useCallback(c=>{c.code==="Escape"&&e(!1)},[e]);return xe.useEffect(()=>{t&&document.addEventListener("keydown",i),t||document.removeEventListener("keydown",i)},[t,i]),t?St.jsx("div",{className:sn("animate-modal-fade-in absolute top-0 bottom-0 left-0 right-0","bg-modal-overlay-bg bg-opacity-60 z-[1]","flex items-center justify-center"),ref:n,onClick:s,children:r}):null},dW=new Ne("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),pW=new Ne("H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG"),mW=new Ne("Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD"),vW=new Ne("3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL"),gW=new Ne("E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9"),yW=new Ne("8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN"),bW=new Ne("AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz"),F7=new Map([["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",dW],["So11111111111111111111111111111111111111112",pW],["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",mW],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",vW],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",gW],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",yW],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",bW]]),wW=async(r,t)=>{var s;const e=(s=await r.getAccountInfo(t))==null?void 0:s.data;if(!e)throw new Error("Unable to retrieve oracle data");const n=ND.parsePriceData(e);return n.price||n.previousPrice},xW=()=>{const{connection:r}=vg();return yg(async()=>{var n;if(!r)return;const e=new Map;for(const s of F7.keys())e.set(s,{price:await wW(r,F7.get(s)),decimals:((n=mh.find(i=>i.mintAddress===s))==null?void 0:n.decimals)||4});return e},[!!r])},_W=async(r,t)=>{var e;try{const n=await r.getTokenAccountBalance(t);return((e=n==null?void 0:n.value)==null?void 0:e.uiAmount)||0}catch{return 0}},MW=()=>{const{publicKey:r,connection:t}=ad(),[e,n]=xe.useState({}),s=xe.useCallback(async()=>{if(r){const i={};for(const c of mh){const l=new Ne(c.mintAddress),p=n9(l,r),m=await _W(t,p);if(l.equals(wg)){const v=await t.getBalance(r)/dI;i[c.tokenSymbol]=v+m}else i[c.tokenSymbol]=m}n(i)}},[r,t]);return xe.useEffect(()=>{s()},[r,t,s]),{balances:e}},EW=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-10 grow",children:[St.jsx("div",{className:"w-[76px] h-[76px] rounded-full border-4 border-theme-secondary border-t-theme-primary animate-spin"}),St.jsx("span",{className:"max-w-[225px] font-primary text-center font-medium tracking-wider",children:"Your transaction is being processed..."})]}),AW=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[St.jsx(pz,{width:90,height:90,className:"text-theme-primary text-opacity-60"}),St.jsx("p",{className:"text-lg font-bold font-primary",children:"Congrats on registering your domains!"}),St.jsxs("p",{className:"text-sm font-primary",children:["Head over to",St.jsx("a",{href:"https://www.sns.id/",rel:"noopener",target:"_blank",className:"mx-1 text-theme-primary",children:"sns.id"}),"to learn how to take full advantage of your domains"]})]}),SW=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[St.jsx(WM,{width:90,height:90,className:"rotate-180 text-theme-primary text-opacity-60"}),St.jsx("p",{className:"text-lg font-bold font-primary",children:"Something went wrong"}),St.jsx("p",{className:"text-sm font-primary",children:"Please retry the process"})]}),kW=[{label:"1kb",value:1e3},{label:"2kb",value:2e3},{label:"3kb",value:3e3},{label:"4kb",value:4e3},{label:"5kb",value:5e3},{label:"6kb",value:6e3},{label:"7kb",value:7e3},{label:"8kb",value:8e3},{label:"9kb",value:9e3},{label:"10kb",value:1e4}],IW=({backHandler:r})=>{const t=xW(),{publicKey:e,connection:n,signAllTransactions:s}=ad(),{balances:i}=MW(),[c,l]=xe.useState(1),{cart:p,emptyCart:m,addToCart:v,referrerKey:_}=xe.useContext(Ah),{setError:E}=xe.useContext(sd),[w,x]=xe.useState(mh[0]),[A,B]=xe.useState(!1),[P,R]=xe.useState(""),[C,O]=xe.useState("registering"),z=w.mintAddress===O0,H=z?.95:1,tt=Object.values(p).reduce((h,g)=>h+Pk(g.domain)*H,0);xe.useEffect(()=>{},[e,n]);const nt=h=>{var S,I;const g=(I=(S=t.result)==null?void 0:S.get(h))==null?void 0:I.price;return tt/(g||1)},G=h=>{const g=nt(h);return h===O0?g*.95:g};xe.useEffect(()=>{Object.keys(p).length||r()},[p,r]);const M={1:"w-[33%]",2:"w-[66%]",3:"w-full"},d=()=>{c===2?l(1):r()},o=async()=>{switch(c){case 2:await f();break;case 3:C==="error"&&await f(),C==="success"&&(m(),r(!0));break;default:l(c+1);break}},a=G(w.mintAddress),f=async()=>{if(!(!n||!e||!s)){if(i[w.tokenSymbol]_.equals(F)):void 0);h.push(...Z)}if(wg.equals(S)){const D=await BZ(n,I,g,Math.ceil(a*1.01*Math.pow(10,9))),Z=PZ(I,g);h=[...D,...h,...Z]}const y=kZ(h,g),{blockhash:u}=await n.getLatestBlockhash();let b=y.map(D=>new Zl().add(...D));b.forEach(D=>{D.feePayer=g,D.recentBlockhash=u}),b=await s(b);for(const D of b){const Z=await n.sendRawTransaction(D.serialize());await n.confirmTransaction(Z),console.log(Z)}O("success"),l(3)}catch(h){if(console.error(h),h instanceof pI){E(h.message),O("registering");return}l(3),O("error")}}};return St.jsxs("div",{className:"flex flex-col flex-grow pb-14",children:[St.jsxs("div",{className:"sticky -top-1 bg-background-primary h-[48px] flex justify-center items-center px-3",children:[St.jsx("button",{type:"button",tabIndex:0,onClick:d,disabled:C==="processing",className:"absolute top-0 p-3 border-0 left-3 text-theme-primary dark:text-theme-secondary",children:St.jsx(mz,{width:24,height:24})}),St.jsx("div",{className:"w-[175px] h-[5px] rounded-md bg-background-interactive dark:bg-background-secondary bg-gradient-to-r",children:St.jsx("div",{className:sn("bg-theme-primary dark:bg-theme-secondary h-full rounded-md transition-[width] duration-500",M[c])})})]}),St.jsxs("div",{className:"flex flex-col flex-grow pt-6 body",children:[C==="success"&&St.jsx(AW,{}),C==="error"&&St.jsx(SW,{}),C==="processing"&&St.jsx(EW,{}),C==="registering"&&St.jsxs(St.Fragment,{children:[c===1&&St.jsxs(St.Fragment,{children:[St.jsx("p",{className:"px-3 mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You are registering"}),St.jsx("div",{className:"flex flex-col gap-2 px-3 pb-4",children:Object.values(p).map(h=>St.jsx(lW,{domain:h.domain,onEdit:()=>R(h.domain)},h.domain))}),St.jsx(q7,{isVisible:!!P,toggleVisibility:()=>R(""),children:!!P&&St.jsxs("div",{className:"w-[320px] p bg-background-primary flex flex-col gap-3 p-4 rounded-xl",children:[St.jsxs("p",{className:"flex items-start justify-between text-lg font-medium font-primary",children:["Storage size",St.jsx("button",{type:"button",tabIndex:0,className:"p-1 -mt-3 -mr-3",onClick:()=>R(""),children:St.jsx(GM,{width:24,height:24})})]}),St.jsxs("div",{className:"text-xs",children:[St.jsx("p",{className:"mb-2",children:"The storage size will determine the maximum amount of data you can store on your domain."}),St.jsxs("p",{className:"",children:[St.jsx(vz,{width:16,height:16,className:"inline mr-1 mb-[2px] text-accent"}),"Each additional kb of memory costs around 0.007 SOL (0.001 USDC)"]})]}),St.jsx("div",{className:"grid grid-cols-5 gap-2",children:kW.map(h=>{const g=p[P],S=h.value===(g==null?void 0:g.storage);return St.jsx("button",{type:"button",tabIndex:0,className:sn("border-2 border-solid rounded-lg px-2 py-2 border-theme-primary border-opacity-10 text-sm",S&&"border-opacity-100"),onClick:()=>{v({...g,storage:h.value}),R("")},children:h.label},h.value)})})]})})]}),c===2&&St.jsxs("div",{className:"flex flex-col flex-grow px-3 pb-5",children:[St.jsxs("div",{className:"mb-auto",children:[St.jsx("p",{className:"mb-3 ml-4 font-medium font-primary",children:"Pay with"}),St.jsx("div",{children:St.jsxs("button",{type:"button",tabIndex:0,className:"flex items-center w-full gap-4 p-4 border cursor-pointer rounded-xl border-interactive-border bg-background-interactive",onClick:()=>B(!A),children:[St.jsx("img",{className:"w-4 h-4 rounded-[50%]",src:w.icon,alt:w.tokenSymbol}),St.jsx("span",{className:"tracking-wide text-text-primary",children:w.tokenSymbol}),St.jsxs("div",{className:"relative w-[25px] h-[25px] flex justify-center items-center ml-auto",children:[St.jsx("div",{className:sn("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm -rotate-[45deg] ml-[5px]",A&&"rotate-[45deg]")}),St.jsx("div",{className:sn("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm rotate-[45deg] -ml-[4px]",A&&"-rotate-[45deg]")})]})]})})]}),St.jsxs("div",{children:[St.jsx("p",{className:"mb-3 font-medium font-primary",children:"Order summary"}),St.jsxs("div",{className:"flex items-start justify-between mb-2 text-sm font-medium leading-6 border-b border-interactive-border",children:[St.jsx("div",{children:"Total"}),St.jsxs("div",{className:"flex flex-col items-end",children:[St.jsxs("span",{children:[L0(a,!0)," ",w.tokenSymbol]}),St.jsx("span",{className:"text-xs leading-6 text-text-primary text-opacity-60 dark:text-text-secondary",children:L0(tt)})]})]}),St.jsxs("div",{className:"flex items-start justify-between text-sm font-medium leading-6 border-b border-interactive-border",children:[St.jsx("div",{children:"Discount"}),St.jsx("div",{children:z?"5%":"0%"})]})]}),St.jsx(q7,{isVisible:A,toggleVisibility:B,children:St.jsx("div",{className:"w-[320px] bg-background-primary flex flex-col gap-3 py-3 rounded-xl",children:mh.map(h=>{const g=G(h.mintAddress),S=i[h.tokenSymbol]{x(h),B(!1)},children:[St.jsx("img",{src:h.icon,alt:h.tokenSymbol,className:"w-6 h-6 rounded-[50%]"}),St.jsxs("div",{className:"flex flex-col items-start",children:[St.jsx("span",{children:h.tokenSymbol}),St.jsxs("span",{className:"flex text-xs text-text-secondary gap-0.5 items-center",children:[St.jsx(ZM,{width:14,height:14}),i[h.tokenSymbol]]})]}),St.jsxs("div",{className:"flex flex-col ml-auto text-sm",children:[St.jsxs("span",{className:sn("tabular-nums",h.mintAddress===O0&&"line-through"),children:[L0(nt(h.mintAddress),!0)," ",h.tokenSymbol]}),St.jsx("span",{className:"tabular-nums text-success",children:h.mintAddress===O0&&St.jsxs(St.Fragment,{children:[L0(G(h.mintAddress),!0)," ","FIDA"]})})]})]},h.tokenSymbol)})})})]})]})]}),C==="processing"?null:St.jsxs("div",{className:"absolute flex flex-col gap-2 left-3 right-3 bottom-4",children:[St.jsxs(Gv,{className:sn("text-base-button-content",C==="error"&&"bottom-[70px]"),onClick:o,children:[c===1&&"Continue to payment",c===2&&C==="registering"&&"Confirm and register",C==="success"&&"Done",C==="error"&&"Retry"]}),C==="error"&&St.jsx(Gv,{className:sn("bg-transparent text-theme-primary"),onClick:()=>r(),children:"Close"})]})]})},BW=()=>{const{visible:r,setVisible:t,connected:e,publicKey:n,disconnect:s}=ad(),[i,c]=xe.useState(!1),l=()=>{e?c(!i):t(!r)},p=()=>{s(),c(!1)};return St.jsxs("div",{className:"relative flex ml-auto",children:[St.jsxs("button",{type:"button",className:"relative flex items-center gap-2 px-3 h-[32px] py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":"Connect wallet","aria-haspopup":"true",onClick:l,children:[St.jsx(ZM,{width:16,height:16}),e?Yk(n==null?void 0:n.toString(),8,4):"Connect wallet",e&&St.jsx(gz,{className:sn("transition-transform",i&&"rotate-180")})]}),St.jsx("button",{type:"button",tabIndex:0,"aria-label":"Disconnect wallet",className:sn(!i&&"invisible opacity-0 -translate-y-1","absolute h-[48px] top-[100%] left-0 right-0 w-full z-10","duration-300 transition-[transform,opacity]","bg-background-secondary rounded-xl text-base flex items-center justify-center text-text-primary","shadow-domain dark:shadow-none dark:border dark:border-interactive-border","active:opacity-70 active:transition-none"),onClick:p,children:"Disconnect"})]})},PW=({status:r})=>{const{setStatus:t}=xe.useContext(sd);return xe.useMemo(()=>{setTimeout(()=>{t(null)},4e3)},[t]),St.jsxs("div",{className:sn("bg-background-primary dark:border dark:border-interactive-border","shadow-xl dark:shadow-none","absolute top-2.5 left-3 right-3 rounded-lg py-3 px-4 flex gap-2 z-10 overflow-hidden"),children:[St.jsx("div",{className:sn("absolute top-0 left-0 right-0 h-0.5 animate-width-to-zero",r.status==="error"&&"bg-error",r.status==="success"&&"bg-success")}),St.jsxs("button",{className:"absolute flex items-center justify-center w-5 h-5 top-1 right-1",type:"button",tabIndex:0,onClick:()=>t(null),children:[St.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary rotate-45"}),St.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary -rotate-45"})]}),r.status==="error"&&St.jsx(WM,{width:20,height:20,className:"rotate-180 text-error mt-0.5 shrink-0"}),St.jsx("span",{className:"font-medium font-primary",children:r.message})]})},RW=({className:r,style:t,partnerLogo:e}={})=>{var a,f;const{connected:n,setVisible:s,visible:i,connection:c}=ad(),[l,p]=xe.useState("home"),[m,v]=xe.useState(!1),[_,E]=xe.useState(!1),[w,x]=xe.useState(""),[A,B]=xe.useState(""),{isCartEmpty:P}=xe.useContext(Ah),{status:R}=xe.useContext(sd),C=uz({connection:c,domain:A}),O=fz({connection:c,domain:A}),[z,H]=xe.useState(null),tt=h=>{E(!1),z&&clearTimeout(z),x(hW({value:h,prev:w,onError:()=>{E(!0);const g=setTimeout(()=>{E(!1)},3e3);H(g)}}))},nt=h=>{h.preventDefault(),p("search"),B(w)},G=(h=!1)=>{h?(B(""),x(""),v(!1),p("home")):p("search")},M=l==="home",d=l==="search",o=l==="cart";return St.jsxs("div",{className:sn("flex flex-col w-[93svw] h-[560px] max-h-[75svh] max-w-[400px] bg-background-primary rounded-lg absolute bottom-16 right-0 text-text-primary overflow-auto","shadow-xl dark:border dark:border-interactive-border",r),style:t,"aria-label":"SNS widget allows you to quickly search and buy .sol domains",children:[R&&St.jsx(PW,{status:R}),St.jsxs("div",{className:"flex items-center px-3 pt-3",children:[!M&&St.jsx("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:St.jsx("span",{className:"h-[26px]",children:St.jsx(z7,{})})}),St.jsx(BW,{})]}),St.jsxs("div",{className:"flex flex-col flex-grow overflow-auto",children:[(M||d)&&St.jsxs(St.Fragment,{children:[St.jsxs("div",{className:sn("translate-y-[80px] transition-all duration-700 px-3",d&&"-translate-y-[22px]"),children:[St.jsx("h1",{className:sn("block max-h-[32px] text-2xl font-medium text-center font-primary transition-[opacity] ease-out duration-200",d&&"opacity-0 invisible",m&&"max-h-0"),onTransitionEnd:()=>{d&&v(!0)},children:"Secure a custom domain"}),St.jsxs("form",{className:"flex gap-2 mt-10",onSubmit:nt,children:[St.jsx(wz,{value:w,placeholder:"Search your domain",autoCapitalize:"off",spellCheck:"false",enterKeyHint:"search",className:"shadow-input-field dark:shadow-none",type:"search",required:!0,errorMessage:_?"Character not allowed":void 0,onChange:h=>tt(h.target.value)}),St.jsx("button",{className:` + rounded-[10px] bg-theme-primary h-[56px] w-[56px] p-2 + flex items-center justify-center text-base-button-content + `,tabIndex:0,children:St.jsx(dz,{width:24,height:24})})]})]}),d&&St.jsxs(St.Fragment,{children:[St.jsxs("div",{className:"px-3 mb-3 overflow-auto animate-fade-in",children:[C.loading?St.jsx(D7,{}):St.jsx(St.Fragment,{children:(a=C.result)==null?void 0:a.map(h=>St.jsx(N7,{domain:h.domain,available:h.available},h.domain))}),St.jsxs("div",{className:"mt-4",children:[O.status!=="error"&&St.jsx("p",{className:"mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You might also like"}),St.jsxs("div",{className:"flex flex-col gap-2 pb-14",children:[O.status==="error"&&St.jsxs("div",{children:[St.jsx("p",{className:"mb-6 text-sm tracking-widest text-center",children:"Looks like we have an issue helping you with domain suggestions."}),St.jsxs("button",{type:"button",className:"m-auto flex items-center gap-2 px-3 h-[32px] w-max py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":`Try load suggestions for ${A} again`,onClick:()=>O.execute(),children:["Try again '",A,"'"]}),St.jsx("p",{className:"my-6 text-sm tracking-widest text-center",children:"...and if the problem persists"}),St.jsx("div",{className:"flex justify-center",children:St.jsxs("a",{className:"flex items-center gap-2 justify-center text-theme-primary text-[11px] tracking-wider dark:text-theme-secondary",href:"https://discord.bonfida.org",target:"_blank",rel:"noopener",children:[St.jsx(bz,{width:24}),"Tell us on discord",St.jsx(yz,{width:18})]})})]}),O.loading?St.jsx(St.Fragment,{children:new Array(5).fill(0).map((h,g)=>St.jsx(D7,{},g))}):St.jsx(St.Fragment,{children:(f=O.result)==null?void 0:f.map(h=>St.jsx(N7,{domain:h.domain,available:h.available},h.domain))})]})]})]}),!P&&St.jsx(Gv,{className:"absolute left-3 right-3 bottom-3 text-base-button-content",onClick:()=>{n?p("cart"):s(!i)},children:n?"Go to cart":"Connect your wallet"})]})]}),o&&St.jsx(IW,{backHandler:G})]}),M&&St.jsx("div",{className:"p-3",children:St.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:["Powered by",St.jsx("span",{className:"h-[20px] flex",children:St.jsx(z7,{})}),e&&St.jsxs(St.Fragment,{children:[St.jsx("span",{children:"x"}),St.jsx("span",{className:"flex",children:e})]})]})})]})},mG=({endpoint:r,connection:t,passthroughWallet:e,containerClassNames:n,containerStyles:s,referrerKey:i,partnerLogo:c})=>St.jsx(YC,{endpoint:r,connection:t,passthroughWallet:e,children:St.jsx(KC,{referrerKey:i,children:St.jsx($C,{children:St.jsx(RW,{className:n,style:s,partnerLogo:c})})})});export{mG as default}; diff --git a/preview-build/index.html b/preview-build/index.html index 473b4fa..b12c690 100644 --- a/preview-build/index.html +++ b/preview-build/index.html @@ -4,7 +4,7 @@ SNS Registration Widget - + diff --git a/src/lib/components/domain-search-result-row.tsx b/src/lib/components/domain-search-result-row.tsx index 8b514b4..54c3abf 100644 --- a/src/lib/components/domain-search-result-row.tsx +++ b/src/lib/components/domain-search-result-row.tsx @@ -1,10 +1,9 @@ import { twMerge } from "tailwind-merge"; +import { getDomainPriceFromName } from "@bonfida/spl-name-service"; import { ShoppingBasketHorizontal, TrashBent, Tick } from "../components/icons"; import { useContext, useEffect, useState } from "react"; import { CartContext } from "../contexts/cart"; import { DomainCardBase } from "./domain-card-base"; -import { priceFromLength } from "../utils"; - export const DomainSearchResultRow = ({ domain, available = false, @@ -15,7 +14,7 @@ export const DomainSearchResultRow = ({ price?: number; }) => { const { cart, addToCart, removeFromCart } = useContext(CartContext); - price = price ?? priceFromLength(domain); + price = price ?? getDomainPriceFromName(domain); const isInCart = Boolean(cart[domain]); const [showRemoveButton, toggleRemoveButton] = useState(isInCart); diff --git a/src/lib/hooks/index.ts b/src/lib/hooks/index.ts index 7cb6916..6375363 100644 --- a/src/lib/hooks/index.ts +++ b/src/lib/hooks/index.ts @@ -1,4 +1,2 @@ -export * from "./useSearch"; -export * from "./useDomainSuggestions"; export * from "./usePyth"; export * from "./useWalletBalances"; diff --git a/src/lib/hooks/useDomainSuggestions.ts b/src/lib/hooks/useDomainSuggestions.ts deleted file mode 100644 index 943ac4a..0000000 --- a/src/lib/hooks/useDomainSuggestions.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { useAsync } from "react-async-hook"; -import { useConnectionPassThrough } from "../contexts/connection-passthrough-provider"; -import { generateRandomDomain } from "../utils"; -import { getDomainsResult } from "./useSearch"; - -const URL = "https://sns-api.bonfida.com/v2/suggestion/search"; - -export const useDomainSuggestions = (domain: string) => { - const { connection } = useConnectionPassThrough(); - - const fn = async () => { - if (!domain || domain === "") return; - - const data: string[] = await ( - await fetch(`${URL}/${domain}`, { - method: "GET", - }) - ).json(); - - const splitted = domain.split("."); - const isSub = splitted.length === 2; - if (isSub) return []; - if (!data || data.length < 5) { - if (!connection) return []; - const alternatives = generateRandomDomain(domain, 10); - const result = getDomainsResult(connection, alternatives); - return result; - } - // All domains returned by the API are available - return data.map((e) => { - return { domain: e, available: true }; - }); - }; - - return useAsync(fn, [domain, !!connection]); -}; diff --git a/src/lib/hooks/useSearch.ts b/src/lib/hooks/useSearch.ts deleted file mode 100644 index 1264c4a..0000000 --- a/src/lib/hooks/useSearch.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { getDomainKeySync } from "@bonfida/spl-name-service"; -import { useConnectionPassThrough } from "../contexts/connection-passthrough-provider"; -import { useAsync } from "react-async-hook"; -import { generateRandomDomain } from "../utils"; -import type { Connection } from "@solana/web3.js"; - -export interface Result { - domain: string; - available: boolean; -} - -export const getDomainsResult = async ( - connection: Connection, - domains: string[], -): Promise => { - const keys = domains.map((e) => getDomainKeySync(e).pubkey); - const infos = await connection?.getMultipleAccountsInfo(keys); - if (!infos) { - return []; - } - - return domains.map((e, idx) => ({ - domain: e, - available: !infos[idx]?.data, - })); -}; - -export const useSearch = (domain: string) => { - const { connection } = useConnectionPassThrough(); - const fn = async (): Promise => { - if (!domain || !connection) return []; - - const splitted = domain.split("."); - const isSub = splitted.length === 2; - - if (isSub) { - const parsedDomain = splitted[1]; - const subdomainKey = getDomainKeySync(domain).pubkey; - const subdomainInfo = await connection?.getAccountInfo(subdomainKey); - - const domainsAlternatives = generateRandomDomain(parsedDomain, 10); - const domainsAlternativesResult = await getDomainsResult( - connection, - domainsAlternatives, - ); - // if the subdomain doesn't exists check if the domain is available - if (!subdomainInfo?.data) { - const domainKey = getDomainKeySync(parsedDomain).pubkey; - const domainInfo = await connection?.getAccountInfo(domainKey); - - return [ - { domain: parsedDomain, available: !domainInfo?.data }, - ...domainsAlternativesResult, - ]; - } else { - return [ - { domain, available: !subdomainInfo.data }, - ...domainsAlternativesResult, - ]; - } - } - - const domains = [domain]; - return getDomainsResult(connection, domains); - }; - - return useAsync(fn, [!!connection, domain]); -}; diff --git a/src/lib/types/split-graphemes.d.ts b/src/lib/types/split-graphemes.d.ts deleted file mode 100644 index 3031e47..0000000 --- a/src/lib/types/split-graphemes.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module "split-graphemes" { - function splitGraphemes(input: string): string[]; - - export { splitGraphemes }; -} diff --git a/src/lib/utils/price.ts b/src/lib/utils/price.ts index 687d60f..ccb4000 100644 --- a/src/lib/utils/price.ts +++ b/src/lib/utils/price.ts @@ -1,22 +1,3 @@ -import { splitGraphemes } from "split-graphemes"; - -export const priceFromLength = (name: string, discountMultiplier = 1) => { - const split: string[] = splitGraphemes(name); - const length = split.length; - switch (length) { - case 1: - return 750 * discountMultiplier; - case 2: - return 700 * discountMultiplier; - case 3: - return 640 * discountMultiplier; - case 4: - return 160 * discountMultiplier; - default: - return 20 * discountMultiplier; - } -}; - const formatter = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", diff --git a/src/lib/views/cart/index.tsx b/src/lib/views/cart/index.tsx index 54a47e1..3eef984 100644 --- a/src/lib/views/cart/index.tsx +++ b/src/lib/views/cart/index.tsx @@ -7,6 +7,7 @@ import { } from "../../components/icons"; import { twMerge } from "tailwind-merge"; import { NATIVE_MINT, getAssociatedTokenAddressSync } from "@solana/spl-token"; +import { getDomainPriceFromName } from "@bonfida/spl-name-service"; import { PublicKey, Transaction, @@ -22,7 +23,6 @@ import { BaseModal } from "../../components/modal"; import { tokenList, FIDA_MINT, - priceFromLength, formatPrice, wrapSol, unwrapSol, @@ -72,7 +72,7 @@ export const CartView = ({ backHandler }: CartViewProps) => { const isSelectedTokenFIDA = selectedToken.mintAddress === FIDA_MINT; const discountMul = isSelectedTokenFIDA ? 0.95 : 1; const totalUsd = Object.values(cart).reduce( - (acc, v) => acc + priceFromLength(v.domain, discountMul), + (acc, v) => acc + getDomainPriceFromName(v.domain) * discountMul, 0, ); diff --git a/src/lib/views/home.tsx b/src/lib/views/home.tsx index bfa808e..bd3dbdd 100644 --- a/src/lib/views/home.tsx +++ b/src/lib/views/home.tsx @@ -4,6 +4,7 @@ import { useContext, type CSSProperties, } from "react"; +import { useSearch, useDomainSuggestions } from "@bonfida/sns-react"; import { InputField } from "../components/input-field"; import { Discord, ExternalLink, SearchShort } from "../components/icons"; import { twMerge } from "tailwind-merge"; @@ -14,9 +15,7 @@ import { CustomButton } from "../components/button"; import { FidaLogo } from "../components/fida-logo"; import { CartView } from "./cart"; import { useWalletPassThrough } from "../contexts/wallet-passthrough-provider"; -import { useSearch } from "../hooks/useSearch"; import { sanitize } from "../utils"; -import { useDomainSuggestions } from "../hooks/useDomainSuggestions"; import { ConnectWalletButton } from "../components/connect-wallet-button"; import { GlobalStatusCard } from "../components/global-status"; import { GlobalStatusContext } from "../contexts/status-messages"; @@ -37,6 +36,7 @@ export const WidgetHome = ({ connected, setVisible, visible: isWalletSelectorVisible, + connection, } = useWalletPassThrough(); const [currentView, setCurrentView] = useState("home"); const [finished, toggleTransitionFinish] = useState(false); @@ -45,8 +45,11 @@ export const WidgetHome = ({ const [searchQuery, setSearchQuery] = useState(""); const { isCartEmpty } = useContext(CartContext); const { status } = useContext(GlobalStatusContext); - const domains = useSearch(searchQuery); - const suggestions = useDomainSuggestions(searchQuery); + const domains = useSearch({ connection: connection!, domain: searchQuery }); + const suggestions = useDomainSuggestions({ + connection: connection!, + domain: searchQuery, + }); const [timeoutId, setTimeoutId] = useState | null>(null);